Hosting static website on Amazon Web service Free tier – My experience

Hosting static website on Amazon Web service – My Experience

Step- 1

  • First create account on amazon web service with valid credit card.
  • Select Free tier EC2 AWS service
  • Create instance –  Make sure select t2.nano linux free tier instance . Examble- Amazon Linux AMI 2018.03.0 (HVM), SSD Volume Type – ami-cfe4b2b0
  • Create security group with allow http,https and ssh
  • Create key pairs and download  – This key pair used to connect terminal ssh and SCP.
  • After complete the instance installation process status bar become green.

Step – 2

  • Download Putty and puttygen software from https://www.putty.org/
  • Use puttygen software used make private key file.pem to file.ppk
  • To connect aws  linux instance on putty tool- Open putty tool – connection type ssh – port 22 – host name ec2-user@public_dns_name –  category connection , ssh and Auth – browse key pair .ppk file – then connect
  • # sudo su –
  • #yum install httpd  ( Webserver installation)
  • #service httpd start ( starting service)
  • #chkconfig httpd on
  • service httpd status
  • #cd /var/www/html/
  • #wget https://s3-ap-……..file.zip ( download static website file from cloud)
  • #unzip file.zip
  • #mv file.zip/*. ( move file to root directory)
  • Finished file transfer
  • Adding Permission for EC2-user to edit and delete Coding below
  • #[ec2-user ~]$ sudo chown -R ec2-user:apache /var/www
  • [ec2-user ~]$ sudo chmod 2775 /var/www
    [ec2-user ~]$ find /var/www -type d -exec sudo chmod 2775 {} \;

Step – 3

  • Open AWS EC2 dashboard – select current running instance – note on Public ipv4 address
  • Put this ip address on Domain provider and map with domain name.