Launch, and Connect to the AWS EC2 Instance
What is Elastic Compute Cloud EC2 Instance
EC2 is a virtual server in the AWS cloud, running a specific operating system. It can host applications or databases.
In this blog, we will see step-by-step, how to launch an EC2 instance in AWS Cloud.
first thing first, we will need an AWS account to login to the AWS console that will give us access to different AWS resources that AWS offer. if you don’t have an AWS account you can create one by going to this link AWS sign-up page, you will have one year of using some AWS services that are included in the AWS 12-month free pricing.
Once you created your account Login to AWS Console and Create your first Instance.
let’s be familiar with the basics on the AWS Console screen by using those numbers on the image above.
on 1 this is a search bar that will allow AWS users to search for any resource that they want to use in the AWS console.
on 2 this will show you which AWS region you are using, and you have the ability to change it to whichever region is closer to you, on this blog I will be using the N Virginia Region*.*
on 3 this widget shows the most recently visited resource you have used on your AWS account.
Now that we are familiar with the AWS console let’s create an instance.
On the Search bar Search EC2 and click on EC2 the first link shows up.
Click on Instances and click Launch Instances on the top right corner
On the next screen, on the name choose the name of your EC2 instance, under Name and Tags*,*
Under Application and OS Images*(Amazon Machine Image) choose Ubuntu, and make sure that you choose Free tier Eligible under **Amazon Machine Image*
Under Instance Type*, choose t2.micro*
Under Key Pair*, select **Create New Key Pair, on the next screen choose your desired key pair name, key pair type choose RSA, and the file format choose .pem, then click on Create key pair button,** and the file will be downloaded into your computer local storage. this file will be used to ssh into your EC2 instance from your local terminal.*
Under the Network setting*, click on Edit to create security group that will your EC2 instance accessible over the Internet.*
Under network setting new fields will be displayed, under security group name choose your security group name, under the description, write any description you want.
Under inbound security group rules, choose the port you want to open on your EC2 instance, we are going to allow HTTP and SSH. ssh is already auto-filled, scroll down and click add the security group to add HTTP as shown on the image below
Under Configure Storage and Advanced details sections leave them as default. and click on Create
Connecting to EC2 Instance
Now that we have created our EC2 instance, let’s connect to it and install the apache2 web server.
Under instances, you should see the name of the EC2 instance you created, click on the checkbox next to your Instance name, and click on connect at the top right corner to connect to your EC2 instance terminal.
on the next window opened make sure that EC2 instance Connect is selected, scroll down, and click the connect button. when the terminal opens paste in this command to install apache2 and start the apache2 service.
and Run the following command to install Apache server
sudo apt install apache2 Sudo service apache2 start
Once the Apache server is installed on your EC2 instance, you can now access the public IP address of your EC2 instance and access it over the internet.
Conclusion
In this step-by-step guide, we learned how to create an Instance, connect to an instance terminal, and install Apache Server, and we were able to access the public IP address over the internet.
Subscribe to my newsletter
Read articles from Taufique iradukunda directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Taufique iradukunda
Taufique iradukunda
IT Support Technician with 4 years of experience in the IT field as an IT Support Technician, DevOps, and Software Developer. Currently, I am specializing in Cloud and DevOps technologies, by working on projects based on real-world scenarios, with a focus on services and technologies from AWS, Microsoft Azure, Google Cloud, and Oracle Cloud, intending to help companies migrate from On-Premises Environment to the Cloud.