User guide

Table Of Contents
"Resource" : "arn:aws:dynamodb:us-east-1:<YOUR-AWS-ACCOUNT-
ID>:table/ASP.NET_SessionState"
}
]
}
Tutorial: Creating Amazon EC2 Instances with
the AWS SDK for .NET
You can access the features of Amazon EC2 using the AWS SDK for .NET. For example, you can create,
start, and terminate EC2 instances.
The sample code in this tutorial is written in C#, but you can use the AWS SDK for .NET with any com-
patible language. The AWS SDK for .NET installs a set of C# project templates, so the simplest way to
start this project is to open Visual Studio, select New Project from the File menu, and then select AWS
Empty Project.
Prerequisites
Before you begin, be sure that you have created an AWS account and that you have set up your AWS
credentials. For more information, see Getting Started (p. 3).
Tasks
The following tasks demonstrate how to manage EC2 instances using the AWS SDK for .NET.
Create an Amazon EC2 Client (p. 36)
Create a Security Group (p. 37)
Create a Key Pair (p. 40)
Launch an EC2 Instance (p. 41)
Terminate an EC2 Instance (p. 46)
Create an Amazon EC2 Client Using the SDK for
.NET
Create an Amazon EC2 client to manage your EC2 resources, such as instances and security groups.
This client is represented by an AmazonEC2Client object, which you can create as follows:
var ec2Client = new AmazonEC2Client();
The permissions for the client object are determined by the policy that is attached to the profile that you
specified in the App.config file. By default, we use the region specified in App.config.To use a different
region, pass the appropriate RegionEndpoint value to the constructor. For more information, see Regions
and Endpoints in the AWS General Reference.
Version v2.0.0
36
AWS SDK for .NET Developer Guide
Tutorial: Creating Amazon EC2 Instances