In this step, we will download a sample ASP.NET application
and configure IIS to point to the new application
on your Amazon EC2 instance.
This sample application lets you upload and browse photos.
To download the sample application,
create a folder for your sample application.
We will create a folder called imagegallery on our C: drive.
Click on the Start menu.
Click Computer.
Double click the C: drive
Right click and click New Folder.
Type in imagegallery.
Next, we will need to add the website location
for the base image gallery location
to the trusted sites on our Amazon EC2 instance.
From the Amazon EC2 instance, run Internet Explorer from the Start menu.
Click on the gear icon in the top right corner.
Click Internet Options.
Click the Security tab.
Click Trusted Sites.
Click the Sites button.
Type in https://s3.amazonaws.com/.
Click Add.
Click Close.
On the Advanced tab, scroll down to Security.
Make sure that Do Not Save Encrypted Pages to Disk is unchecked.
Next, click OK.
Now, in your browser window, type the address for the sample application.
Type in https://s3.amazonaws.com/aws-sdk-samples/.NET/BaseImageGallery.zip.
Click OK.
Click Save As, and then save it to your imagegallery folder.
Click Open Folder.
Next, go ahead and extract all the files.
Right click on baseimagegallery.zip, and select Extract All.
Extract it to the default location.
Double click baseimagegallery.
Double click imagegallery, and copy all of the files
by selecting all and Ctrl+C to copy.
Now navigate back up to your image gallery on your C: drive,
open up the imagegallery folder, and paste all of the contents.
Next, we will modify the physical path for your default web site.
We will update the web config file to put in your AWS web controls.
Right click on the web config file.
Click Open.
You can simply update it in notepad if you wish.
Here where it says public key,
you will want to put your public key information.
For your secret key, you’ll put your secret key information.
To locate your public key and your secret key,
go back to your local computer.
Navigate to aws.amazon.com/account.
Select Security Credentials.
Log in with your account information.
Select Sign-in Using Our Secure Server.
Navigate to your access key ID.
Copy this information.
Go back to your Amazon EC2 instance,
and paste it into your public key information.
Go back to your web browser on your local machine,
click show under secret access key,
and then copy your secret access key.
Navigate back to your Amazon EC2 instance
and paste your secret key information in the file.
Save this file and close it.
Next, we will want to update our default.aspx.cs file
with our S3 information, our CloudFront information,
and our RDS information.
Right click on this file, click Open With,
and click Notepad.
Navigate down to your photogallery base url.
Here, you will want to replace this URL with your CloudFront distribution.
On your local computer, go to the AWS Management Console,
and click on the Amazon CloudFront tab.
Here you see your CloudFront distribution
and its status is set to DEPLOYED,
so you are now ready to use it.
Click on your CloudFront distribution and find the domain name.
Copy this domain information by highlighting it and selecting Ctrl+C.
Navigate back to your remote instance,
and paste that information in your photogallerybaseurl.
Navigate to your image bucket name, and replace
your non-dotted-bucket-name with your S3 bucket.
In this example, we used aws-webapp.
Navigate down to your database instance.
Here, we will replace your-database-instance
with your RDS endpoint.
To locate your RDS endpoint, go back to your local machine.
Go to the AWS Management Console, and select the Amazon RDS tab.
Click DB Instances in the Navigation pane in the US East region.
Click on your database instance.
Navigate down to where it says endpoint,
select your endpoint, and then copy it by selecting Ctrl+C.
Navigate back to your EC2 instance, and replace
your-database-instance with your new endpoint.
Next, you will want to put in your user id for your RDS database.
In this example, we used awsuser.
For password, we used mypassword.
For database name, we used mydatabase.
Save this file and close it.
Next we will want to point our default location
for our website to our image gallery.
Navigate to your IIS Manager Console.
Click on Start.
Click Administrative Tools.
Click Internet Information Services Manager.
Expand the Local Hosts node, and expand the Sites node.
Right click on Default Website.
Select Manage Website.
Select Advanced Settings.
Navigate to your Physical Path, and change out
the current settings to point to C:\imagegallery.
Click OK.
Next we will want to restart our IIS webapp.
Go over to Manage Server, and select Restart.
To test your sample app, navigate to your local machine.
Locate the DNS name for your Elastic Load Balancer.
To do this, go to the Amazon EC2 tab,
and in the US East region, select Load Balancers.
Select the load balancer you created,
highlight the DNS name for your load balancer, and hit Ctrl+C.
Open up a new browser window and paste your DNS name.
Now you will see your photo gallery website.
Notice that there are no images that are displayed here.
This is because the photo gallery displays all the images
that are in your RDS database.
Since we haven’t actually uploaded any images to your RDS database,
we will go ahead and do that now.
Go ahead and click Browse to upload a sample file.
Navigate to Pictures,
go to Sample Pictures,
and we’ll pick desert.
Click Open.
Now, click Upload.
The files will be uploaded to your S3 bucket
and then indexed using RDS database.
You have successfully deployed a sample web application
using Amazon Web Services.
For detailed instructions on deploying the sample application,
see the Getting Started Guide for
AWS Web Application Hosting for Windows.