#5 How to Host Website on Windows EC2 Instance
First, we will create an EC2 instance, select Windows image, and select AMI as Windows Server 2016(or any free tier windows image)
Ensure your Inbound Security Group Rules: are set for RDP with port # 3389
and out bond rule to HTTP with port # 80
Now connect the EC2 instance and note down the user ID and password
Click on connect instance and click on RDP client
Scroll down to get the user name and to generate a password click on get password
upload yours.pem file and click on decrypt password
Now your password is ready, make a note of your username and password
Let's begin launching the Windows server from your host computer
on the host computer search for the Remote desktop connection app
Now copy the public IP of the instance and paste it into the remote connection as in the computer name box and click on connect
And now enter the username and password that we saved earlier
now your Windows server is launched
now on the Windows search bar type: server manager and open the server manager, we are going on install the Windows IIS server
now on the dashboard click on add roles and features
Click next until you reach the server role and select Webserver (IIS)
All required components will be auto-selected keep pressing next until you get the install option and install the IIS web server
Now once IIS is installed on the dashboard go to tools and select
Internet information service(IIS) manager
when you open the IIS manager you will see a default website already available, right click on the default website and click on explore to check the content of the default website
You will see a default HTML page iisstart this is a default webpage that you can use to check if your website is successfully hosted on IIS and if your IIS is running
To check if your IIS role is successfully working, go back to EC2 instance get the IP address, and post the IP in the address bar of the browser you will see that the default website is loaded which confirms my IIS is successfully working
Now all set let's start deploying a website
for practice purposes let's download a sample website from the internet
I will go to any website and download a sample website
Now we have the sample website downloaded and extracted
We will copy all the files that are in the folder
now go back to the IIS manager on the remote server
under the default website which was already created Delete all the files you see inside the default website and paste the files you have copied
Now that we have all the files copied
When you observe the link the website you pasted is under the wwwroot
C:\inetpub\wwwroot
Now go back to the website and refresh it
Now you have successfully hosted your website
Here's a rephrased summary of what was learned today:
Setting up an EC2 instance.
Installing Windows Server.
Connecting to the Windows Server using Remote Desktop Connection.
Installing the Web Server (IIS) on the remote Windows Server.
Accessing the Internet Information Services (IIS) Manager and hosting a website on the IIS server.
Subscribe to my newsletter
Read articles from Namdev Pratap directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Namdev Pratap
Namdev Pratap
Come along with me on a public learning journey into AWS Cloud and DevOps, designed specifically for those without a technical background. I'll be documenting each step in straightforward, easy-to-understand language to help others make a smooth transition into DevOps. Together, we'll delve into continuous integration, deployment, and automation, breaking down complex concepts into manageable, actionable insights.