AWS SDK for .NET
Developer Guide (Version v1.0.0)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Did this page help you?  Yes | No |  Tell us about it...

Tutorial: Create Amazon EC2 Instances

This topic demonstrates how to use the AWS SDK for .NET to create, start, and terminate Amazon Elastic Compute Cloud (Amazon EC2) instances.

The sample code in this topic is written in C#, but you can use the AWS SDK for .NET with any language that is compatible with the Microsoft .NET Framework. The AWS SDK for .NET installs a set of C# project templates, so the simplest way to start this project is to click the Visual Studio File menu's New Project command and create a new AWS Empty Project.

Your project must include an App.Config file, which serves as a container for your AWS credentials and has the following content:

<?xml version="1.0"?>
<configuration>
    <appSettings>
        <add key="AWSAccessKey" value="Your_AWS_Access_Key"/>
        <add key="AWSSecretKey" value="Your_AWS_Secret_Key"/>
    </appSettings>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>
</configuration>

Note

If create your project by using an AWS SDK for .NET template, Visual Studio creates this file for you.

To add your credentials to App.Config, replace the Your_AWS_Access_Key and Your_AWS_Secret_Key values with your AWS access and secret keys, respectively. To learn more about your AWS credentials, including where to find them, go to About AWS Security Credentials.

The following sections walk you through the basic procedure for creating, launching, and terminating an EC2 instance by using the AWS SDK for .NET.