Wednesday, December 02, 2009

Describing EC2 instances using the AWS SDK for .NET

Here is some sample code that shows you how to enumerate the EC2 instances currently associated with your AWS account.

DescribeInstancesResponse resp = ec2.DescribeInstances(new DescribeInstancesRequest());
if (resp.IsSetDescribeInstancesResult())
{
DescribeInstancesResult result = resp.DescribeInstancesResult;
foreach (RunningInstance inst in result.RunningInstance)
{
Console.WriteLine(inst.InstanceId);
}
}

Watch this space for more snippets of code that will help you manage your AWS resources using the SDK for .NET.

No comments:

Post a Comment