AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Container for the parameters to the RunInstances operation. Launches the specified number of instances using an AMI for which you have permissions.

You can specify a number of options, or leave the default options. The following rules apply:

To ensure faster instance launches, break up large requests into smaller batches. For example, create five separate launch requests for 100 instances each instead of one launch request for 500 instances.

An instance is ready for you to use when it's in the running state. You can check the state of your instance using DescribeInstances. You can tag instances and EBS volumes during launch, after launch, or both. For more information, see CreateTags and Tagging Your Amazon EC2 Resources.

Linux instances have access to the public key of the key pair at boot. You can use this key to provide secure access to the instance. Amazon EC2 public images use this feature to provide secure access without passwords. For more information, see Key Pairs in the Amazon Elastic Compute Cloud User Guide.

For troubleshooting, see What To Do If An Instance Immediately Terminates, and Troubleshooting Connecting to Your Instance in the Amazon Elastic Compute Cloud User Guide.

Inheritance Hierarchy

System.Object
  Amazon.Runtime.AmazonWebServiceRequest
    Amazon.EC2.AmazonEC2Request
      Amazon.EC2.Model.RunInstancesRequest

Namespace: Amazon.EC2.Model
Assembly: AWSSDK.EC2.dll
Version: 3.x.y.z

Syntax

C#
public class RunInstancesRequest : AmazonEC2Request
         IAmazonWebServiceRequest

The RunInstancesRequest type exposes the following members

Constructors

NameDescription
Public Method RunInstancesRequest()

Empty constructor used to set properties independently even when a simple constructor is available

Public Method RunInstancesRequest(string, int, int)

Instantiates RunInstancesRequest with the parameterized properties

Properties

NameTypeDescription
Public Property AdditionalInfo System.String

Gets and sets the property AdditionalInfo.

Reserved.

Public Property BlockDeviceMappings System.Collections.Generic.List<Amazon.EC2.Model.BlockDeviceMapping>

Gets and sets the property BlockDeviceMappings.

The block device mapping.

Supplying both a snapshot ID and an encryption value as arguments for block-device mapping results in an error. This is because only blank volumes can be encrypted on start, and these are not created from a snapshot. If a snapshot is the basis for the volume, it contains data by definition and its encryption status cannot be changed using this action.

Public Property ClientToken System.String

Gets and sets the property ClientToken.

Unique, case-sensitive identifier you provide to ensure the idempotency of the request. For more information, see Ensuring Idempotency.

Constraints: Maximum 64 ASCII characters

Public Property DisableApiTermination System.Boolean

Gets and sets the property DisableApiTermination.

If you set this parameter to true, you can't terminate the instance using the Amazon EC2 console, CLI, or API; otherwise, you can. To change this attribute to false after launch, use ModifyInstanceAttribute. Alternatively, if you set InstanceInitiatedShutdownBehavior to terminate, you can terminate the instance by running the shutdown command from the instance.

Default: false

Public Property EbsOptimized System.Boolean

Gets and sets the property EbsOptimized.

Indicates whether the instance is optimized for Amazon EBS I/O. This optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal Amazon EBS I/O performance. This optimization isn't available with all instance types. Additional usage charges apply when using an EBS-optimized instance.

Default: false

Public Property ElasticGpuSpecification System.Collections.Generic.List<Amazon.EC2.Model.ElasticGpuSpecification>

Gets and sets the property ElasticGpuSpecification.

An Elastic GPU to associate with the instance.

Public Property IamInstanceProfile Amazon.EC2.Model.IamInstanceProfileSpecification

Gets and sets the property IamInstanceProfile.

The IAM instance profile.

Public Property ImageId System.String

Gets and sets the property ImageId.

The ID of the AMI, which you can get by calling DescribeImages.

Public Property InstanceInitiatedShutdownBehavior Amazon.EC2.ShutdownBehavior

Gets and sets the property InstanceInitiatedShutdownBehavior.

Indicates whether an instance stops or terminates when you initiate shutdown from the instance (using the operating system command for system shutdown).

Default: stop

Public Property InstanceType Amazon.EC2.InstanceType

Gets and sets the property InstanceType.

The instance type. For more information, see Instance Types in the Amazon Elastic Compute Cloud User Guide.

Default: m1.small

Public Property Ipv6AddressCount System.Int32

Gets and sets the property Ipv6AddressCount.

