Program.cs - AWS Code Sample


<<FILENAME>> demonstrates how to ...

/******************************************************************************* * Copyright 2009-2019, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may * not use this file except in compliance with the License. A copy of the * License is located at * * * * or in the "license" file accompanying this file. This file is * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the specific * language governing permissions and limitations under the License. *******************************************************************************/ using System; using Amazon; using Amazon.EC2; namespace AWS.Samples { public partial class Program { static void Main(string[] args) { AmazonEC2Client client = new AmazonEC2Client(RegionEndpoint.USWest2); Console.WriteLine("ec2Client is operating in the {0} region.", client.Config.RegionEndpoint.DisplayName); string keyPairName = "EC2-Sample-Keypair"; CreateKeyPair(client, keyPairName, @"C:\\temp\\" + keyPairName + ".pem"); EnumerateKeyPairs(client); EnumerateSecurityGroups(client); string securityGroupName = "default"; DescribeImages(client); var instanceId = LaunchInstance( keyPairName, securityGroupName, client ); TerminateInstance(client, instanceId); Console.WriteLine("Press any key to exit."); Console.ReadLine(); } } }

Sample Details

Service: ec2

Author: AWS

Type: <<snippet or full-example>>