|« 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
SDK for .NET
To access AWS, you need 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 use the SDK for .NET, you must have a set of valid AWS credentials, which consist of an access key and a secret key. These keys are used to sign programmatic web service requests and enable AWS to verify that the request comes from an authorized source. You can obtain a set of account credentials when you create your account. However, we recommend that you do not use these credentials with SDK for .NET. Instead, create one or more IAM users, and use those credentials. For applications that run on EC2 instances, you can use instance roles to provide temporary credentials.
The preferred approach for handling credentials is to create a profile for each set of credentials in the SDK Store. You can create and manage profiles with the AWS Toolkit for Visual Studio, PowerShell cmdlets, or programmatically with the SDK for .NET. These credentials are encrypted and stored separately from any project. You then reference the profile by name in your application, and the credentials are inserted at build time. This approach ensures that your credentials are not unintentionally exposed with your project on a public site. For more information, see Setting Up the AWS Toolkit for Visual Studio and Configuring AWS Credentials.
For more information on IAM, including how to create IAM users and groups, and how to use roles to provide temporary credentials to applications running on EC2 instances, see What Is IAM?. For more information on managing your credentials, see Best Practices for Managing AWS Access Keys.
To use the AWS SDK for .NET, you'll need the following:
(Required) Microsoft .NET Framework 3.5 or later
(Required) Microsoft Visual Studio 2010 or later.
(Optional but recommended) AWS Toolkit for Visual Studio. a Visual Studio plugin that simplifies application development and includes a user interface (AWS Explorer) that helps you to manage your AWS resources from Visual Studio.
The Toolkit for Visual Studio includes the SDK for .NET, so you won't need to install it separately.
We recommend installing the AWS SDK for .NET on Visual Studio Professional or higher. It is possible to install the Toolkit for Visual Studio on Visual Studio Express, but it will have only a limited set of features. For more information, see Toolkit for Visual Studio.
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.
To configure the .NET CLR
To ensure the best performance of your server-based applications on systems with multiple processors or processor cores, we recommend that you enable server mode garbage collection (GC). Note that without multiple processors or processor cores, server mode GC has no effect.
To enable server mode GC, add the following to your
<runtime> <gcServer enabled="true"/> <gcConcurrent enabled="true"/> </runtime>
The following describes how to install AWS SDK for .NET. If you have installed the AWS Toolkit for Visual Studio, you can skip this step; the Toolkit for Visual Studio includes SDK for .NET.
To install the 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.
You can optionally install extensions for the SDK for .NET, which include a session state provider and a trace listener. For more information, see Install AWS Assemblies with NuGet.
The AWS SDK for .NET is also available on GitHub.
By default, the AWS SDK for .NET is installed in the Program Files directory, which requires administrator privileges. To install the AWS SDK for .NET as a non-administrator, specify a different installation directory.
If you have installed the Toolkit for Visual Studio on Visual Studio Professional, it includes the following basic C# project templates:
A console application that makes a basic request to Amazon Simple Storage Service (Amazon S3), Amazon SimpleDB, and Amazon Elastic Compute Cloud (Amazon EC2).
A console application that does not include any code.
An ASP.NET application that makes a basic request to Amazon S3, Amazon SimpleDB, and Amazon EC2.
The Toolkit for Visual Studio also includes a collection of templates for a variety of AWS services, including:
App Services – Amazon Elastic Transcoder, Amazon Simple Email Service (Amazon SES), Amazon Simple Workflow Service (Amazon SWF), Amazon Simple Notification Service (Amazon SNS), Amazon Simple Queue Service (Amazon SQS)
Compute and Networking – Amazon EC2
Database – Amazon DynamoDB, Amazon Relational Database Service, Amazon SimpleDB
Deployment and Management – Amazon CloudWatch Logs, AWS Identity and Access Management,
Storage and Content Delivery – Amazon Glacier, Amazon S3
The Toolkit for Visual Studio does not install the AWS project templates on Visual Studio Express.
You can also base your application on one of the standard Visual Studio project templates.
Just add a reference to the AWS .NET library
The following procedure gets you started by creating and running a new AWS Management Console project for Visual Studio 2012; the process is similar for other project types and Visual Studio versions. For more information on how to configure an AWS application, see Configuring Your AWS SDK for .NET Application.
To create a new AWS Management Console project
In Visual Studio, on the File menu, select New, and then click Project to open the New Project dialog box.
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.
Use the AWS Access Credentials dialog box to configure your application.
Specify which account profile your code should use to access AWS. To use an existing profile, click Use existing profile and select the appropriate one from the list. To add a new profile, click Use a new profile and enter the credentials information.
Specify a default region.
Click OK to accept the configuration, which opens the project.
Examine the project's
App.config file, which will contain something
like the following:
<configuration> <appSettings> <add key="AWSProfileName" value="development"/> <add key="AWSRegion" value="us-east-1" /> </appSettings> </configuration>
The Toolkit for Visual Studio adds two key-value pairs to
appSettings, based on the values
you specified in the AWS Access Credentials dialog box:
AWSProfileName – specifies the profile name.
AWSRegion – specifies the default region.
Click F5 to compile and run the application, which prints the number of Amazon EC2 instances, Amazon SimpleDB tables, and Amazon S3 buckets in your account.
For more information on how to configure an AWS application, see Configuring Your AWS SDK for .NET Application.
The Additional Resources section has pointers to other resources to assist you in programming AWS.