You are viewing documentation for version 2 of the AWS SDK for Ruby. Version 3 documentation can be found here.

Class: Aws::EC2::Types::RunInstancesRequest

Inherits:
Struct
  • Object
show all
Defined in:
(unknown)

Overview

Note:

When passing RunInstancesRequest as input to an Aws::Client method, you can use a vanilla Hash:

{
  block_device_mappings: [
    {
      device_name: "String",
      virtual_name: "String",
      ebs: {
        encrypted: false,
        delete_on_termination: false,
        iops: 1,
        snapshot_id: "String",
        volume_size: 1,
        volume_type: "standard", # accepts standard, io1, gp2, sc1, st1
      },
      no_device: "String",
    },
  ],
  image_id: "String", # required
  instance_type: "t1.micro", # accepts t1.micro, t2.nano, t2.micro, t2.small, t2.medium, t2.large, t2.xlarge, t2.2xlarge, m1.small, m1.medium, m1.large, m1.xlarge, m3.medium, m3.large, m3.xlarge, m3.2xlarge, m4.large, m4.xlarge, m4.2xlarge, m4.4xlarge, m4.10xlarge, m4.16xlarge, m2.xlarge, m2.2xlarge, m2.4xlarge, cr1.8xlarge, r3.large, r3.xlarge, r3.2xlarge, r3.4xlarge, r3.8xlarge, r4.large, r4.xlarge, r4.2xlarge, r4.4xlarge, r4.8xlarge, r4.16xlarge, x1.16xlarge, x1.32xlarge, x1e.32xlarge, i2.xlarge, i2.2xlarge, i2.4xlarge, i2.8xlarge, i3.large, i3.xlarge, i3.2xlarge, i3.4xlarge, i3.8xlarge, i3.16xlarge, hi1.4xlarge, hs1.8xlarge, c1.medium, c1.xlarge, c3.large, c3.xlarge, c3.2xlarge, c3.4xlarge, c3.8xlarge, c4.large, c4.xlarge, c4.2xlarge, c4.4xlarge, c4.8xlarge, cc1.4xlarge, cc2.8xlarge, g2.2xlarge, g2.8xlarge, g3.4xlarge, g3.8xlarge, g3.16xlarge, cg1.4xlarge, p2.xlarge, p2.8xlarge, p2.16xlarge, d2.xlarge, d2.2xlarge, d2.4xlarge, d2.8xlarge, f1.2xlarge, f1.16xlarge
  ipv_6_address_count: 1,
  ipv_6_addresses: [
    {
      ipv_6_address: "String",
    },
  ],
  kernel_id: "String",
  key_name: "String",
  max_count: 1, # required
  min_count: 1, # required
  monitoring: {
    enabled: false, # required
  },
  placement: {
    availability_zone: "String",
    affinity: "String",
    group_name: "String",
    host_id: "String",
    tenancy: "default", # accepts default, dedicated, host
    spread_domain: "String",
  },
  ramdisk_id: "String",
  security_group_ids: ["String"],
  security_groups: ["String"],
  subnet_id: "String",
  user_data: "String",
  additional_info: "String",
  client_token: "String",
  disable_api_termination: false,
  dry_run: false,
  ebs_optimized: false,
  iam_instance_profile: {
    arn: "String",
    name: "String",
  },
  instance_initiated_shutdown_behavior: "stop", # accepts stop, terminate
  network_interfaces: [
    {
      associate_public_ip_address: false,
      delete_on_termination: false,
      description: "String",
      device_index: 1,
      groups: ["String"],
      ipv_6_address_count: 1,
      ipv_6_addresses: [
        {
          ipv_6_address: "String",
        },
      ],
      network_interface_id: "String",
      private_ip_address: "String",
      private_ip_addresses: [
        {
          primary: false,
          private_ip_address: "String", # required
        },
      ],
      secondary_private_ip_address_count: 1,
      subnet_id: "String",
    },
  ],
  private_ip_address: "String",
  elastic_gpu_specification: [
    {
      type: "String", # required
    },
  ],
  tag_specifications: [
    {
      resource_type: "customer-gateway", # accepts customer-gateway, dhcp-options, image, instance, internet-gateway, network-acl, network-interface, reserved-instances, route-table, snapshot, spot-instances-request, subnet, security-group, volume, vpc, vpn-connection, vpn-gateway
      tags: [
        {
          key: "String",
          value: "String",
        },
      ],
    },
  ],
}

Contains the parameters for RunInstances.

Instance Attribute Summary collapse

Instance Attribute Details

#additional_infoString

Reserved.

Returns:

  • (String)

    Reserved.

#block_device_mappingsArray<Types::BlockDeviceMapping>

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.

Returns:

#client_tokenString

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

Constraints: Maximum 64 ASCII characters

Returns:

  • (String)

    Unique, case-sensitive identifier you provide to ensure the idempotency of the request.

#disable_api_terminationBoolean

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

Returns:

  • (Boolean)

    If you set this parameter to true, you can\'t terminate the instance using the Amazon EC2 console, CLI, or API; otherwise, you can.

#dry_runBoolean

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

Returns:

  • (Boolean)

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response.

#ebs_optimizedBoolean

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

Returns:

  • (Boolean)

    Indicates whether the instance is optimized for Amazon EBS I/O.

#elastic_gpu_specificationArray<Types::ElasticGpuSpecification>

An Elastic GPU to associate with the instance.

Returns:

#iam_instance_profileTypes::IamInstanceProfileSpecification

The IAM instance profile.

Returns:

#image_idString

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

Returns:

  • (String)

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

#instance_initiated_shutdown_behaviorString

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

Default: stop

Possible values:

  • stop
  • terminate

Returns:

  • (String)

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

#instance_typeString

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

Default: m1.small

Returns:

  • (String)

    The instance type.

#ipv_6_address_countInteger

[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.

Returns:

  • (Integer)

    [EC2-VPC] A number of IPv6 addresses to associate with the primary network interface.

#ipv_6_addressesArray<Types::InstanceIpv6Address>

[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.

Returns:

  • (Array<Types::InstanceIpv6Address>)

    [EC2-VPC] Specify one or more IPv6 addresses from the range of the subnet to associate with the primary network interface.

#kernel_idString

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.

Returns:

  • (String)

    The ID of the kernel.

#key_nameString

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.

Returns:

  • (String)

    The name of the key pair.

#max_countInteger

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.

Returns:

  • (Integer)

    The maximum number of instances to launch.

#min_countInteger

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.

Returns:

  • (Integer)

    The minimum number of instances to launch.

#monitoringTypes::RunInstancesMonitoringEnabled

The monitoring for the instance.

Returns:

#network_interfacesArray<Types::InstanceNetworkInterfaceSpecification>

One or more network interfaces.

Returns:

#placementTypes::Placement

The placement for the instance.

Returns:

#private_ip_addressString

[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.

Returns:

  • (String)

    [EC2-VPC] The primary IPv4 address.

#ramdisk_idString

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.

Returns:

  • (String)

    The ID of the RAM disk.

#security_group_idsArray<String>

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

Default: Amazon EC2 uses the default security group.

Returns:

  • (Array<String>)

    One or more security group IDs.

#security_groupsArray<String>

[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.

Returns:

  • (Array<String>)

    [EC2-Classic, default VPC] One or more security group names.

#subnet_idString

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

Returns:

  • (String)

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

#tag_specificationsArray<Types::TagSpecification>

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.

Returns:

#user_dataString

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 a 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.

Returns:

  • (String)

    The user data to make available to the instance.