Subscribe to Our Weekly Newsletter
Connecting to Your Amazon EC2 Instance
Connecting to Your Amazon EC2 Instance
The first step towards connecting a Windows instance is to retrieve the initial administrator password, and use it with Remote Desktop. To do this, you will need contents of the private key file that you created previously in the Creating a Key Pair section (For ex: mykeypair.pem).
Note: It may take up to 30 minutes to get the original password from the moment you launched your Amazon EC2 instance.
1) Firstly, you need to connect to your Windows instance. To do so:
- Retrieve the auto-generated administrator password:
- Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
- Locate the instance on the “Instances” page.
- Right-click on the instance and select “Get Windows Password”.
The “Retrieve Default Windows Administrator Password” dialog box appears (it can take a few minutes before the password is available).
You need to click on the “Browse” button to locate your private key file.
- Click on the “Decrypt Password” button. Upon doing so, the console will return the default administrator password for the instance.
- Now you should save the password. You need it to successfully connect to the instance.
Note: This step will only work for a new Amazon EC2 instance. Once you have changed the administrator password, or created a custom AMI, you will need to remember the password.
2) The next step is to connect to the instance using Remote Desktop:
- Start the Remote Desktop application (from the Start menu, select All Programs, then select Accessories, and finally click on “Remote Desktop Connection”).
-
- Note: Most modern Windows OS (from Windows XP onwards) already include the Remote Desktop application. However, if you’re using an older version of Windows, you can download the application from the Microsoft website.
- Select “Options”, and make sure that a domain is not specified.
- Enter the public DNS name of the instance, and click on the “Connect” button.
- Log-in using “Administrator” (without the quotes) as the username, and input the administrator password you that you have just received.
Note: You also have the option to copy and paste the password (using Ctrl+C and Ctrl+V).
You have now successfully connected to your instance, and can work with it in the same way you would work with any other Windows server.
Caution: It is recommended that you change the Windows administrator password from the default value once you’ve connected to any new Windows instance that has just been launched.
Also, you should start by ensuring that you can connect to the server with Internet Information Services (IIS) Manager.
Here’s how to connect to the server with IIS Manager:
- From your Amazon EC2 instance, click “Start”.
- Click “Administrative Tools”.
- Click “Internet Information Services (IIS) Manager”.
- Expand the “localhost” node.
- Expand the “Sites” node.
- Right-click on “Default Web Site”.
- Select “Manage Web Site” and click “Start”.
- Finally, paste the public DNS address of your load balancer into your browser, to ascertain that you can connect to the site.
Now that we have ensured that the server is working properly, we can move on to the next step, of deploying a sample application to our Amazon EC2 instance.
Deploying a Sample Application
In this section, we will download a sample ASP.NET application, grant write access to the appropriate folders and files, and also configure IIS so that it points to the new application on our Amazon EC2 instance.
Here’s the procedure through which you can download the sample application:
1) Create a folder called ImageGallery on your root directory (c:\ImageGallery). This will serve as a folder for the sample application.
2) Add the website location for the BaseImageGallery application to the trusted sites list on your Amazon EC2 instance:
- Run Internet Explorer from the Start menu in the Amazon EC2 instance.
- Click on the gear icon (on the top right corner).
- Click on “Internet Options”.
- Click on the “Security tab”.
- Click on “Trusted Sites”, and then click “Sites”.
- Add https://s3.amazonaws.com, and click “Close”.
- Click on the “Advanced” tab.
- Scroll down to the “Security” section.
- Un-check “Do not save encrypted pages to disk”, and click “OK”.
3) Now, we are going to download the application:
- Using Internet Explorer from your Amazon EC2 instance, type https://s3.amazonaws.com/aws-sdk-samples/.NET/BaseImageGallery.zip (without quotes) on your browser.
Note: This URL is case-sensitive, and the zip file is a .NET application.
- Once the “File Download” dialog box appears, click “Save”. You need to save the file to c:\ImageGallery.
Note: If you are receiving an error stating that Internet Explorer is unable to download the file, close the error dialog, and try downloading the application again in the same browser window.
- Now, you are required to paste the contents of the ImageGallery folder (which is found inside the zip file) into C:/ImageGallery, so that the individual files sit directly under it.
Here’s the procedure to modify the physical path of your default website:
- Open IIS Manager on your Amazon EC2 instance, and navigate to the Default Website once again.
- Right-click on “Default Web Site”.
- Select “Manage Web Site”, and click on “Advanced Settings”.
- In the “Physical Path” box, type “c:\ImageGallery” (without the quotes), and then click “OK”.