| by Arround The Web | No comments

How to Deploy to AWS

It can be very difficult to manually login to your server and type the scripts yourself. Many things can go wrong and it becomes a complex process but using AWS you can deploy a single web page or a complete project to Amazon Web Service (AWS) using the EC2 service console. AWS makes this process simple and easy and this post will discuss the process of deploying to AWS.

Let’s start with the process of how to deploy to AWS:

Deploy to AWS

To deploy to AWS, simply create an EC2 instance by clicking on the “Launch Instances” button from the EC2 dashboard:

Type the name for the instance and select the machine image from the Application and OS image section:

Simply scroll down the page and select the instance type and then select the key pair or create a new one by clicking on the “Create new key pair” link. Once the instance configurations are complete click on the “Launch Instance” button to create an EC2 instance:

It will take a few moments to launch the instance and you have to select your instance from the instance list and click on the “Connect” button:

Select the “SSH client” tab and copy the command mentioned in the screenshot below:

Simply paste the command on the command prompt or PowerShell and change the path of the key pair from your PC:

Once you are connected to the instance simply use the following command to install the Apache server:

yum install httpd -y

This command will install the Apache server on your virtual machine:

After the installation, you need to activate the apache server by using the following commands:

systemctl start httpd

systemctl enable httpd

These commands will start the services of the Apache server:

Now you can create a new file to deploy on AWS by using the following command:

nano index.html

This command will open a new file for you to write a code in it but we have used the following code:

<html><body><h1> Hello World </h1></body></html>

then press “ctrl+x” and “y” to exit and save the file:

Your file has been deployed on AWS you simply need to copy the “Public IP Address” of the EC2 instance and paste it on any web browser:

You can see your code has been deployed using the IP address of the EC2 instance:

You have successfully deployed to AWS:

Conclusion

To deploy to AWS, you need to create an EC2 instance and then connect to your virtual machine using the SSH client. Once you are connected to your virtual machine simply use a couple of commands to install and activate the Apache server and then you can deploy your code on that server using a simple command. After deploying the code, you can visit the page using the Public IP Address of the EC2 virtual machine.

Share Button

Source: linuxhint.com

Leave a Reply