Project 2 - Visual Studio Setup
Installation
- Install a recent version of Visual Studio Professional (2008, 2010, 2012, or 2013)
- Don't have Visual Studio already? It's available for download from Microsoft. Even better, a link on that page mentions that students are eligible for a free copy of 2013 Professional edition.
- The "Express 2013 for Windows Desktop" (free) edition can be used, but you will not get access to the AWS Explorer feature of the SDK. "Professional" edition or higher enables all SDK features.
- Download and install the latest AWS IDE Toolkit for Visual Studio. The link is halfway down the AWS Tools page.
- Launch Visual Studio
- Configure AWS Toolkit (you should be prompted upon first launch)
- Enter the following information for the default account:
- Access Key ID: <Check file Sakai drop-box>
- Secret Access Key: <Check file in Sakai drop-box>
- Leave the default region set to US-West (Oregon)
- Click OK when finished
Demo Program 1 - AWS Overview
- In Visual Studio, choose File->New->Project...
- Select "Visual C#" under "Other Languages", under Visual C# select "AWS", and then select "AWS Console Project"
- Enter a project name: AWS-Demo1 and choose OK
- Use the default AWS account (whose login information you just entered) and choose OK
- Browse the code for a bit: Solution Explorer Panel -> AWS-Demo1->program.cs. You should see demo code that performs the following actions:
- Prints the number of EC2 availability zones and instances running
- Print the number of SimpleDB tables and records contained within
- Print the total number of S3 buckets
- Finally, run the demo! Choose Build->Build Solution and then Debug->Start Without Debugging.
Your output should look like this:
=========================================== Welcome to the AWS .NET SDK! =========================================== You have 0 Amazon EC2 instance(s) running in the us-west-2 region. You have 0 Amazon SimpleDB domain(s) in the us-west-2 region. You have 19 Amazon S3 bucket(s). Press any key to continue...
Demo Program 2 - DynamoDB
- In Visual Studio, choose File->New->Project...
- Select "Visual C#" under "Other Languages", under Visual C# select "AWS", and under AWS select "AWS DynamoDB DataModel Example". Click Next.
- Enter a project name: AWS-Demo1 and choose OK
- Use the default AWS account (whose login information you just entered) and choose OK
- Browse the code for a bit: Solution Explorer Panel -> AWS-Demo2->Program.cs (as well as the other .cs files). You should see code that creates a database table and adds a few dummy records to it.
- Finally, run the demo! Choose Build->Build Solution and then Debug->Start Without Debugging.
Your output should look like this:
Setting up DynamoDB client Creating sample tables Getting list of tables Number of tables: 1 Table Actors does not exist, creating Table Movies does not exist, creating While tables are still being created, sleeping for 5 seconds... While tables are still being created, sleeping for 5 seconds... While tables are still being created, sleeping for 5 seconds... While tables are still being created, sleeping for 5 seconds... While tables are still being created, sleeping for 5 seconds... While tables are still being created, sleeping for 5 seconds... While tables are still being created, sleeping for 5 seconds... While tables are still being created, sleeping for 5 seconds... All sample tables created Creating the context object Running DataModel sample Creating actors Creating movie Saving actors and movie Creating and saving new actor Loading existing movie The Dark Knight - 7/18/2008 12:00:00 AM Actors: Christian Bale, Michael Caine Loading nonexistent movie Movie is null : True Updating movie and saving Adding movie with same hash key but different range key Running query 1, expecting 1 result The Dark Knight - 7/18/2008 12:00:00 AM Actors: Christian Bale, Maggie Gyllenhaal, Michael Caine Running query 2, expecting 2 results The Dark Knight - 2/23/1989 12:00:00 AM Actors: Fernando Guillén, Juan Diego, Manuel de Blas The Dark Knight - 7/18/2008 12:00:00 AM Actors: Christian Bale, Maggie Gyllenhaal, Michael Caine Running scan 1, expecting 2 results Maggie Gyllenhaal - 11/16/1977 12:00:00 AM Christian Bale - 1/30/1974 12:00:00 AM Running scan 2, expecting 1 result Maggie Gyllenhaal - 11/16/1977 12:00:00 AM Removing sample tables Deleting table Actors Deleting table Movies While sample tables still exist, sleeping for 5 seconds... Getting list of tables While sample tables still exist, sleeping for 5 seconds... Getting list of tables While sample tables still exist, sleeping for 5 seconds... Getting list of tables While sample tables still exist, sleeping for 5 seconds... Getting list of tables While sample tables still exist, sleeping for 5 seconds... Getting list of tables While sample tables still exist, sleeping for 5 seconds... Getting list of tables While sample tables still exist, sleeping for 5 seconds... Getting list of tables Sample tables deleted Press Enter to continue...
If the demo program didn't clean up after itself, you could log onto the AWS website and see the database itself. (For future reference, go to AWS and select the DynamoDB tool. Then, from the top menu, select the US-West (Oregon) region, which the demo code defaulted to use for your database. You should see your table in the list, and be able to open the table and view the newly-created entries.)
Other Demos
The SDK includes many other project demos that may be useful. You can locate them by expanding the AWS option under C# when you are creating a new project, or by browsing your filesystem at C:\Program Files (x86)\AWS SDK for .NET\Samples
- App Services
- AWS SQS (Simple Queue Service) Sample
- Database
- AWS DynamoDB DataModel Sample
- AWS DynamoDB Document Sample
- AWS SimpleDB Sample
- AWS SimpleDB Async Sample
- Storage and Content Delivery
- AWS S3 Sample
- AWS S3 File System Sample
- AWS S3 Transfer Utility Sample