Project 2 - Visual Studio Setup
Installation
- Install a recent version of Visual Studio
- Don't have Visual Studio already? It's available for download from Microsoft. The free "Visual Studio Community 2015" edition can be used with the AWS IDE Toolkit.
- Download and install the latest AWS IDE Toolkit for Visual Studio. The link is halfway down the AWS Tools page.
- Launch Visual Studio
Demo Program 1 - AWS Overview
- In Visual Studio, choose File->New->Project...
- Select "Visual C#", then "AWS Sample Projects", and then select "AWS Console Project"
- Enter a project name: AWS-Demo1 and choose OK
- Configure AWS Toolkit
- Enter the following information for the default account:
- Display Name: <Your Name> (This will be used to create a local Profile with the login information)
- Access Key ID: <Your ID>
- Secret Access Key: <Your Key>
- Leave the default region set to US-West (Oregon)
- Click OK when finished
- 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#", then "AWS Sample Projects", then "Database", and finally select "AWS DynamoDB DataModel Example".
- Enter a project name: AWS-Demo2 and choose OK
- Use the existing AWS profile (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.
- Note: If you get an error complaining that .NET Framework 3.5 is not available on your computer, right-click on the project name ("AWS-Demo2") in the Solution Explorer Window, and then under Target Framework, change the setting to ".NET Framework 4.5.x" (where x is the latest on your machine). The AWS SDK is compatible with Frameworks 3.5 or later.
Your output should look like this:
Setting up DynamoDB client Creating sample tables Getting list of tables Number of tables: 0 Table Actors does not exist, creating Table Movies does not exist, creating 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 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.
- App Services
- AWS SQS (Simple Queue Service) Sample
- Compute and Networking
- AWS EC2 Sample
- Database
- AWS DynamoDB DataModel Sample
- AWS DynamoDB Document Sample
- AWS DynamoDB S3Link Sample
- Storage and Content Delivery
- AWS S3 Sample
- AWS S3 File System Sample
- AWS S3 Transfer Utility Sample