[EC2-VPC] A number of IPv6 addresses to associate with the primary network interface. Amazon EC2 chooses the IPv6 addresses from the range of your subnet. You cannot specify this option and the option to assign specific IPv6 addresses in the same request. You can specify this option if you've specified a minimum number of instances to launch.

Public Property Ipv6Addresses System.Collections.Generic.List<Amazon.EC2.Model.InstanceIpv6Address>

Gets and sets the property Ipv6Addresses.

[EC2-VPC] Specify one or more IPv6 addresses from the range of the subnet to associate with the primary network interface. You cannot specify this option and the option to assign a number of IPv6 addresses in the same request. You cannot specify this option if you've specified a minimum number of instances to launch.

Public Property KernelId System.String

Gets and sets the property KernelId.

The ID of the kernel.

We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see PV-GRUB in the Amazon Elastic Compute Cloud User Guide.

Public Property KeyName System.String

Gets and sets the property KeyName.

The name of the key pair. You can create a key pair using CreateKeyPair or ImportKeyPair.

If you do not specify a key pair, you can't connect to the instance unless you choose an AMI that is configured to allow users another way to log in.

Public Property MaxCount System.Int32

Gets and sets the property MaxCount.

The maximum number of instances to launch. If you specify more instances than Amazon EC2 can launch in the target Availability Zone, Amazon EC2 launches the largest possible number of instances above MinCount.

Constraints: Between 1 and the maximum number you're allowed for the specified instance type. For more information about the default limits, and how to request an increase, see How many instances can I run in Amazon EC2 in the Amazon EC2 FAQ.

Public Property MinCount System.Int32

Gets and sets the property MinCount.

The minimum number of instances to launch. If you specify a minimum that is more instances than Amazon EC2 can launch in the target Availability Zone, Amazon EC2 launches no instances.

Constraints: Between 1 and the maximum number you're allowed for the specified instance type. For more information about the default limits, and how to request an increase, see How many instances can I run in Amazon EC2 in the Amazon EC2 General FAQ.

Public Property Monitoring System.Boolean

Gets and sets the property Monitoring.

The monitoring for the instance.

Public Property NetworkInterfaces System.Collections.Generic.List<Amazon.EC2.Model.InstanceNetworkInterfaceSpecification>

Gets and sets the property NetworkInterfaces.

One or more network interfaces.

Public Property Placement Amazon.EC2.Model.Placement

Gets and sets the property Placement.

The placement for the instance.

Public Property PrivateIpAddress System.String

Gets and sets the property PrivateIpAddress.

[EC2-VPC] The primary IPv4 address. You must specify a value from the IPv4 address range of the subnet.

Only one private IP address can be designated as primary. You can't specify this option if you've specified the option to designate a private IP address as the primary IP address in a network interface specification. You cannot specify this option if you're launching more than one instance in the request.

Public Property RamdiskId System.String

Gets and sets the property RamdiskId.

The ID of the RAM disk.

We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see PV-GRUB in the Amazon Elastic Compute Cloud User Guide.

Public Property SecurityGroupIds System.Collections.Generic.List<System.String>

Gets and sets the property SecurityGroupIds.

One or more security group IDs. You can create a security group using CreateSecurityGroup.

Default: Amazon EC2 uses the default security group.

Public Property SecurityGroups System.Collections.Generic.List<System.String>

Gets and sets the property SecurityGroups.

[EC2-Classic, default VPC] One or more security group names. For a nondefault VPC, you must use security group IDs instead.

Default: Amazon EC2 uses the default security group.

Public Property SubnetId System.String

Gets and sets the property SubnetId.

[EC2-VPC] The ID of the subnet to launch the instance into.

Public Property TagSpecifications System.Collections.Generic.List<Amazon.EC2.Model.TagSpecification>

Gets and sets the property TagSpecifications.

The tags to apply to the resources during launch. You can tag instances and volumes. The specified tags are applied to all instances or volumes that are created during launch.

Public Property UserData System.String

Gets and sets the property UserData.

The user data to make available to the instance. For more information, see Running Commands on Your Linux Instance at Launch (Linux) and Adding User Data (Windows). If you are using an AWS SDK or command line tool, base64-encoding is performed for you, and you can load the text from a file. Otherwise, you must provide base64-encoded text.

Version Information

.NET Standard:
Supported in: 1.3

.NET Framework:
Supported in: 4.5, 4.0, 3.5

Portable Class Library:
Supported in: Windows Store Apps
Supported in: Windows Phone 8.1
Supported in: Xamarin Android
Supported in: Xamarin iOS (Unified)
Supported in: Xamarin.Forms