0% found this document useful (0 votes)
17 views3 pages

EC2 Windows Lab

Uploaded by

studdandy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views3 pages

EC2 Windows Lab

Uploaded by

studdandy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

In this demo we are going to launch a Windows Instance, connect to it using RDP and modify the

contents of sample default web page for Windows IIS.


• Task 1: Launch an Amazon EC2 instance
1. Go to AWS Management Console -> Services -> EC2
2. Click on Launch Instance
3. You will be asked to select Amazon Machine Image(AMI)
4. Select Windows Server 2016 Base
5. Select instance type t2.micro
6. Click next configure instance details
7. Keep everything default direct go to Advanced Details
In the text box, add the user data given below
[User data specifies the script that will be launched at the boot of the instance. It is used for
automating tasks. We have used user data this time to show launching the instance with
IIS(Internet Information Services). The same can be performed manually after launching the
instance. This is a PowerShell script to install the default web server IIS for WIndows]
<powershell>
Install-WindowsFeature Web-Server -IncludeManagementTools -IncludeAllSubFeature
</powershell>
8. Click next add storage default general purpose
9. Click next add tags
10. In tags click on add tag
• Key: Name
• Value: Web Server
11. Click next Configure security group
12. Click on create a new security group
• Security Group name: Web and RDP
• Description: Permit Web to Remote Desktop Access
13. You will have RDP as a default rule
14. Now Add Rule
• 1st Rule
• Type: HTTP
• Source: Anywhere
• 2nd Rule
• Type: HTTPs
• Source: Anywhere
15. Now check that you have 3 rules RDP,HTTP,HTTPs
16. Click on review and launch
17. In the key pair dialog box select on Create a new key pair, download the key pair, select the
acknowledgement box, then click launch instances.
18. Now you will get the instance ready scroll down click on view instance
• Task 2: Obtain Windows Password
When Amazon EC2 launches a new windows instance, it generates a random Administrator
password. This prevents other people from having access to your instance.
In this task you download the private key and use it to decrypt the password so that you can login to
the window instance.
19. Return to Amazon EC2 Management Console
20. When the instance is ready click on connect
21. In the connect to your instance dialog box click on Get Password
22. In that you will have to insert the PEM key that you downloaded earlier
23. Then click on decrypt password
• Task 3: Login to your EC2 Instance
25. Now again the same dialog box will appear with the password copy the password
26. In the dialog box click on desktop remote access and open the file to start Remote Desktop
If you receive yellow warning message click connect
27. Paste the password and click OK
If you receive yellow warning message click Yes
You should now be connected to your Amazon EC2 instance
• Task 4: Configure the Windows Instance
You are now connected to your Amazon EC2 Windows instance
As a result of the user Data script you used when launching the instance, IIS is already running on the
computer. In this task you will configure IIS.
The following instruction should be performed on the EC2 instance via your remote desktop
connection.
28. Launch Server Manager by clicking the windows icon and typing server manager
29. In server manager click on IIS in the left navigation panel.
30. Right click on the server that appears then select Internet Information Services (IIS)
Manger.
Browse the default website
You will now explore the web server configuration
31. Click the arrow beside the server name in the left column to expand it
32. Click the arrow beside sites to expand it
33. Right click on Default web site.
34. Select Manage website then select browse
A browser window will open, displaying the default home page.(It might launch behind the IIS
window so bring it to the front) This confirms that IIS is functioning properly.
This web page is also accessible via the Internet. To test this you will now access the web page from
your own computer.
35. Return to Amazon EC2 Management Console in your web browser.
36. Copy the Public DNS (IPv4) name of the web server to your clipboard.
37. Open a new tab in your web browser, paste the URL hit enter.
The web page should also be displayed in your web browser. This shows that you have created a
web server that is accessible from the internet.
Accessing Metadata
Additional information is provided to Amazon Ec2 instances so applications can discover information
about their environment. This is known as Metadata and it can be accessed only from the EC2
Instance itself.
38. Return to your Remote Desktop session.
39. Minimize the web browser and return to the Internet Information Services (IIS) Manager
window that is showing the default web site home
40. In the left navigation pane, right click default web site and select explore
This will open a file explorer window showing the wwwroot directory that has your web server files.
You will now edit the contents of the default iistart.htm page
41. In the file explorer, right click on iistart with the blue/white Internet explorer icon and a type
of HTML Document.
42. Click open with then select notepad.
This will display the contents of the default Home page for the web server. You will now replace the
contents with modified HTML.
43. Erase the contents of the file and paste code shown below:
<html>
<body>
<h2>EC2 Instance Metadata</h2>
<a href="http://169.254.169.254/latest/meta-data/">InstanceMetadata</a>
<BR/>
<a href="http://169.254.169.254/latest/meta-data/hostname">Instance Hostname</a>
<BR/>
<a href="http://169.254.169.254/latest/meta-data/public-ipv4">Instance Public IP Address</a>
<BR/>
<a href="http://169.254.169.254/latest/meta-data/placement/availability-zone">Instance
Availability Zone</a>
<BR/>
<a href="http://169.254.169.254/latest/user-data">Instance User Data</a> </body>
</html>
44. Save and close the text file.
45. In Internet explorer (in your remote desktop session) reload the default home page by
clicking the refresh icon.
46. Click the links to view Instance Metadata about the instance and the user data that was
passed during the launch:
• Instance Metadata displays all the metadata available.
• Instance Hostname shows the name of your EC2 instance.
• Instance Public IP Address shows the IP address assigned to the instance.
• Instance Availability Zone shows the data centre where your instance is running.
• User Data shows the script that was passed to your instance and was run when the instance
started.

You might also like