What is Amazon EC2 Instance?
An EC2 instance is nothing but a virtual server in the term of the Amazon Web Services.
This is a web service where AWS subscriber can request and provide a compute server in the AWS cloud.
On-Demand EC2 instance is an offer from AWS where the subscriber/user can hire a virtual server per hour and can use it to deploy their own apps.
Depending on the type of chosen component, the rates will be apply by every hour with different rates.
The AWS provides multiple component types for the user’s related professional needs.
Thus, you can rent an instance based on your own CPU and memory requirements and you can use it as much as you want.
When it is not used more and you save it on cost, you can finish it.
This is the biggest benefit of on-demand instance – you can save heavily on your CAPEX.
In this tutorial, you will learn-
- Login and access to AWS services
- Choose AMI
- Choose EC2 Instance Types
- Configure Instance
- Add Storage
- Tag Instance
- Configure Security Groups
- Review Instances
So Let’s Begin And see in detail how to launch an on-demand EC2 instance in AWS Cloud.
Login and access to AWS services
Step 1: In this step,
- Log in to your AWS account and go to the AWS Services tab in the top left corner of your screen.
- Here, you have their AWS Serve services by their area. For Example Counting, storage, database, etc. To make EC2 instance, we will have to choose Compute EC2 in the next step.
- Open all the services and click on EC2 under Compute services. This will launch the dashboard of EC2.
Here is the EC2 dashboard Here you will get all the information about the AWS EC2 resources running.
Step 2: On the upper right corner of the EC2 dashboard, select the AWS field in which you want to provision an EC2 server.
Here we are choosing N. Virginia. AWS provides 10 regions around the world.
Step 3) In this step
- After selecting your desired region, come back to the EC2 Dashboard.
- Click on the ‘Launch Instance’ button in the Create Inception section (as shown below).
- When you click ‘Launch Instance‘, instance creation wizard page will open.
Read this Article maybe you like :
Step 1: In this step we will do,
- You will be asked to choose AMI of your choice. (AMI is an Amazon Machine image). It is basically a template of the operating system platform that you can use to build your Instance as a base). Once you launch EC2 Instance from your favorite AMI, the event will automatically boot up with the desired OS. (We will see more about AMI in the next part of the tutorial).
- Here you can select Basic Amazon Linux (64bit) AMI or Ubuntu Server 18.04 LTS (HVM), SSD Volume Type as per your interest.
Choose EC2 Instance Types
Step 1: In the next step, you have to choose the type of instance you require based on your business needs.
- We will choose the instance type t2.micro, which is a 1vCPU and 1GB memory server offered by AWS.
- Click on “Configure instance details” to get more settings.
- In the next step of the wizard, enter details like number of instances that you want to start at the same time.
- Here we are launching one instance.
Step 1: Here in Number of instances – You can provide in 20 instances at the same time. Here we are starting with one instance.
Step 2: In Purchasing Options – As of now keep the option of ‘Request Spot Instances’ unchecked as of now. (This is done when we wish to launch Spot instances instead of on-demand ones. We will come back to Spot instances in the later part of the tutorial).
Step 3: Next, we have to configure some basic networking details for our EC2 server.
- You have to decide here, in which VPC (Virtual Private Cloud) you want to launch your instance and under which subnets in your VPC. It is better to decide and plan ahead before launching the instance.
- Subnetting needs to be organized in advance. For example, if it is a web server, you have to put it in the public subnet and if it is a database server, you must put it in your private VPC private subnet inside your VPC.
As In Below,
- Network section will give a list of VPCs available in our platform.
- Select an already existing VPC
- You can also create a new VPC
Here I have selected an already existing VPC where I want to launch my instance.
Step 4: In this step,
- A VPC consists of subnets, which are IP ranges that are separated to restricting access.
- Under Subnets, you can choose the subnet where you want to place your instance.
- I have chosen an already existing public subnet.
- You can also create a new subnet in this step.
- Once your instance is launched in a public subnet, AWS will assign a dynamic public IP to it from their pool of IPs.
Step 5: In this step,
- In Auto assign Public IP you can choose if you want AWS to assign it an IP automatically, or you want to do it manually later. You can enable/ disable ‘Auto assign Public IP‘ feature here likewise.
Here we are going to assign this instance a static IP called as EIP (Elastic IP) later. So we keep this feature disabled as of now.
Step 6: In the following step, keep the option of IAM role ‘None’ as for now. We will visit the topic of IAM role in detail in IAM services.
Step 7: In this step, you have to do the following things
- Shutdown Behavior– when you accidentally shut down your instance, you surely don’t want it to be deleted but stopped.
Here we are defining my shutdown behavior as Stop.
Step 8: In this step,
- In case of Enable termination protection, you have accidentally terminated your instance, AWS has a layer of security mechanism. It will not delete your instance if you have enabled accidental termination protection.
Here we are checking the option for further protecting our instance from accidental termination.
Step 9: In this step,
- Under Monitoring- you can enable Detailed Monitoring if your instance is a business critical instance. Here we have kept the option unchecked. AWS will always provide Basic monitoring on your instance free of cost. We will visit the topic of monitoring in AWS Cloud Watch part of the tutorial.
- Under Tenancy- select the option if shared tenancy. If your application is a highly secure application, then you should go for dedicated capacity. AWS provides both options.
Step 10) In this step,
- Click on ‘Add Storage’ to add data volumes to your instance in next step.
Step 1) In this step we do following things,
- In the Add Storage step, you’ll see that the instance has been automatically provisioned a General Purpose SSD root volume of 8GB. ( Maximum volume size we can give to a General Purpose volume is 16GB)
- You can change your volume size, add new volumes, change the volume type, etc.
- AWS provides 3 types of EBS volumes- Magnetic, General Purpose SSD, Provisioned IOPs. You can choose a volume type based on your application’s IOPs needs.
Step 1) In this step
- you can tag your instance with a key-value pair. This gives visibility to the AWS account administrator when there are lot number of instances.
- The instances should be tagged based on their department, environment like Dev/SIT/Prod. Etc. this gives a clear view of the costing on the instances under one common tag.
- Here we have tagged the instance as a Dev_Web server 01
- Go to configure Security Groups later
Configure Security Groups
Step 1) In this next step of configuring Security Groups, you can restrict traffic on your instance ports. This is an added firewall mechanism provided by AWS apart from your instance’s OS firewall.
You can define open ports and IPs.
- Since our server is a webserver=, we will do following things
- Creating a new Security Group
- Naming our SG for easier reference
- Defining protocols which we want enabled on my instance
- Assigning IPs which are allowed to access our instance on the said protocols
- Once, the firewall rules are set- Review and launch
Step 1) In this step, we will review all our choices and parameters and go ahead to launch our instance.
Step 2) In the next step you will be asked to create a key pair to login to you an instance. A key pair is a set of public-private keys.
AWS stores the private key in the instance, and you are asked to download the public key. Make sure you download the key and keep it safe and secured; if it is lost you cannot download it again.
- Create a new key pair
- Give a name to your key
- Download and save it in your secured folder
- When you download your key, you can open and have a look at your RSA private key.
Step 3) Once you are done downloading and saving your key, launch your instance.
- You can see the launch status meanwhile.
- You can also see the launch log.
- Click on the ‘Instances’ option on the left pane where you can see the status of the instance as ‘Pending’ for a brief while.
- Once your instance is up and running, you can see its status as ‘Running’ now.
- Note that the instance has received a Private IP from the pool of AWS.
That’s It For AWS EC2 instance creation from my end.
Now it’s your turn to give feed back to me. If you have any further question/doughts related to AWS EC2 instance creation then, leave a Quick comment below right now and share this artical to spreed knowledge about AWS cloud.