Interface RunInstancesRequest.Builder

All Superinterfaces:
AwsRequest.Builder, Buildable, CopyableBuilder<RunInstancesRequest.Builder,RunInstancesRequest>, Ec2Request.Builder, SdkBuilder<RunInstancesRequest.Builder,RunInstancesRequest>, SdkPojo, SdkRequest.Builder
Enclosing class:
RunInstancesRequest

public static interface RunInstancesRequest.Builder extends Ec2Request.Builder, SdkPojo, CopyableBuilder<RunInstancesRequest.Builder,RunInstancesRequest>
  • Method Details

    • blockDeviceMappings

      RunInstancesRequest.Builder blockDeviceMappings(Collection<BlockDeviceMapping> blockDeviceMappings)

      The block device mapping, which defines the EBS volumes and instance store volumes to attach to the instance at launch. For more information, see Block device mappings in the Amazon EC2 User Guide.

      Parameters:
      blockDeviceMappings - The block device mapping, which defines the EBS volumes and instance store volumes to attach to the instance at launch. For more information, see Block device mappings in the Amazon EC2 User Guide.
      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • blockDeviceMappings

      RunInstancesRequest.Builder blockDeviceMappings(BlockDeviceMapping... blockDeviceMappings)

      The block device mapping, which defines the EBS volumes and instance store volumes to attach to the instance at launch. For more information, see Block device mappings in the Amazon EC2 User Guide.

      Parameters:
      blockDeviceMappings - The block device mapping, which defines the EBS volumes and instance store volumes to attach to the instance at launch. For more information, see Block device mappings in the Amazon EC2 User Guide.
      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • blockDeviceMappings

      RunInstancesRequest.Builder blockDeviceMappings(Consumer<BlockDeviceMapping.Builder>... blockDeviceMappings)

      The block device mapping, which defines the EBS volumes and instance store volumes to attach to the instance at launch. For more information, see Block device mappings in the Amazon EC2 User Guide.

      This is a convenience method that creates an instance of the BlockDeviceMapping.Builder avoiding the need to create one manually via BlockDeviceMapping.builder().

      When the Consumer completes, SdkBuilder.build() is called immediately and its result is passed to blockDeviceMappings(List<BlockDeviceMapping>).

      Parameters:
      blockDeviceMappings - a consumer that will call methods on BlockDeviceMapping.Builder
      Returns:
      Returns a reference to this object so that method calls can be chained together.
      See Also:
    • imageId

      The ID of the AMI. An AMI ID is required to launch an instance and must be specified here or in a launch template.

      Parameters:
      imageId - The ID of the AMI. An AMI ID is required to launch an instance and must be specified here or in a launch template.
      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • instanceType

      RunInstancesRequest.Builder instanceType(String instanceType)

      The instance type. For more information, see Instance types in the Amazon EC2 User Guide.

      Parameters:
      instanceType - The instance type. For more information, see Instance types in the Amazon EC2 User Guide.
      Returns:
      Returns a reference to this object so that method calls can be chained together.
      See Also:
    • instanceType

      RunInstancesRequest.Builder instanceType(InstanceType instanceType)

      The instance type. For more information, see Instance types in the Amazon EC2 User Guide.

      Parameters:
      instanceType - The instance type. For more information, see Instance types in the Amazon EC2 User Guide.
      Returns:
      Returns a reference to this object so that method calls can be chained together.
      See Also:
    • ipv6AddressCount

      RunInstancesRequest.Builder ipv6AddressCount(Integer ipv6AddressCount)

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

      You cannot specify this option and the network interfaces option in the same request.

      Parameters:
      ipv6AddressCount - The 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.

      You cannot specify this option and the network interfaces option in the same request.

      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • ipv6Addresses

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

      You cannot specify this option and the network interfaces option in the same request.

      Parameters:
      ipv6Addresses - The 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.

      You cannot specify this option and the network interfaces option in the same request.

      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • ipv6Addresses

      RunInstancesRequest.Builder ipv6Addresses(InstanceIpv6Address... ipv6Addresses)

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

      You cannot specify this option and the network interfaces option in the same request.

      Parameters:
      ipv6Addresses - The 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.

      You cannot specify this option and the network interfaces option in the same request.

      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • ipv6Addresses

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

      You cannot specify this option and the network interfaces option in the same request.

      This is a convenience method that creates an instance of the InstanceIpv6Address.Builder avoiding the need to create one manually via InstanceIpv6Address.builder().

      When the Consumer completes, SdkBuilder.build() is called immediately and its result is passed to ipv6Addresses(List<InstanceIpv6Address>).

      Parameters:
      ipv6Addresses - a consumer that will call methods on InstanceIpv6Address.Builder
      Returns:
      Returns a reference to this object so that method calls can be chained together.
      See Also:
    • kernelId

      RunInstancesRequest.Builder kernelId(String 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 EC2 User Guide.

      Parameters:
      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 EC2 User Guide.

      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • 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.

      Parameters:
      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.

      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • 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.

      Parameters:
      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.

      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • 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.

      Parameters:
      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.

      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • monitoring

      Specifies whether detailed monitoring is enabled for the instance.

      Parameters:
      monitoring - Specifies whether detailed monitoring is enabled for the instance.
      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • monitoring

      Specifies whether detailed monitoring is enabled for the instance.

      This is a convenience method that creates an instance of the RunInstancesMonitoringEnabled.Builder avoiding the need to create one manually via RunInstancesMonitoringEnabled.builder().

      When the Consumer completes, SdkBuilder.build() is called immediately and its result is passed to monitoring(RunInstancesMonitoringEnabled).

      Parameters:
      monitoring - a consumer that will call methods on RunInstancesMonitoringEnabled.Builder
      Returns:
      Returns a reference to this object so that method calls can be chained together.
      See Also:
    • placement

      RunInstancesRequest.Builder placement(Placement placement)

      The placement for the instance.

      Parameters:
      placement - The placement for the instance.
      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • placement

      default RunInstancesRequest.Builder placement(Consumer<Placement.Builder> placement)

      The placement for the instance.

      This is a convenience method that creates an instance of the Placement.Builder avoiding the need to create one manually via Placement.builder().

      When the Consumer completes, SdkBuilder.build() is called immediately and its result is passed to placement(Placement).

      Parameters:
      placement - a consumer that will call methods on Placement.Builder
      Returns:
      Returns a reference to this object so that method calls can be chained together.
      See Also:
    • ramdiskId

      RunInstancesRequest.Builder ramdiskId(String ramdiskId)

      The ID of the RAM disk to select. Some kernels require additional drivers at launch. Check the kernel requirements for information about whether you need to specify a RAM disk. To find kernel requirements, go to the Amazon Web Services Resource Center and search for the kernel ID.

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

      Parameters:
      ramdiskId - The ID of the RAM disk to select. Some kernels require additional drivers at launch. Check the kernel requirements for information about whether you need to specify a RAM disk. To find kernel requirements, go to the Amazon Web Services Resource Center and search for the kernel ID.

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

      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • securityGroupIds

      RunInstancesRequest.Builder securityGroupIds(Collection<String> securityGroupIds)

      The IDs of the security groups. You can create a security group using CreateSecurityGroup.

      If you specify a network interface, you must specify any security groups as part of the network interface.

      Parameters:
      securityGroupIds - The IDs of the security groups. You can create a security group using CreateSecurityGroup.

      If you specify a network interface, you must specify any security groups as part of the network interface.

      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • securityGroupIds

      RunInstancesRequest.Builder securityGroupIds(String... securityGroupIds)

      The IDs of the security groups. You can create a security group using CreateSecurityGroup.

      If you specify a network interface, you must specify any security groups as part of the network interface.

      Parameters:
      securityGroupIds - The IDs of the security groups. You can create a security group using CreateSecurityGroup.

      If you specify a network interface, you must specify any security groups as part of the network interface.

      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • securityGroups

      RunInstancesRequest.Builder securityGroups(Collection<String> securityGroups)

      [Default VPC] The names of the security groups.

      If you specify a network interface, you must specify any security groups as part of the network interface.

      Default: Amazon EC2 uses the default security group.

      Parameters:
      securityGroups - [Default VPC] The names of the security groups.

      If you specify a network interface, you must specify any security groups as part of the network interface.

      Default: Amazon EC2 uses the default security group.

      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • securityGroups

      RunInstancesRequest.Builder securityGroups(String... securityGroups)

      [Default VPC] The names of the security groups.

      If you specify a network interface, you must specify any security groups as part of the network interface.

      Default: Amazon EC2 uses the default security group.

      Parameters:
      securityGroups - [Default VPC] The names of the security groups.

      If you specify a network interface, you must specify any security groups as part of the network interface.

      Default: Amazon EC2 uses the default security group.

      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • subnetId

      RunInstancesRequest.Builder subnetId(String subnetId)

      The ID of the subnet to launch the instance into.

      If you specify a network interface, you must specify any subnets as part of the network interface.

      Parameters:
      subnetId - The ID of the subnet to launch the instance into.

      If you specify a network interface, you must specify any subnets as part of the network interface.

      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • userData

      RunInstancesRequest.Builder userData(String userData)

      The user data script to make available to the instance. For more information, see Run commands on your Linux instance at launch and Run commands on your Windows instance at launch. 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. User data is limited to 16 KB.

      Parameters:
      userData - The user data script to make available to the instance. For more information, see Run commands on your Linux instance at launch and Run commands on your Windows instance at launch. 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. User data is limited to 16 KB.
      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • additionalInfo

      RunInstancesRequest.Builder additionalInfo(String additionalInfo)

      Reserved.

      Parameters:
      additionalInfo - Reserved.
      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • clientToken

      RunInstancesRequest.Builder clientToken(String clientToken)

      Unique, case-sensitive identifier you provide to ensure the idempotency of the request. If you do not specify a client token, a randomly generated token is used for the request to ensure idempotency.

      For more information, see Ensuring Idempotency.

      Constraints: Maximum 64 ASCII characters

      Parameters:
      clientToken - Unique, case-sensitive identifier you provide to ensure the idempotency of the request. If you do not specify a client token, a randomly generated token is used for the request to ensure idempotency.

      For more information, see Ensuring Idempotency.

      Constraints: Maximum 64 ASCII characters

      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • disableApiTermination

      RunInstancesRequest.Builder disableApiTermination(Boolean 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 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

      Parameters:
      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 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:
      Returns a reference to this object so that method calls can be chained together.
    • dryRun

      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.

      Parameters:
      dryRun - 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:
      Returns a reference to this object so that method calls can be chained together.
    • ebsOptimized

      RunInstancesRequest.Builder ebsOptimized(Boolean 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

      Parameters:
      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

      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • iamInstanceProfile

      RunInstancesRequest.Builder iamInstanceProfile(IamInstanceProfileSpecification iamInstanceProfile)

      The name or Amazon Resource Name (ARN) of an IAM instance profile.

      Parameters:
      iamInstanceProfile - The name or Amazon Resource Name (ARN) of an IAM instance profile.
      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • iamInstanceProfile

      default RunInstancesRequest.Builder iamInstanceProfile(Consumer<IamInstanceProfileSpecification.Builder> iamInstanceProfile)

      The name or Amazon Resource Name (ARN) of an IAM instance profile.

      This is a convenience method that creates an instance of the IamInstanceProfileSpecification.Builder avoiding the need to create one manually via IamInstanceProfileSpecification.builder().

      When the Consumer completes, SdkBuilder.build() is called immediately and its result is passed to iamInstanceProfile(IamInstanceProfileSpecification).

      Parameters:
      iamInstanceProfile - a consumer that will call methods on IamInstanceProfileSpecification.Builder
      Returns:
      Returns a reference to this object so that method calls can be chained together.
      See Also:
    • instanceInitiatedShutdownBehavior

      RunInstancesRequest.Builder instanceInitiatedShutdownBehavior(String 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

      Parameters:
      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

      Returns:
      Returns a reference to this object so that method calls can be chained together.
      See Also:
    • instanceInitiatedShutdownBehavior

      RunInstancesRequest.Builder instanceInitiatedShutdownBehavior(ShutdownBehavior 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

      Parameters:
      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

      Returns:
      Returns a reference to this object so that method calls can be chained together.
      See Also:
    • networkInterfaces

      The network interfaces to associate with the instance. If you specify a network interface, you must specify any security groups and subnets as part of the network interface.

      Parameters:
      networkInterfaces - The network interfaces to associate with the instance. If you specify a network interface, you must specify any security groups and subnets as part of the network interface.
      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • networkInterfaces

      RunInstancesRequest.Builder networkInterfaces(InstanceNetworkInterfaceSpecification... networkInterfaces)

      The network interfaces to associate with the instance. If you specify a network interface, you must specify any security groups and subnets as part of the network interface.

      Parameters:
      networkInterfaces - The network interfaces to associate with the instance. If you specify a network interface, you must specify any security groups and subnets as part of the network interface.
      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • networkInterfaces

      The network interfaces to associate with the instance. If you specify a network interface, you must specify any security groups and subnets as part of the network interface.

      This is a convenience method that creates an instance of the InstanceNetworkInterfaceSpecification.Builder avoiding the need to create one manually via InstanceNetworkInterfaceSpecification.builder().

      When the Consumer completes, SdkBuilder.build() is called immediately and its result is passed to networkInterfaces(List<InstanceNetworkInterfaceSpecification>).

      Parameters:
      networkInterfaces - a consumer that will call methods on InstanceNetworkInterfaceSpecification.Builder
      Returns:
      Returns a reference to this object so that method calls can be chained together.
      See Also:
    • privateIpAddress

      RunInstancesRequest.Builder privateIpAddress(String privateIpAddress)

      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.

      You cannot specify this option and the network interfaces option in the same request.

      Parameters:
      privateIpAddress - 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.

      You cannot specify this option and the network interfaces option in the same request.

      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • elasticGpuSpecification

      RunInstancesRequest.Builder elasticGpuSpecification(Collection<ElasticGpuSpecification> elasticGpuSpecification)

      Deprecated.

      Amazon Elastic Graphics reached end of life on January 8, 2024. For workloads that require graphics acceleration, we recommend that you use Amazon EC2 G4ad, G4dn, or G5 instances.

      Parameters:
      elasticGpuSpecification - Deprecated.

      Amazon Elastic Graphics reached end of life on January 8, 2024. For workloads that require graphics acceleration, we recommend that you use Amazon EC2 G4ad, G4dn, or G5 instances.

      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • elasticGpuSpecification

      RunInstancesRequest.Builder elasticGpuSpecification(ElasticGpuSpecification... elasticGpuSpecification)

      Deprecated.

      Amazon Elastic Graphics reached end of life on January 8, 2024. For workloads that require graphics acceleration, we recommend that you use Amazon EC2 G4ad, G4dn, or G5 instances.

      Parameters:
      elasticGpuSpecification - Deprecated.

      Amazon Elastic Graphics reached end of life on January 8, 2024. For workloads that require graphics acceleration, we recommend that you use Amazon EC2 G4ad, G4dn, or G5 instances.

      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • elasticGpuSpecification

      RunInstancesRequest.Builder elasticGpuSpecification(Consumer<ElasticGpuSpecification.Builder>... elasticGpuSpecification)

      Deprecated.

      Amazon Elastic Graphics reached end of life on January 8, 2024. For workloads that require graphics acceleration, we recommend that you use Amazon EC2 G4ad, G4dn, or G5 instances.

      This is a convenience method that creates an instance of the ElasticGpuSpecification.Builder avoiding the need to create one manually via ElasticGpuSpecification.builder().

      When the Consumer completes, SdkBuilder.build() is called immediately and its result is passed to elasticGpuSpecification(List<ElasticGpuSpecification>).

      Parameters:
      elasticGpuSpecification - a consumer that will call methods on ElasticGpuSpecification.Builder
      Returns:
      Returns a reference to this object so that method calls can be chained together.
      See Also:
    • elasticInferenceAccelerators

      RunInstancesRequest.Builder elasticInferenceAccelerators(Collection<ElasticInferenceAccelerator> elasticInferenceAccelerators)

      An elastic inference accelerator to associate with the instance. Elastic inference accelerators are a resource you can attach to your Amazon EC2 instances to accelerate your Deep Learning (DL) inference workloads.

      You cannot specify accelerators from different generations in the same request.

      Starting April 15, 2023, Amazon Web Services will not onboard new customers to Amazon Elastic Inference (EI), and will help current customers migrate their workloads to options that offer better price and performance. After April 15, 2023, new customers will not be able to launch instances with Amazon EI accelerators in Amazon SageMaker, Amazon ECS, or Amazon EC2. However, customers who have used Amazon EI at least once during the past 30-day period are considered current customers and will be able to continue using the service.

      Parameters:
      elasticInferenceAccelerators - An elastic inference accelerator to associate with the instance. Elastic inference accelerators are a resource you can attach to your Amazon EC2 instances to accelerate your Deep Learning (DL) inference workloads.

      You cannot specify accelerators from different generations in the same request.

      Starting April 15, 2023, Amazon Web Services will not onboard new customers to Amazon Elastic Inference (EI), and will help current customers migrate their workloads to options that offer better price and performance. After April 15, 2023, new customers will not be able to launch instances with Amazon EI accelerators in Amazon SageMaker, Amazon ECS, or Amazon EC2. However, customers who have used Amazon EI at least once during the past 30-day period are considered current customers and will be able to continue using the service.

      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • elasticInferenceAccelerators

      RunInstancesRequest.Builder elasticInferenceAccelerators(ElasticInferenceAccelerator... elasticInferenceAccelerators)

      An elastic inference accelerator to associate with the instance. Elastic inference accelerators are a resource you can attach to your Amazon EC2 instances to accelerate your Deep Learning (DL) inference workloads.

      You cannot specify accelerators from different generations in the same request.

      Starting April 15, 2023, Amazon Web Services will not onboard new customers to Amazon Elastic Inference (EI), and will help current customers migrate their workloads to options that offer better price and performance. After April 15, 2023, new customers will not be able to launch instances with Amazon EI accelerators in Amazon SageMaker, Amazon ECS, or Amazon EC2. However, customers who have used Amazon EI at least once during the past 30-day period are considered current customers and will be able to continue using the service.

      Parameters:
      elasticInferenceAccelerators - An elastic inference accelerator to associate with the instance. Elastic inference accelerators are a resource you can attach to your Amazon EC2 instances to accelerate your Deep Learning (DL) inference workloads.

      You cannot specify accelerators from different generations in the same request.

      Starting April 15, 2023, Amazon Web Services will not onboard new customers to Amazon Elastic Inference (EI), and will help current customers migrate their workloads to options that offer better price and performance. After April 15, 2023, new customers will not be able to launch instances with Amazon EI accelerators in Amazon SageMaker, Amazon ECS, or Amazon EC2. However, customers who have used Amazon EI at least once during the past 30-day period are considered current customers and will be able to continue using the service.

      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • elasticInferenceAccelerators

      RunInstancesRequest.Builder elasticInferenceAccelerators(Consumer<ElasticInferenceAccelerator.Builder>... elasticInferenceAccelerators)

      An elastic inference accelerator to associate with the instance. Elastic inference accelerators are a resource you can attach to your Amazon EC2 instances to accelerate your Deep Learning (DL) inference workloads.

      You cannot specify accelerators from different generations in the same request.

      Starting April 15, 2023, Amazon Web Services will not onboard new customers to Amazon Elastic Inference (EI), and will help current customers migrate their workloads to options that offer better price and performance. After April 15, 2023, new customers will not be able to launch instances with Amazon EI accelerators in Amazon SageMaker, Amazon ECS, or Amazon EC2. However, customers who have used Amazon EI at least once during the past 30-day period are considered current customers and will be able to continue using the service.

      This is a convenience method that creates an instance of the ElasticInferenceAccelerator.Builder avoiding the need to create one manually via ElasticInferenceAccelerator.builder().

      When the Consumer completes, SdkBuilder.build() is called immediately and its result is passed to elasticInferenceAccelerators(List<ElasticInferenceAccelerator>).

      Parameters:
      elasticInferenceAccelerators - a consumer that will call methods on ElasticInferenceAccelerator.Builder
      Returns:
      Returns a reference to this object so that method calls can be chained together.
      See Also:
    • tagSpecifications

      RunInstancesRequest.Builder tagSpecifications(Collection<TagSpecification> tagSpecifications)

      The tags to apply to the resources that are created during instance launch.

      You can specify tags for the following resources only:

      • Instances

      • Volumes

      • Spot Instance requests

      • Network interfaces

      To tag a resource after it has been created, see CreateTags.

      Parameters:
      tagSpecifications - The tags to apply to the resources that are created during instance launch.

      You can specify tags for the following resources only:

      • Instances

      • Volumes

      • Spot Instance requests

      • Network interfaces

      To tag a resource after it has been created, see CreateTags.

      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • tagSpecifications

      RunInstancesRequest.Builder tagSpecifications(TagSpecification... tagSpecifications)

      The tags to apply to the resources that are created during instance launch.

      You can specify tags for the following resources only:

      • Instances

      • Volumes

      • Spot Instance requests

      • Network interfaces

      To tag a resource after it has been created, see CreateTags.

      Parameters:
      tagSpecifications - The tags to apply to the resources that are created during instance launch.

      You can specify tags for the following resources only:

      • Instances

      • Volumes

      • Spot Instance requests

      • Network interfaces

      To tag a resource after it has been created, see CreateTags.

      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • tagSpecifications

      RunInstancesRequest.Builder tagSpecifications(Consumer<TagSpecification.Builder>... tagSpecifications)

      The tags to apply to the resources that are created during instance launch.

      You can specify tags for the following resources only:

      • Instances

      • Volumes

      • Spot Instance requests

      • Network interfaces

      To tag a resource after it has been created, see CreateTags.

      This is a convenience method that creates an instance of the TagSpecification.Builder avoiding the need to create one manually via TagSpecification.builder().

      When the Consumer completes, SdkBuilder.build() is called immediately and its result is passed to tagSpecifications(List<TagSpecification>).

      Parameters:
      tagSpecifications - a consumer that will call methods on TagSpecification.Builder
      Returns:
      Returns a reference to this object so that method calls can be chained together.
      See Also:
    • launchTemplate

      The launch template to use to launch the instances. Any parameters that you specify in RunInstances override the same parameters in the launch template. You can specify either the name or ID of a launch template, but not both.

      Parameters:
      launchTemplate - The launch template to use to launch the instances. Any parameters that you specify in RunInstances override the same parameters in the launch template. You can specify either the name or ID of a launch template, but not both.
      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • launchTemplate

      The launch template to use to launch the instances. Any parameters that you specify in RunInstances override the same parameters in the launch template. You can specify either the name or ID of a launch template, but not both.

      This is a convenience method that creates an instance of the LaunchTemplateSpecification.Builder avoiding the need to create one manually via LaunchTemplateSpecification.builder().

      When the Consumer completes, SdkBuilder.build() is called immediately and its result is passed to launchTemplate(LaunchTemplateSpecification).

      Parameters:
      launchTemplate - a consumer that will call methods on LaunchTemplateSpecification.Builder
      Returns:
      Returns a reference to this object so that method calls can be chained together.
      See Also:
    • instanceMarketOptions

      RunInstancesRequest.Builder instanceMarketOptions(InstanceMarketOptionsRequest instanceMarketOptions)

      The market (purchasing) option for the instances.

      For RunInstances, persistent Spot Instance requests are only supported when InstanceInterruptionBehavior is set to either hibernate or stop.

      Parameters:
      instanceMarketOptions - The market (purchasing) option for the instances.

      For RunInstances, persistent Spot Instance requests are only supported when InstanceInterruptionBehavior is set to either hibernate or stop.

      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • instanceMarketOptions

      default RunInstancesRequest.Builder instanceMarketOptions(Consumer<InstanceMarketOptionsRequest.Builder> instanceMarketOptions)

      The market (purchasing) option for the instances.

      For RunInstances, persistent Spot Instance requests are only supported when InstanceInterruptionBehavior is set to either hibernate or stop.

      This is a convenience method that creates an instance of the InstanceMarketOptionsRequest.Builder avoiding the need to create one manually via InstanceMarketOptionsRequest.builder().

      When the Consumer completes, SdkBuilder.build() is called immediately and its result is passed to instanceMarketOptions(InstanceMarketOptionsRequest).

      Parameters:
      instanceMarketOptions - a consumer that will call methods on InstanceMarketOptionsRequest.Builder
      Returns:
      Returns a reference to this object so that method calls can be chained together.
      See Also:
    • creditSpecification

      RunInstancesRequest.Builder creditSpecification(CreditSpecificationRequest creditSpecification)

      The credit option for CPU usage of the burstable performance instance. Valid values are standard and unlimited. To change this attribute after launch, use ModifyInstanceCreditSpecification. For more information, see Burstable performance instances in the Amazon EC2 User Guide.

      Default: standard (T2 instances) or unlimited (T3/T3a/T4g instances)

      For T3 instances with host tenancy, only standard is supported.

      Parameters:
      creditSpecification - The credit option for CPU usage of the burstable performance instance. Valid values are standard and unlimited. To change this attribute after launch, use ModifyInstanceCreditSpecification. For more information, see Burstable performance instances in the Amazon EC2 User Guide.

      Default: standard (T2 instances) or unlimited (T3/T3a/T4g instances)

      For T3 instances with host tenancy, only standard is supported.

      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • creditSpecification

      default RunInstancesRequest.Builder creditSpecification(Consumer<CreditSpecificationRequest.Builder> creditSpecification)

      The credit option for CPU usage of the burstable performance instance. Valid values are standard and unlimited. To change this attribute after launch, use ModifyInstanceCreditSpecification. For more information, see Burstable performance instances in the Amazon EC2 User Guide.

      Default: standard (T2 instances) or unlimited (T3/T3a/T4g instances)

      For T3 instances with host tenancy, only standard is supported.

      This is a convenience method that creates an instance of the CreditSpecificationRequest.Builder avoiding the need to create one manually via CreditSpecificationRequest.builder().

      When the Consumer completes, SdkBuilder.build() is called immediately and its result is passed to creditSpecification(CreditSpecificationRequest).

      Parameters:
      creditSpecification - a consumer that will call methods on CreditSpecificationRequest.Builder
      Returns:
      Returns a reference to this object so that method calls can be chained together.
      See Also:
    • cpuOptions

      The CPU options for the instance. For more information, see Optimize CPU options in the Amazon EC2 User Guide.

      Parameters:
      cpuOptions - The CPU options for the instance. For more information, see Optimize CPU options in the Amazon EC2 User Guide.
      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • cpuOptions

      The CPU options for the instance. For more information, see Optimize CPU options in the Amazon EC2 User Guide.

      This is a convenience method that creates an instance of the CpuOptionsRequest.Builder avoiding the need to create one manually via CpuOptionsRequest.builder().

      When the Consumer completes, SdkBuilder.build() is called immediately and its result is passed to cpuOptions(CpuOptionsRequest).

      Parameters:
      cpuOptions - a consumer that will call methods on CpuOptionsRequest.Builder
      Returns:
      Returns a reference to this object so that method calls can be chained together.
      See Also:
    • capacityReservationSpecification

      RunInstancesRequest.Builder capacityReservationSpecification(CapacityReservationSpecification capacityReservationSpecification)

      Information about the Capacity Reservation targeting option. If you do not specify this parameter, the instance's Capacity Reservation preference defaults to open, which enables it to run in any open Capacity Reservation that has matching attributes (instance type, platform, Availability Zone).

      Parameters:
      capacityReservationSpecification - Information about the Capacity Reservation targeting option. If you do not specify this parameter, the instance's Capacity Reservation preference defaults to open, which enables it to run in any open Capacity Reservation that has matching attributes (instance type, platform, Availability Zone).
      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • capacityReservationSpecification

      default RunInstancesRequest.Builder capacityReservationSpecification(Consumer<CapacityReservationSpecification.Builder> capacityReservationSpecification)

      Information about the Capacity Reservation targeting option. If you do not specify this parameter, the instance's Capacity Reservation preference defaults to open, which enables it to run in any open Capacity Reservation that has matching attributes (instance type, platform, Availability Zone).

      This is a convenience method that creates an instance of the CapacityReservationSpecification.Builder avoiding the need to create one manually via CapacityReservationSpecification.builder().

      When the Consumer completes, SdkBuilder.build() is called immediately and its result is passed to capacityReservationSpecification(CapacityReservationSpecification).

      Parameters:
      capacityReservationSpecification - a consumer that will call methods on CapacityReservationSpecification.Builder
      Returns:
      Returns a reference to this object so that method calls can be chained together.
      See Also:
    • hibernationOptions

      RunInstancesRequest.Builder hibernationOptions(HibernationOptionsRequest hibernationOptions)

      Indicates whether an instance is enabled for hibernation. This parameter is valid only if the instance meets the hibernation prerequisites. For more information, see Hibernate your instance in the Amazon EC2 User Guide.

      You can't enable hibernation and Amazon Web Services Nitro Enclaves on the same instance.

      Parameters:
      hibernationOptions - Indicates whether an instance is enabled for hibernation. This parameter is valid only if the instance meets the hibernation prerequisites. For more information, see Hibernate your instance in the Amazon EC2 User Guide.

      You can't enable hibernation and Amazon Web Services Nitro Enclaves on the same instance.

      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • hibernationOptions

      default RunInstancesRequest.Builder hibernationOptions(Consumer<HibernationOptionsRequest.Builder> hibernationOptions)

      Indicates whether an instance is enabled for hibernation. This parameter is valid only if the instance meets the hibernation prerequisites. For more information, see Hibernate your instance in the Amazon EC2 User Guide.

      You can't enable hibernation and Amazon Web Services Nitro Enclaves on the same instance.

      This is a convenience method that creates an instance of the HibernationOptionsRequest.Builder avoiding the need to create one manually via HibernationOptionsRequest.builder().

      When the Consumer completes, SdkBuilder.build() is called immediately and its result is passed to hibernationOptions(HibernationOptionsRequest).

      Parameters:
      hibernationOptions - a consumer that will call methods on HibernationOptionsRequest.Builder
      Returns:
      Returns a reference to this object so that method calls can be chained together.
      See Also:
    • licenseSpecifications

      RunInstancesRequest.Builder licenseSpecifications(Collection<LicenseConfigurationRequest> licenseSpecifications)

      The license configurations.

      Parameters:
      licenseSpecifications - The license configurations.
      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • licenseSpecifications

      RunInstancesRequest.Builder licenseSpecifications(LicenseConfigurationRequest... licenseSpecifications)

      The license configurations.

      Parameters:
      licenseSpecifications - The license configurations.
      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • licenseSpecifications

      RunInstancesRequest.Builder licenseSpecifications(Consumer<LicenseConfigurationRequest.Builder>... licenseSpecifications)

      The license configurations.

      This is a convenience method that creates an instance of the LicenseConfigurationRequest.Builder avoiding the need to create one manually via LicenseConfigurationRequest.builder().

      When the Consumer completes, SdkBuilder.build() is called immediately and its result is passed to licenseSpecifications(List<LicenseConfigurationRequest>).

      Parameters:
      licenseSpecifications - a consumer that will call methods on LicenseConfigurationRequest.Builder
      Returns:
      Returns a reference to this object so that method calls can be chained together.
      See Also:
    • metadataOptions

      The metadata options for the instance. For more information, see Instance metadata and user data.

      Parameters:
      metadataOptions - The metadata options for the instance. For more information, see Instance metadata and user data.
      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • metadataOptions

      The metadata options for the instance. For more information, see Instance metadata and user data.

      This is a convenience method that creates an instance of the InstanceMetadataOptionsRequest.Builder avoiding the need to create one manually via InstanceMetadataOptionsRequest.builder().

      When the Consumer completes, SdkBuilder.build() is called immediately and its result is passed to metadataOptions(InstanceMetadataOptionsRequest).

      Parameters:
      metadataOptions - a consumer that will call methods on InstanceMetadataOptionsRequest.Builder
      Returns:
      Returns a reference to this object so that method calls can be chained together.
      See Also:
    • enclaveOptions

      RunInstancesRequest.Builder enclaveOptions(EnclaveOptionsRequest enclaveOptions)

      Indicates whether the instance is enabled for Amazon Web Services Nitro Enclaves. For more information, see What is Amazon Web Services Nitro Enclaves? in the Amazon Web Services Nitro Enclaves User Guide.

      You can't enable Amazon Web Services Nitro Enclaves and hibernation on the same instance.

      Parameters:
      enclaveOptions - Indicates whether the instance is enabled for Amazon Web Services Nitro Enclaves. For more information, see What is Amazon Web Services Nitro Enclaves? in the Amazon Web Services Nitro Enclaves User Guide.

      You can't enable Amazon Web Services Nitro Enclaves and hibernation on the same instance.

      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • enclaveOptions

      default RunInstancesRequest.Builder enclaveOptions(Consumer<EnclaveOptionsRequest.Builder> enclaveOptions)

      Indicates whether the instance is enabled for Amazon Web Services Nitro Enclaves. For more information, see What is Amazon Web Services Nitro Enclaves? in the Amazon Web Services Nitro Enclaves User Guide.

      You can't enable Amazon Web Services Nitro Enclaves and hibernation on the same instance.

      This is a convenience method that creates an instance of the EnclaveOptionsRequest.Builder avoiding the need to create one manually via EnclaveOptionsRequest.builder().

      When the Consumer completes, SdkBuilder.build() is called immediately and its result is passed to enclaveOptions(EnclaveOptionsRequest).

      Parameters:
      enclaveOptions - a consumer that will call methods on EnclaveOptionsRequest.Builder
      Returns:
      Returns a reference to this object so that method calls can be chained together.
      See Also:
    • privateDnsNameOptions

      RunInstancesRequest.Builder privateDnsNameOptions(PrivateDnsNameOptionsRequest privateDnsNameOptions)

      The options for the instance hostname. The default values are inherited from the subnet. Applies only if creating a network interface, not attaching an existing one.

      Parameters:
      privateDnsNameOptions - The options for the instance hostname. The default values are inherited from the subnet. Applies only if creating a network interface, not attaching an existing one.
      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • privateDnsNameOptions

      default RunInstancesRequest.Builder privateDnsNameOptions(Consumer<PrivateDnsNameOptionsRequest.Builder> privateDnsNameOptions)

      The options for the instance hostname. The default values are inherited from the subnet. Applies only if creating a network interface, not attaching an existing one.

      This is a convenience method that creates an instance of the PrivateDnsNameOptionsRequest.Builder avoiding the need to create one manually via PrivateDnsNameOptionsRequest.builder().

      When the Consumer completes, SdkBuilder.build() is called immediately and its result is passed to privateDnsNameOptions(PrivateDnsNameOptionsRequest).

      Parameters:
      privateDnsNameOptions - a consumer that will call methods on PrivateDnsNameOptionsRequest.Builder
      Returns:
      Returns a reference to this object so that method calls can be chained together.
      See Also:
    • maintenanceOptions

      RunInstancesRequest.Builder maintenanceOptions(InstanceMaintenanceOptionsRequest maintenanceOptions)

      The maintenance and recovery options for the instance.

      Parameters:
      maintenanceOptions - The maintenance and recovery options for the instance.
      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • maintenanceOptions

      default RunInstancesRequest.Builder maintenanceOptions(Consumer<InstanceMaintenanceOptionsRequest.Builder> maintenanceOptions)

      The maintenance and recovery options for the instance.

      This is a convenience method that creates an instance of the InstanceMaintenanceOptionsRequest.Builder avoiding the need to create one manually via InstanceMaintenanceOptionsRequest.builder().

      When the Consumer completes, SdkBuilder.build() is called immediately and its result is passed to maintenanceOptions(InstanceMaintenanceOptionsRequest).

      Parameters:
      maintenanceOptions - a consumer that will call methods on InstanceMaintenanceOptionsRequest.Builder
      Returns:
      Returns a reference to this object so that method calls can be chained together.
      See Also:
    • disableApiStop

      RunInstancesRequest.Builder disableApiStop(Boolean disableApiStop)

      Indicates whether an instance is enabled for stop protection. For more information, see Stop protection.

      Parameters:
      disableApiStop - Indicates whether an instance is enabled for stop protection. For more information, see Stop protection.
      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • enablePrimaryIpv6

      RunInstancesRequest.Builder enablePrimaryIpv6(Boolean enablePrimaryIpv6)

      If you’re launching an instance into a dual-stack or IPv6-only subnet, you can enable assigning a primary IPv6 address. A primary IPv6 address is an IPv6 GUA address associated with an ENI that you have enabled to use a primary IPv6 address. Use this option if an instance relies on its IPv6 address not changing. When you launch the instance, Amazon Web Services will automatically assign an IPv6 address associated with the ENI attached to your instance to be the primary IPv6 address. Once you enable an IPv6 GUA address to be a primary IPv6, you cannot disable it. When you enable an IPv6 GUA address to be a primary IPv6, the first IPv6 GUA will be made the primary IPv6 address until the instance is terminated or the network interface is detached. If you have multiple IPv6 addresses associated with an ENI attached to your instance and you enable a primary IPv6 address, the first IPv6 GUA address associated with the ENI becomes the primary IPv6 address.

      Parameters:
      enablePrimaryIpv6 - If you’re launching an instance into a dual-stack or IPv6-only subnet, you can enable assigning a primary IPv6 address. A primary IPv6 address is an IPv6 GUA address associated with an ENI that you have enabled to use a primary IPv6 address. Use this option if an instance relies on its IPv6 address not changing. When you launch the instance, Amazon Web Services will automatically assign an IPv6 address associated with the ENI attached to your instance to be the primary IPv6 address. Once you enable an IPv6 GUA address to be a primary IPv6, you cannot disable it. When you enable an IPv6 GUA address to be a primary IPv6, the first IPv6 GUA will be made the primary IPv6 address until the instance is terminated or the network interface is detached. If you have multiple IPv6 addresses associated with an ENI attached to your instance and you enable a primary IPv6 address, the first IPv6 GUA address associated with the ENI becomes the primary IPv6 address.
      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • overrideConfiguration

      RunInstancesRequest.Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration)
      Description copied from interface: AwsRequest.Builder
      Add an optional request override configuration.
      Specified by:
      overrideConfiguration in interface AwsRequest.Builder
      Parameters:
      overrideConfiguration - The override configuration.
      Returns:
      This object for method chaining.
    • overrideConfiguration

      Description copied from interface: AwsRequest.Builder
      Add an optional request override configuration.
      Specified by:
      overrideConfiguration in interface AwsRequest.Builder
      Parameters:
      builderConsumer - A Consumer to which an empty AwsRequestOverrideConfiguration.Builder will be given.
      Returns:
      This object for method chaining.