In the public cloud sharing ecosystem, AWS is a dominant cloud platform service that provides businesses with scalable, reliable, and low-cost infrastructure. With a diverse suite of services offered in the AWS environment, one of the most common services is Amazon EC2 (Elastic Compute).
Amazon EC2 specializes in providing scalable solutions cloud computing capacity in the AWS cloud server. With the help of Amazon EC2, you can develop and launch applications faster, without spending extra pennies on initial hardware. You can deploy virtual serversmanage cookies from immersive dashboards and configure various security and networking protocols under one roof.
If you’ve decided to start your first AWS EC2, here’s a quick tutorial that shows you how to deploy an AWS EC2 instance from AWS New Console and SSH into it to install Apache 2.
But first, let’s take a quick look at what we’re dealing with;
What is an Amazon EC2 instance?
An Amazon EC2 instance acts as a virtual server in Amazon’s Elastic Compute Cloud (EC2) to run applications on Amazon Web Services (AWS) infrastructure. EC2 makes development easier for developers by simplifying the scaling process and providing resizable compute capacity.
How do I launch the AWS EC2 instance from the AWS console?
To create EC2, you must have an AWS account, otherwise you can create an account at AWS at present.
1. Log into your AWS account and open EC2-Dashboard
To note: Make sure you select the AWS Region in which you want to launch the instance, for me it is (N. Virginia) us-east-1.
Now when you are in the EC2 dashboard you see there are 0 instances running, to create a new instance click on “Launch Instance”
2. Type the name of your desired instance
3. Choose AMI
Here you see multiple AMI options for selection. AMI stands for Amazon Machine Image which is basically the software and operating system you want to run on the server, in my case I chose Ubuntu 20.04.
4. Select the instance type
Here you can select the type of machine, the number of vCPUs and the memory you want to have. Select the option eligible for the free offer and go to the next step (create a new key pair)
5. Create a new key pair
This pair of keys will allow you to access in SSH to the machine you have just created. Create the key pair and download it, be sure to keep it in a safe place because you won’t be able to download it again.
6. Configure network settings
Here you modify the vpc, subnet and security group and other configurations. I will leave this as default.
To note: Select Allow HTTP traffic from internet option to allow port 80.
7. Configure storage
Select the amount of storage you want for your instance. For the free tier, you can choose up to 30 GB of EBS. I’m going to leave that as default and click “Launch Instance”
8. Access your instance
First, select the instance and then click the connect button.
Select the SSH client
Then open your terminal and use the command below to access the server.
- chmod 400 pem filename
- ssh -i “pem file path” [email protected]
9. Install Apache
You can now install Apache, so run the command below
- sudo apt update
- sudo apt install apache2
To start the service and make sure it stays enabled, run the commands below
- sudo systemctl start apache2
- sudo systemctl enable apache2
Now tap on the browser with your instance’s public IP address and you will see the Apache page by default, which means Apache is installed successfully.
Now that you’ve familiarized yourself with AWS EC2 and how to launch it successfully, it’s finally time to run it and see the changes. Although this tutorial seems simple, before launching a production environment, try to answer the following questions;
- Which instance type best suits my needs?
- Will I be able to remotely manage a fleet of EC2 instances in my hybrid environment?
- Which purchase options should I turn to?
When you have answers to these questions, it will be clear how you are going to run the instance correctly. I hope this tutorial helped you. For better technical advice, you can contact a reliable cloud professional services company like Appinventiv that supports your product at every stage of development. Consult the experts to start.