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.

  1. 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.

  2. 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*.*

  3. 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.

  1. On the Search bar Search EC2 and click on EC2 the first link shows up.

  2. Click on Instances and click Launch Instances on the top right corner

  1. On the next screen, on the name choose the name of your EC2 instance, under Name and Tags*,*

  2. Under Application and OS Images*(Amazon Machine Image) choose Ubuntu, and make sure that you choose Free tier Eligible under **Amazon Machine Image*

  3. Under Instance Type*, choose t2.micro*

  4. 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.*

  5. Under the Network setting*, click on Edit to create security group that will your EC2 instance accessible over the Internet.*

  6. 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.

  7. 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

  8. 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.

  1. 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.

  2. 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
    
  3. 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.

0
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.