DEV Community

Cover image for WEB DEPLOYMENT ON AMAZON EC2
Ovi Eryk
Ovi Eryk

Posted on

WEB DEPLOYMENT ON AMAZON EC2

PREREQUISITE
Before deploying a website on AWS, you must first have an AWS registered account, either as a Root User or as an IAM (Identity Access Management) User.
NOTE: All codes are only compatible to linux operating systems, these codes would not work on windows command prompts.

The following are steps you can take after launching an instance on AWS.

STEP 1: Highlight the instance and click the button connect, and it opens a new tab, on the new tab, you will see 'instance connect' option, scroll down and you will see connect. Then it takes you to a command page.

STEP 2: Note that you are connected as an EC2 user, to change that so you can have more control, you key in - sudo su

Image description

STEP 3: You update the server with the code: yum update -y

Image description

STEP 3: After updating, you install the Apache http server with the code: yum install httpd -y

Image description

STEP 4: You then need to create a temporary folder with the code: mkdir temp, and cd temp into it.
Image description

STEP 5: Now, you copy the link of the website you want to deploy and : wget + web link.

Image description

STEP 6: Next you ls into the folder to see the zip folder of the link, and then you unzip with: unzip + file name (the zipped file)

Image description

STEP 7: Do 'ls', then cd into it with: cd + new file. You can also ls to see list of files in the unzipped folder (optional).

Image description

STEP 8: Its now time to move all these files for deployment with: mv * /var/www/html. After that, you cd into it with: cd /var/www/html.

Image description

STEP 9: You are almost ready to deploy, you just need to enable it to work and you do that with: systemctl enable httpd.

Image description

STEP 10: The final step is to start and check the status of the site you are about to deploy. To start: systemctl start httpd
To check status: systemctl status httpd

Image description

YOU ARE READY TO GO!

CONCLUSION:
Voila! You have successfully deployed your website on Amazon EC2. Follow me for more posts like this.

Top comments (0)