Amazon Elastic Compute Cloud (EC2)
The Amazon Elastic Compute Cloud or popularly known as the Amazon EC2 provides a secure and resizable computing space that supports any workload, virtually. It allows scalable computing capacity to the Amazon Web Services (AWS) Cloud. Using Amazon EC2 eliminates your investment in hardware up-front, which also promotes faster development and deployment of the applications. Not only this, but you’ll also be happy to know that the EC2 Service for your AWS account is offered at NO ADDITIONAL CHARGES for specific AMIs. You will be charged for use of other AWS services by your users, ONLY.
You must be hearing of EC2 quite very often but don’t know what exactly it is; for that let us assure you that you’re just at the right place!! In this blog post, we’ll be describing all about EC2 of AWS in-depth. Also, we’ll be linking our YouTube demonstration on how to get started with EC2 and Launch your instances.
The content of this post includes:
- What is Amazon EC2?
- How to create an EC2 instance?
- Choose an Amazon Machine Images (AMI)
- Chose Instance Types
- Configuration Instance
- Add storage
- Add tags
- Configure Security group
- Review and Launch
- How to connect to your EC2 instance through SSH
- Connecting to the webserver
- Termination
- Tutorial
What is Amazon EC2?
Amazon Elastic Compute Cloud (Amazon EC2) is a web service that provides secure, resizable compute capacity in the cloud. It is designed such that web-scale cloud computing becomes way much easier for developers. The simple web service interface of the Amazon EC2 allows developers to obtain and configure capacity with minimal friction. It provides the users with complete control of the computing resources and allows them to run on Amazon’s proven computing environment.
Not only this, Amazon EC2 allows you to launch as many or as few virtual servers as you need and also configure security and networking, and manage storage. Amazon EC2 enables the users to scale up or down in order to handle changes in requirements or spikes in popularity, reducing the need to forecast traffic.
For further details on EC2, Click here.
How to create an EC2 instance?
Creating and launching an EC2 instance is a very simple task, yet you need to be careful while doing so as it is a process consisting of 7 (seven) crucial steps. Hey, hey!! Don’t scare away we are going to explain the entire process in detail and quite comprehensively so that you can have a proper understanding.
To launch a new EC2 instance from an AMI, do the following:
- First of all, you’ll need to login into your AWS account. Then open your EC2 Dashboard.
- From the left side panel select, Instances. The corresponding Instances Window will open up.
- Now, Click on Launch Instances. This will open up the consecutive steps that you’ll need to follow in order to create and launch your EC2 instance.
Note: Before getting started, be sure to select the AWS Region where you want to launch the instance in.
Step 1: Choose an Amazon Machine Image(AMI)
An AMI is a template that contains your Software configurations such as an Operating system, Application Server, and applications required to launch your instances.
Choose the required AMI(s) in this step from the list of AMIs, that you want to use to launch a new instance with. Now click Select.
Step 2: Choose an instance type
Instance Type is a combination of CPU, memory, storage, and network capacity.
There are many Instance Families to choose from:
t2/t3: Burstable Instances give good performance for a short period of time.
R: These instances have a lot of RAM and can be used for In-Memory cache Applications.
C: These instances have a good CPU- for Compute and Database purposes.
I: Good for local Input-Output. Database purposes.
G: have a good GPU. Can be used for video rendering and machine learning.
M: These instance types can be used for balanced workload like deploying web Apps.
Choose an instance type, and then choose Next: Configure Instance Details.
Step 3: Configure Instance Details
This step involves the customization of the EC2 Server. You can enable Instance Public IP, decide your preferred VPC and Subnet for your instance. You can also decide on the shutdown behavior, tenancy and configure some User Data for your Instance that will allow you to configure the EC2 instance after launch.
Optionally select configuration details, such as associating an IAM role with the instance. Select Next: Add Storage.
Step 4: Add Storage
Amazon EC2 provides you with flexible, cost-effective, and easy-to-use data storage options for your instances. Each option has a unique combination of performance and durability. These storage options can be used independently or in combination to suit your requirements.
For more storage options visit: here
You can use the default root volume type, or select a new type from the Volume Type drop-down. Select Add New Volume if you want to add additional storage to your instance. Select Next: Add Tags.
Step 5: Add Tags
A tag consists of a case-sensitive key-value pair.Tags enable you to categorize your AWS resources in different ways, for example, by purpose, owner, or environment. For example, you could define a set of tags for your account’s Amazon EC2 instances that helps you track each instance’s owner and stack level.
For more details about tags visit: here
You can add custom tags to your instance to help you categorize your resources. Select Next: Configure Security Group.
Step 6: Configure Security Group
A security group acts as a virtual firewall for your EC2 instances to control incoming and outgoing traffic. Inbound rules control the incoming traffic to your instance, and outbound rules control the outgoing traffic from your instance. When you launch an instance, you can specify one or more security groups. If you don’t specify a security group, Amazon EC2 uses the default security group. You can add rules to each security group that allow traffic to or from its associated instances.
To know more about Security Groups visit: here
You can associate a security group with your instance to allow or block traffic to the instance. Select Review and Launch.
Step 7: Review and Launch
Review the instance details. You may select Previous to return to a previous screen to make changes. Else, select Launch if you are all set to launch the instance.
Important: Select an existing key pair or create a new key pair, select the acknowledge agreement box, and then choose Launch Instances. Choose View Instances to check the status of your instance.
How to connect to your EC2 instance through SSH
Most often it so happens that your Windows or Mac or Linux computer most likely includes an SSH client (the command prompt in windows) by default. You can check for an SSH client by typing ssh at the command line(CLI). If your computer doesn’t recognize the command, the OpenSSH project provides a free implementation of the full suite of SSH tools. So, now you can connect to your EC2 instance using the CLI of your respective OS, through SSH.
For detailed steps visit: Connect to EC2 instance through SSH.
Connecting to the webserver
Using a browser is the fastest way to connect to your instance and view your output. It is generally recommended to use the Firefox or the Safari Browser to connect to the webserver because Java is disabled in Chrome.
For detailed steps visit: Connect to the webserver
Termination
It’s always a good practice to terminate the instance once you are done with it. This like cleaning up your workspace!!
You can’t reconnect to an instance after you’ve terminated it. This is because terminating an instance is actually effectively deletes it. However, it’s important to keep in mind that, terminating the instance differs from stopping the instance; when you stop an instance, it is shut down and you are not billed for hourly usage or data transfer (but you are billed for any Amazon EBS volume storage). Also, you may restart a stopped instance at any time, you want to. For more information about the differences between stopping and terminating an instance, visit: Stopping Instances. Also, do check the AWS free tier at: free tier cloud.
For details steps to Terminate an Instance visit: Cleaning up instance
Tutorial
At the end of these details, we are adding a small YouTube video for your reference.
Don’t Forget to subscribe our YouTube Channel for more updates.