In this guide, we’ll walk through the steps to set up a Deploying a one tier application on AWS . This involves creating a VPC, subnets, security groups, EC2 instance.
Go to the AWS Management Console and navigate to the EC2 service.
click on create VPC
give the vpc name and give CID range
here we can see our VPC
now we need create a internet gateway.
click on create internet gateway
give it a name
here we can see our internet gateway, now we need to attach it in to our VPC , click on attach VPC
select our VPC
now go to subnets.
click on create subnet
select our VPC
give subnet name and range
create another one
here we can see our subnet
now go to EC2 service
go to instance and click on create instance.
give the instance name and select the os type
here click on the create key pair
give the key pair name.
In network setting give our VPC
click on lanch instance.
here we can see our instance is running.
selct our instance and give connect.
select the connection type and give connect
here we have the connection
install httpd service
yum install httpd -y
here im copying my code in my repo , if you need you can also get it from my repo or you can use your code.
how go to html in var
cd /car/www/html/
now git clone the code or wget
git clone yourgiturl.git
wget yourgiturl.git
now move all the files in the code in the html dir
cd yourgitcodedir
now move the code to html dir
mv * /var/www/html/
now we need to start and enable the httpd service
systemctl start httpd
systemctl enable httpd
systemctl status httpd
here we can see our server is running
now select our instance and go security
click on the security group
here edit the inbound rules
click on add rules
now add the following rules
- http-80-anywhere
- https-80-anywhere
- ssh-20/1-anywhere
now go to the instances and copy the instances DNS link
search the DNS URL in web
here we can see our app is running fine.