In this article, we will see create a web server inside the public subnet ““192.168.1.0/24 – ap-south-1a (subnet-1)
Please check the below link for part-1
Create an Web Server
Go to services and click on EC2 under the compute module to open.
We can see EC2 Dashboard.
There are two security groups available by default
click on Launch Instance.
Choose an Amazon Machine Image (AMI)
Select the Operating system of the EC2 instance by choosing any of the Amazon Machine Images (AMI). Select the Microsoft Amazon Linux AMI.
Choose an Instance type
Choose the Type of instance depending on your requirements.
Instance types comprise of varying combinations of CPU, memory, storage, and networking capacity.
select the default option of t2. micro – this instance type is covered within the free tier. Then click on Configure Instance Details.
Configure Instance Details
Configure EC2 instance details as per requirements of your environment.
Choose your VPC network.
Choose subnet 1 “192.168.2.0/24 – ap-south-1a (subnet-1)”
Choose required instances to create web server and auto-assign public IP should be enable for public subnet.
Go to Advanced Details and add required commands in user data and click on Add Storage.
The commands are
yum update -y
yum install httpd -y
echo “ktexperts is a knowledge sharing platform” > index.html
service httpd start
chkconfig httpd on
Here, we can see root volume by default and size of 8GB
Add a new volume if required
Click on Add Tags.
Tags assist in easier identification and classification of the various instances in your AWS environment.
Click on click to add a Name tag to provide name for our server.
Provide the name for the Linux virtual machine for easier understanding and click on Configure Security Groups.
Configure Security Group
A security group allows configuring firewall rules to allow traffic as needed. Only one rule has been added to allow remote connection.
SSH Is enough to connect to our Linux virtual server and click on Review and Launch.
SSH – Secure Shell
Provide security group name “WS-SG” and give description with same name
We need choose SSH port open to My IP then click on Add Rule.
Add HTTP Port and open to anywhere(all) and click on Review and Launch.
SSH – My IP means I can only go inside the web server.
HTTP – Anywhere means anyone can access my webserver.
Review Instance Launch
Review and confirm the configuration of the instance. Click on the Edit button on each configuration item to make changes and click on Launch.
Create a Key Pair and Launch Your Instance
To connect to your virtual machine, you need a key pair. A key pair is used to log into your instance and Choose create a new key pair
Create a new key pair and name it My Linux. Then click Download Key Pair.
After you have downloaded and saved your key pair, click on Launch Instance to start your Windows Server instance.
My Linux.pem will be downloaded to your computer — make sure to save this key pair in a safe location on your computer.
click on View Instances to view the instance you have just created and see its status.
Web server has been created
Copy the IPV4 public IP to find web server is showing the content.
Search IPV4 public IP in browser we can be able to see the content.
The internet is coming from Internet Gateway to the public subnet through Route Table properly.
In Next article, we will see create database server inside the private subnet.
Thank you for giving your valuable time to read the above information. Please click here to subscribe for further updates
KTEXPERTS is always active on below social media platforms.
Facebook : https://www.facebook.com/ktexperts/
LinkedIn : https://www.linkedin.com/company/ktexperts/
Twitter : https://twitter.com/ktexpertsadmin
YouTube : https://www.youtube.com/c/ktexperts
Instagram : https://www.instagram.com/knowledgesharingplatform