An EC2 instance is a web server or a virtual machine in the AWS infrastructure. It stands for Elastic Compute Cloud. It is the most popular service in AWS.
Pre-requisites to launch an EC2 instance:
- The user launching the EC2 instance should have proper IAM Access policies or should be the root user to launch the instance.
- Check the region of the AWS account as the EC2 instance is region scoped.
Steps to launch an EC2 instance:
- Select EC2 from the compute category of the AWS services.
- Select the Launch Instance option from the EC2 dashboard.
- Choose the Amazon Machine Image (AMI).
- Choose the instance type.
- Configure instance details.
- Add Storage.
- Add tags.
- Configure security groups.
- Review and launch the instance.
- Create/choose a key pair.
1.Select EC2 from the compute category of the AWS services
AWS has around 250 services; all these services are categorized based on their usage. Since EC2 is a web server or virtual machine, we can find it under the compute category.
2.Select the launch instance option from the EC2 dashboard
Once in the EC2 dashboard, we need to click on the launch instance option to create a new instance.
3.Choose the Amazon Machine Image (AMI)
AWS has many Amazon machine images; AMI is nothing but the operating system such as Ubuntu, Linux, Windows, Mac OS, etc. So we can select any AMI we desire to use for our EC2 instance.
4.Choose the instance type
After selecting the AMI, we need to choose an instance type; there are around 750 instance types in AWS, and each instance has its configuration and is different from the other instances. It has attributes such as Type, vCPU, Memory, Instance Storage, Network Performance etc. We can decide the type of instance based on our application requirement. AWS also provides some instances for the free tier.
5.Configure instance details
Here, we can configure our instance details such as the number of instances to be created, purchasing options, placement group, and other network settings. We can also install the software we require our EC2 instance to have; this can be done by specifying the user data. The user data will run only once, i.e., at the first booting of the instance, where it performs all the operations specified in the user data.
The next step is to add additional storage to our instance; our instance comes with a default root EBS volume. If the user wants more storage, they can create a new EBS volume of any type by clicking on add storage.
The next step is to add tags, and this is optional. AWS allows us to add up to 50 tags. Each tag represents a case-sensitive key-value pair.
8.Configure security groups
Security groups are the networking fundamentals in AWS. It is the firewall between the EC2 and the internet. We can create and assign a new security group to the EC2 instance or attach an existing security group. This is used to specify who will have access to our EC2 instance. A default SSH rule will be specified while creating it; we can add additional rules such as HTTP or HTTPS and set the source IP address to allow access. (we can also attach an existing security group instead of the IP addresses).
9.Review and launch instance
All the details entered in the previous steps will be displayed here; you can review and make any changes before you launch your instance.
10.Create/choose a key pair
The last step is to create or choose an existing key pair; the key pair combines a public key and a private key file. The AWS stores the public key, and the user will store the private key file; the private key file will have the extension “.pem.” For Windows AMIs, this file is required to obtain the password used to log on to the EC2 instance. For Linux AMIs, this file is required to securely SSH into the EC2 instance.
On clicking the launch instance, our instance will be created.
There’s a lot that goes into launching a new EC2 instance, but following these steps will help you get started on the right foot. Be sure to read through the Amazon EC2 documentation to get a more complete understanding of all the options and settings available to you. A lot of people have had great success with Testleaf’s AWS certification training online in Chennai. The success rate has been really high, which is great news for anyone looking to get into this field.