|« PreviousNext »|
|Did this page help you? Yes | No | Tell us about it...|
To get started with the AWS SDK for .NET, 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.
To get your access key ID and secret access key
Access keys consist of an access key ID and secret access key, which are used to sign programmatic requests that you make to AWS. If you don't have access keys, you can create them by using the AWS Management Console. We recommend that you use IAM access keys instead of AWS root account access keys. IAM lets you securely control access to AWS services and resources in your AWS account.
To create access keys, you must have permissions to perform the required IAM actions. For more information, see Granting IAM User Permission to Manage Password Policy and Credentials in Using IAM.
Go to the IAM console.
From the navigation menu, click Users.
Select your IAM user name.
Click User Actions, and then click Manage Access Keys.
Click Create Access Key.
Your keys will look something like this:
Access key ID example: AKIAIOSFODNN7EXAMPLE
Secret access key example: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Click Download Credentials, and store the keys in a secure location.
Your secret key will no longer be available through the AWS Management Console; you will have the only copy. Keep it confidential in order to protect your account, 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
Microsoft Visual Studio Professional edition or better, version 2010 or newer.
To confirm installation
Start Visual Studio.
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 SDK for .NET
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
Program Files. This enables you to install assembly versions specific to a given application without
creating compatibility issues for other applications.
For more information about NuGet, go to the NuGet documentation.
To use NuGet, install it from the Visual Studio Gallery on MSDN. If you are using Visual Studio 2010 or later, NuGet is installed automatically.
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 box, select Online in the
left 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
AWSSDK assembly package; NuGet will therefore install the
AWSSDK 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 command line:
To install an earlier version of a package, use the
-Version option and specify the desired
package version. For example, to install version 126.96.36.199 of the AWS SDK for .NET assembly, use the following command
Install-Package AWSSDK -Version 188.8.131.52
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 provides the following project template(s) 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 (Amazon 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.