Secure AWS EC2 instance

What you will learn here about AWS EC2 instance

  • Secure AWS EC2 instance

Here we will see how to Secure AWS EC2 instance using free SSL certificate

Secure AWS EC2 instance

Please follow the following steps to know how to Secure AWS EC2 instance using free SSL certificate.

1)First you need a EC2 instance. If you don’t have EC2 instance then please visit the following link

AWS create ec2 instance

2)Assuming you have created EC2 instance and you know the public IP address  of your EC2 instance

3)Now please add A record in your DNS management (please add A record in your domain name service provider) below I have added A record in my GoDaddy DNS management which is shown below.

Record Type – A record

Host – my subdomain name

Points to – Public IP address of EC2 instance

4)It takes maximum half an hour to map your IP address to your domain name

5)Now please access your VM instance using SSH with putty. If you do not know how to access EC2 instance using putty then please visit the follow link.

How to access EC2 instance using puTTY

6)Now please execute the following command to go in super user mode

sudo su
cd ../..

7)Now please execute the following command to update existing packages

sudo apt-get update

8)Now Please execute the following command to install Application server for testing purpose

sudo apt-get install apache2

9)Now open port 80 from your EC2 instance security group. If you don not know how to open port from EC2 instance security instance then please visit the following link.

How to open port on aws ec2 instance

10)Now please go to browser and enter your domain name and hit enter. Once you hit enter you will see following kind of output in the browser.
Please keep in mind now your url is loaded with not secure connection which is shown below

11)Please execute the following command to update the existing packages

sudo apt-get update

12)Please execute the following command

sudo apt-get install software-properties-common

13)Please execute the following command

sudo add-apt-repository universe

14)Please execute the following command and please hit enter

sudo add-apt-repository ppa:certbot/certbot

Secure AWS EC2 instance

15)Please execute the following command

sudo apt-get update

16)Please execute the following command to install the cerbot

sudo apt-get install certbot python3-certbot-apache


17-a)Please execute the following command which will redirect http to https.

 sudo certbot --apache

Please enter Email address which is shown below

17-b)Type A hit enter which is shown below

17-c)Please enter n and hit enter

17-d)Enter your domain name and hit enter which is shown below

17-e)Please enter 2 and hit enter

18)Now please open port 443 from the EC2 instance security group

19)Now please refresh the URL in the browser and you will see secure connection in browser which is shown below

You may also like...

Leave a Reply