$ https://console.aws.amazon.com.
// log into your AWS
management console
I'm using MFA
to secure my root account access coupled with Google Authenticator
on my Android
smartphone.
You can bypass this step and login normally.
🔴 See output

Go to Services > EC2
- In
Create Instance
section, click on Launch Instance
🔴 See output

-
Select Amazon Linux 2 AMI (HVM), SSD Volume Type
-
Instance type: choose t2.micro (Free tier eligible). Instance comes with 1vCPU and 1 GiB (memory).
-
Click on "Next: Configure instance details"
-
Configure instance details : leave all fields as they're by default, just Enable termination protection.
🔴 See output

Next : Add Storage
Leave default configuration.
Next: Add Tags
You can leave tags blanks, here I'm using some tags for my own needs.
🔴 See output

Next : Configure Security Group
Click on "Add rule" to allow Port 80
on Http.
Ignore the warning and click on "Review and Launch" then "Launch".
🔴 See output

-
Now you are about to create a key pair to securely SSH
into your instance. Select Create a new key pair
, name it as you want then Download Key Pair
. This should download a .pem file. Mine is MYKP1.pem.
-
Create a new folder named "SSH" on your "Desktop", then move the .pem file to the newly created folder.
-
Change the permissions to .pem file, ie: $ chmod 400 MYKP1.pem
.
-
Connect to your EC2
instance using your IPv4 Public IP Address
:
$ ssh ec2-user@myipv4.public.address -i MYKP1.pem
- Then type "yes" when prompted by the
CLI
.
Now, you should be connected to your EC2
instance through SSH
.
🔴 See output

- If connection failed, you are probably blocked by a proxy (you are trying to connect from a Public Libraby for example) not allowing your device using
Port 22
, which is the default port used by the SSH
.
- Now we are going to use another method if you want to connect to your
EC2
instance, if you can't / do not want to use your CLI
. We are going to use Secure Shell App
extension in our Chrome
browser.
Search for "Secure Shell App" in your Search Engine and Download it as below :
🔴 See output

- Once installed, you should see this. Then click on "Secure Shell App" icon.
🔴 See output

- If everything goes well, enter the following information into your
Secure Shall App
as follows : your username (ec2-user) and your hostname (provided by your EC2 instance).
Go in the SSH
folder where you stored the .pem file from your CLI
and generate a public key from the .pem using $ ssh-keygen -y -f MYKP1.pem > MYKP1.pub
.
- Now you should have 2 files,
MYKP1.pem
and MYKP1.pub
. Duplicate MYKP1.pem
file and rename the new file to MYKP1
(just remove .pem extension). In the Identity section
of the prompt, upload both the MYKP1.pem
and MYKP1
file .
🔴 See output

- There you go, if everything went fine you should be prompted by the
Secure Shell App
, type "yes" and you should see the same display as you would normally see in your CLI
.
🔴 See output

-
Let's get back to your installation using your CLI
. The following steps are not performed in Secure Shell App
, but you can perform them there.
-
Elevate your privileges to root using $ sudo su
and perform $ yum update -y
to update your CLI
with the latest available packages.
-
Install Apache HTTP Server
from your CLI
. This will basically turn your EC2
instance to a web server, use $ cd /var/www/html
to make your web server's files accessible by Port 80
.
-
Let's create a sample index.html
file using $ nano index.html
🔴 See output

- To start the
httpd
service, use $ service httpd start
.
🔴 See output

- There you go, type your
IPv4 public address
in your browser and you should see your Web Server
online.
🔴 See output
