Wondering how to host website on EC2 Windows instance using IIS? We can help you.
At Bobcares, we often get requests to restore the site as a part of our Server Management Services.
Today, let’s see how our Support Engineers host website on EC2.
How to host website on EC2 Windows instance using IIS?
Today, let us see the steps followed by our Support Techs to host website on EC2.
Open the required ports and configure IIS
- Firstly, connect to your EC2 Windows Server instance using RDP.
- Ensure that the instance has the required ports open, and that IIS is installed and configured on the instance.
- Open the EC2 console, select your instance, choose the Description tab, and note the Public IP address.
Configure your website and confirm that you can access it locally and externally
- Firstly, on your Windows Server instance, open IIS Manager.
- Expand Sites, choose Default Web Site, choose Explore, and then choose the website .html home page.
- Be sure that you can access the website locally.
- Type your Public IP address in a browser and confirm that you can access the website externally.
Access your website from a host name using a static public Elastic IP address
- Firstly, open the EC2 console and then choose Elastic IPs from the navigation pane.
- Choose Allocate new address, Allocate, and then choose Close.
- Open Actions, and then choose Associate Address.
- Open Instance, choose your Instance ID, and then choose Associate.
Assign the IP to your domain name in Route 53
- Firstly, open the Amazon Route 53 console and then choose Hosted zones from the navigation pane.
- Choose the Domain Name, and then choose Create Record Set, or edit one of the existing A records.
- In the Value field, type your Public IP address, and then choose Save Record Set.
How to host multiple public websites using IIS on the same EC2 Windows Server instance?
If you have more than one website, you can host them in IIS on the same EC2 Windows Server instance.
IIS differentiates between websites by using bindings, which are a combination of the protocol type, IP address, port, and hostname.
To avoid IP and port conflicts, you must add a hostname.
Follow below steps to configure the IIS server on your instance to host multiple websites:
- Firstly, make sure to install and configure IIS on the instance.
- Then, use the Amazon EC2 console to get the IP addresses of the EC2 Windows Server instance.
- Next, connect to the instance using Remote Desktop Protocol (RDP).
- Open IIS Manager, and in the Connections pane, choose the site that you want to add a host name to.
- In the Actions pane, choose Bindings, Edit, enter a name in the host name field, and then choose OK.
- Update the hosts file with the host name to access the website locally from the IIS server:
- Open a text editor using the Run as Administrator option, and then open the hosts file in the C:\Windows\System32\drivers\etc directory.
- Enter the Private IP address of the EC2 instance and the host name of your website, and then save the file.
- Repeat steps 4 through 6 for each additional website.
Now your websites can be accessed using the private IP address locally from the hosts file on the same EC2 Windows Server instance.
For public access, add the public IP address in your public hosted zone through your DNS host provider or with Amazon Route 53.
[Still, have any queries on Windows? – We can help you.]
In short, today we saw how our Support Techs host website on EC2 Windows instance using IIS.