What is Amazon EC2 (Elastic Compute Cloud)?
Amazon Web service offers EC2 which is a short form of Elastic Compute Cloud (ECC) it is a cloud computing service offered by the Cloud Service Provider AWS. You can deploy your applications in EC2 servers without any worrying about the underlying infrastructure. You configure the EC2-Instance in a very secure manner by using the VPC, Subnets, and Security groups. You can scale the configuration of the EC2 instance you have configured based on the demand of the application by attaching the autoscaling group to the EC2 instance. You can scale up and scale down the instance based on the incoming traffic of the application.
The following figure shows the EC2-Instance which is deployed in VPC (Virtual Private Cloud).
Use Cases of Amazon EC2 (Elastic Compute Cloud)
The following are the use cases of Amazon EC2:
Deploying Application: In the AWS EC2 instance, you can deploy your application like .jar,.war, or .ear application without maintaining the underlying infrastructure.
Scaling Application: Once you deployed your web application in the EC2 instance know you can scale your application based upon the demand you are having by scaling the AWS EC2-Instance.
Deploying The ML Models: You can train and deploy your ML models in the EC2-instance because it offers up to 400 Gbps), and storage services purpose-built to optimize the price performance for ML projects.
Hybrid Cloud Environment: You can deploy your web application in EC2-Instance and you can connect to the database which is deployed in the on-premises servers.
Cost-Effective: Amazon EC2-instance is cost-effective so you can deploy your gaming application in the Amazon EC2-Instances
AWS EC2 Instance Types
Different Amazon EC2 instance types are designed for certain activities. Consider the unique requirements of your workloads and applications when choosing an instance type. This might include needs for computing, memory, or storage.
The AWS EC2 Instance types are as follows:
General Purpose Instances
Compute Optimized Instances
Memory-Optimized Instances
Storage Optimized Instances
Accelerated Computing Instances
1. General Purpose Instances
It provides the balanced resources for a wide range of workloads.
It is suitable for web servers, development environments, and small databases.
Examples: T3, M5 instances.
2. Compute Optimized Instances
It provides high-performance processors for compute-intensive applications.
It will be Ideal for high-performance web servers, scientific modeling, and batch processing.
Examples: C5, C6g instances.
3. Memory-Optimized Instances
High memory-to-CPU ratios for large data sets.
Perfect for in-memory databases, real-time big data analytics, and high-performance computing (HPC).
Examples: R5, X1e instances.
4. Storage Optimized Instances
It provides optimized resource of instance for high, sequential read and write access to large data sets.
Best for data warehousing, Hadoop, and distributed file systems.
Examples: I3, D2 instances.
5. Accelerated Computing Instances
It facilitates with providing hardware accelerators or co-processors for graphics processing and parallel computations.
It is ideal for machine learning, gaming, and 3D rendering.
Examples: P3, G4 instances.
Pricing of AWS EC2 (Elastic Compute Cloud) Instance
The pricing of AWS EC2-instance is mainly going to depend upon the type of instance you are going to choose. The following are the pricing charges on some of the EC2-Instances.
On-Demand Instances: The On-Demand instance is like a pay-as-you-go model where you have to pay only for the time you are going to use if the instance is stopped then the billing for that instance will be stopped when it was in the running state then you are going to be charged. The billing will be done based on the time EC2-Instance is running.
Reserved Instances: Reversed Instance is like you are going to give the commitment to the AWS by buying the instance for one year or more than one year by the requirement to your organization. Because you are giving one year of Commitment to the AWS they will discount the price on that instance.
Spot Instances: You have to bid the instances and who will win the bid they are going to get the instance for use but you can’t save the data which is used in this type of instance.
Benefits of Amazon EC2
The following are the benefits of Amazon EC2:
Scalability: It helps to easily scale the instances up or down based on the demand with ensuring the optimal performance and cost-efficiency.
Flexibility: It provides wide variety of instance types and configurations for matching different workload requirements and operating systems.
Cost-Effectiveness: It comes with providing Pay-as-you-go model with options like On-Demand, Reserved, and Spot Instances for managing cost efficiently.
High Availability and Reliability: It offers multiple geographic regions and availability zones for strong fault tolerance and disaster recovery.
Create EC2 Instance in AWS (Amazon)
The following are the steps for creating an EC2 instance in AWS (Amazon):
Step 1: First, log into your AWS account and click on “services” present on the left of the AWS management console, i.e. the primary screen. From the drop-down menu of options, tap on “EC2”. To create an AWS free tier account refer to Amazon Web Services (AWS) – Free Tier Account Set up.
Under Resources >> Click on “Instances running” — It will show if any EC2 instances are running or not.
Step 2: Click on the launch instance click on the launch instance, after clicking on it you will be redirected to a launch page where we can create an instance. Configure all the requirements to Create a new instance like the name of the instance as shown in the figure below.
Naming instance
Step 3: Select AMI – Required operating system from the available. There are different types of OS available select the OS as per your requirement.
Selecting AMI
Step 4: By default, it selects a free tier of storage. (IF YOU ARE ELIGIBLE FOR THE FREE TIER). From the available storage specifications, select a free tier-eligible storage service. The instance type includes the no.of CPUs required and the Memory required for your application. By default, the instance type is “t2.micro” which is a free tier-eligible service. Do not select any other which leads to the billing amount. To know more about instance types refer to Amazon EC2 – Instance Types.
Select instance type
Step 4: Now, create a key-value pair, by clicking on “Create new key pair”. A window will pop up for creating key pair as shown below. The key value pair plays a major role while connecting to the EC2-Instance it will act as an SSH-Key to connect to the instance. Create Key-PairEnter name>>Select “.pem” and create. Automatically key pair which was created will be downloaded. Select the created key pair.
Creating key pair
Step 5: Keep the network settings as default settings and make changes if required.StorageAs mentioned in the picture, Free tier eligible can get up to 30 GB of EBS Storage. Keep it as default.
Step 6: Launching Instance At last, Check if all the selected are eligible for a free tier or not and click on “Launch instance”.That’s it, an instance will be created.
Steps To Connect Terminal Using SSH-Key
Step 1: Select the server to which you want to connect and click on the connect button at the top of that instance as shown in the image below.
Step 2: Copy the SSH key which is right following the example it will acct as a key-pair to connect to EC2-Instance.
Step 3: Open the terminal and go to the folder where your .pem file is located and paste the key that you have copied in AWS and paste it in the terminal.
To know whether you connected to EC2-Instance perfectly or not you can check the IP-Adrees of the instance if the IP is displaying then you have connected successfully.
Amazon EC2 (Elastic Compute Cloud) is a cloud computing service by AWS enabling deployment of applications without managing underlying infrastructure. It offers secure configuration through VPCs, subnets, and security groups, and supports autoscaling based on demand. Use cases include deploying applications, scaling applications, deploying ML models, hybrid cloud environments, and cost-effective solutions for gaming applications. EC2 instance types are tailored for different needs: General Purpose, Compute Optimized, Memory Optimized, Storage Optimized, and Accelerated Computing Instances. Pricing options include On-Demand, Reserved, and Spot Instances. EC2 benefits include scalability, flexibility, cost-effectiveness, and high availability. Steps for creating and connecting to an EC2 instance using SSH keys are also outlined.