|« PreviousNext »|
|Did this page help you? Yes | No | Tell us about it...|
To get started with the AWS SDK for .NET, you need to set up the following:
AWS Account and Credentials
.NET Development Environment
AWS SDK for .NET
To access AWS, you will need to sign up for an AWS account.
To sign up for an AWS account
Go to http://aws.amazon.com, and then click Sign Up.
Follow the on-screen instructions.
Part of the sign-up procedure involves receiving a phone call and entering a PIN using the phone keypad.
AWS sends you a confirmation email after the sign-up process is complete. At any time, you can view your current account activity and manage your account by going to http://aws.amazon.com and clicking My Account/Console.
When you sign up, AWS provides you with security credentials that are specific to your account. Two of these credentials, your access key ID and your secret key, are used by the SDK whenever it accesses the services provided by AWS. The security credentials authenticate requests to the service and identify you as the sender of a request. The following list shows examples of these credentials.
Access Key ID Example: AKIAIOSFODNN7EXAMPLE
Secret Access Key Example: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
To view your AWS access credentials
Go to the Amazon Web Services website at http://aws.amazon.com.
Click My Account/Console, and then click Security Credentials.
Under Your Account, click Security Credentials.
In the spaces provided, type your user name and password, and then click Sign in using our secure server.
Under Access Credentials, on the Access Keys tab, your access key ID is displayed. To view your secret key, under Secret Access Key, click Show.
Your secret key must remain a secret that is known only by you and AWS. Keep it confidential in order to protect your account. Store it securely in a safe place, and never email it. Do not share it outside your organization, even if an inquiry appears to come from AWS or Amazon.com. No one who legitimately represents Amazon will ever ask you for your secret key.
To use the AWS SDK for .NET, you'll need the following software:
Microsoft .NET Framework 3.5 or later
To use the project templates, you will need one of the following Visual Studio editions:
Microsoft Visual Studio 2008 Standard Edition or Visual Studio 2010 Standard Edition
Microsoft Visual C# 2008 Express Edition
Microsoft Visual Web Developer 2008 Express Edition
To use the AWS Toolkit for Visual Studio, you will need Visual Studio 2008 Standard Edition or Visual Studio 2010 Standard Edition.
To confirm installation
Open your Visual Studio product.
On the Help menu, click About. A dialog box opens that lists Microsoft Visual Studio and .NET Framework versions.
Configuring the .NET CLR
For the best performance of your server-based applications with the AWS SDK for .NET, we recommend that you use Server mode garbage collection (GC).
To enable Server mode GC, add the following to your app.config file:
<runtime> <gcServer enabled="true" /> <gcConcurrent enabled="true"/> </runtime>
Server mode GC works only on systems with multiple processors or processor cores. Enabling Server mode GC has no effect otherwise.
To install the AWS .NET SDK:
Click the Download button in the upper right corner of the page. Your browser will prompt you to save the install file.
To begin the install process, open the saved install file and follow the on-screen instructions.
By default, the AWS SDK for .NET is installed in the Program Files directory, which requires administrator privileges. You can install the AWS SDK for .NET as a non-administrator if you choose a different installation directory.
The AWS SDK for .NET is also available on GitHub.
NuGet always has the most recent versions of the AWS .NET assemblies, and
also enables you to install previous versions. NuGet is aware of
dependencies between assemblies and installs required assemblies
automatically. Assemblies that are installed with NuGet are stored with
your solution rather than in a central location such as
Files. This enables you to install assembly versions specific to
a given application without creating compatibility issues for other
For more information on NuGet, go to the NuGet documentation.
To use NuGet, install it from the Visual Studio Gallery on MSDN. If you are using Visual Studio 2012 or later, NuGet is installed automatically with Visual Studio.
You can use NuGet either from Solution Explorer or from the Package Manager Console.
To use NuGet from Solution Explorer, right-click on your project and select Manage NuGet Packages... from the context menu.
From the Manage NuGet Packages dialog, select Online in the left-hand pane. You can then search for the package that
you want to install using the search box in the upper-right corner.
The screenshot shows the
AWS.Extensions assembly package.
Notice that NuGet is aware that this package has a dependency on the
assembly package; NuGet will therefore install the
package if it is not already installed.
To use NuGet from the Package Manager Console within Visual Studio, from the View menu, select Other Windows, and click Package Manager Console.
From the console, you can install the AWS assemblies using the
Install-Package command. For
example, to install the AWS SDK for .NET assembly, use the following
To install an earlier version of a package, use the
-Version option and specify the desired package version. For example, to install version 18.104.22.168 of the AWS SDK for .NET assembly, use the following command line:
Install-Package AWSSDK -Version 22.214.171.124
The NuGet website provides a page for every package that is available through NuGet such as the AWSSDK and AWS.Extensions assemblies. The page for each package includes a sample command line for installing the package using the console. Each page also includes a list of the previous versions of the package that are available through NuGet.
The AWS SDK for .NET has three project templates you can use to build a new project on Amazon Web Services:
Creates a console application that references the AWS .NET library (AWSSDK.dll) with a sample Program.cs file that makes a basic request to Amazon Simple Storage Service (Amazon S3), Amazon SimpleDB, and Amazon Elastic Compute Cloud (EC2).
Creates a console application that references the AWS .NET library (AWSSDK.dll), but does not include any code in the Program.cs file.
Creates an ASP.NET application that references the AWS .NET library (AWSSDK.dll) with a sample Program.cs file that makes a basic request to Amazon S3, Amazon SimpleDB, and Amazon EC2.
The general process to create a new project based on a project template is similar across Visual Studio editions, but we'll go through the steps for Visual Studio 2010 Professional Edition.
To create a new project in Visual Studio 2010 Professional Edition
Launch Visual Studio.
On the File menu, select New, and then click Project. The New Project dialog box opens.
Select AWS from the list of installed templates, and then select the AWS project template you want to use. Enter a project name, and then click OK.
On project creation, the template prompts you for the security credentials that your code should use to access AWS. To use the credentials for one of the accounts that was added with the AWS Toolkit for Visual Studio, click Use existing account and select the account from the drop-down list. To add a new set of credentials, click Use a new account and enter the credentials information. Once you have specified the credentials to use, click OK.
If you do not want to specify any credentials at this time, click Skip. Note, however, that your code will not be able to access AWS without a valid set of credentials.
Running the Project
You can run the project immediately after the project is created by pressing F5 (or clicking Start Debugging on the Debug menu).
Where Do I Go From Here?
From here, you can check out the tutorials included in this developer guide.
This tutorial explains how to set up requests for Amazon EC2 Spot Instances, how to determine when they have completed, and how to clean up afterward.
The Additional Resources section has pointers to other resources to assist you in programming AWS.