Developing Amazon EC2 applications – Windows
In the second chapter, we discussed EC2 instances in brief.Â
Let's now start by looking at how we can launch an EC2 instance using the SDK by writing an application program. We will use the same .NET C# SDK classes and their functions to manipulate EC2 instances.
Launching an EC2 instance
To launch an EC2 instance on AWS, we need:
- Amazon Machine Image (AMI)
- Instance type or flavor of the instance
- Key Pair name
An EC2 instance can be launched using an existing AMI in the same region. There are two important classes used for this purpose. The AmazonEC2Client
class is used to instantiate an EC2 client object. This class is used to manage the EC2 resources. Also, the RunInstancesRequest
class is used to create a request object that consists of the instance details such as AMI identifier, instance type, key pair, and so on. The request object is then passed to the RunInstances()
 function of the AmazonEC2Client
class. This function then sends a request to...