Amazon Elastic Compute Cloud (Amazon EC2) provides scalable computing capacity on the Amazon Web Services cloud. An instance is a virtual server with flexible capacity. With EC2, you can set up and configure the operating systems and applications that run on your instances ie. servers. Here we will learn how to launch Linux EC2 Instance in AWS. So Let’s get started with Amazon EC2 by launching a Linux instance.
Prerequisite
- An Account on AWS with Web Console Access
- Good speed Internet Connection
Launching an Amazon EC2 Instance
Here we will launch a linux instance ie. ubuntu 20.04 which will be Amazon EBS-backed instance means root volume is an EBS volume. You can either specify the Availability Zone in which you want your instance should run, or let Amazon select an Availability Zone for your instance. When you launch an instance, you have to secure it by specifying a key pair and security group. When you connect to your instance, you must connect it with the private keys of the key pair that you specified earlier when launching your EC2 instance.
Amazon EC2 Console
You can access Amazon EC2 console at https://console.aws.amazon.com/ec2/
From the console dashboard, choose Launch Instance.
Choose an Amazon Machine Image
The section shows a list of basic configurations of AMIs that is a templates for linux and windows instance. Select the AMI for your favourite linux distribution. We will launch Ubuntu 20.04 LTS. Choose your desired AMI and click on Select.
Choose instance type
For practice, you should go for Free tier eligible AMIs. By default, t2.micro type is selected. Notice that this instance type is eligible for the free tier. Click on Next: Configure instance Details.
Configure instance details
This section contains various options related to instance configuration. You can specify how many instances you want to launch. You can specify purchasing options, Network related details, IAM Roles, Machine Behaviour, File System and Advance details with metadata and userdata. In network section, you can specify Virtual private cloud, subnet and elastic IP or pool IP. You can specify placement group so that you can launch all your instances on a particular Server Racks.
You can configure instance shutdown behaviour, enable cloudwatch monitoring, tenancy (shared hardware resources or dedicated hardware for your instance) etc.
In Userdata option, you can execute commands or install packages while instance creation. Now click on Next: Add storage.
Add Storage
In this section, you can specify resize root volume and change volume type and you can enable encryption. If required you can add additional volumes. Next click on Next: Add Tags.
Add Tags
You can specify the tags ie. name of the launched instances to create standard inventory so that anybody can distinguish instance type.
Here we specified the name of our instance. Next click on Next: Configure Security Group.
Configure Security Group
This is like firewall in AWS. To access you EC2 instance and it’s services, you have to open those services or ports in Security Group. You can maintain a single security group and attach it every newly launched EC2 instance. Here we will create new security group and will open ssh port 22. By default. SSH port 22 opened for Linux instance and RDP port 3389 for windows instances. Next click on Next: Review and Launch.
Review Instance Launch
Here, you can review all the settings you specified in each section. Once you are done, you can click on Launch.
Generate private Key Pair
Next, you have to either create a new key pair or use existing key pair. You have to download a private key in a safe location in your local machine and AWS stores public key. This key pair is required to connect to your launched instance. After downloading newly created key in your local computer, you will be able to launch EC2 instance. Next click on Launch Instance.
EC2 Instance Launch Status
After clicking on Launch Instance, you will get following screen:
You can see the newly launched EC2 instance in EC2 console as follows. Here status check is initializing and takes approx 2-3 minutes to get it done.
Here instance has passed both System Status Check and Instance Status Check.
Finally, your EC2 instance has been launched and you can connect it either using putty or git bash via ssh protocol. Private key is must while connecting EC2 instance.
Conclusion
Hence you have successfully launched EC2 instance using AWS web console. I hope you enjoyed this tutorial. Stay tuned for more on Cloud Computing, DevOps, Linux etc. Thanks!!
Read Also : How to Resize Attached EBS Volumes of Linux Instance without downtime on AWS