DEV Community

Cover image for How to host a website on an ec2 server
Frank Promise Edah
Frank Promise Edah

Posted on

How to host a website on an ec2 server

Image description**STEP 1:
Create an s3 bucket and upload the zip folder or file containing the index.html. Note that all objects in an s3 bucket are private by default. Hence, it is important to make the file publicly accessible using the the bucket ACL.
Two choice is available: Either create the bucket policy manually or use the AWS policy generator.

**STEP 2:
Launch an ec2 instance allowing internet access over port 80. SSH into the instance using PUTTY( for windows user). copy the ipv4 address of the instance and under the part labelled 'session' on PUTTY, insert 'ec2-user@theipyoucopied'.

**STEP 3:
Install Apache by typing in 'yum install httpd -y' in the command line. change directory to the \var\www\html, the copy website on the s3 bucket into the ec2 instance. To do that, type in the command line 'wget 'add the object url'. Move the file to the var html directory.

**STEP 4:
start http using the command 'service httpd start'.

yehhhh!!!! website hosting successful!!
Image description

Top comments (0)