Interface RunInstancesRequest.Builder

    • Method Detail

      • 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.
      • imageId

        RunInstancesRequest.Builder imageId​(String 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.
      • 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

        RunInstancesRequest.Builder ipv6Addresses​(Collection<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

        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

        RunInstancesRequest.Builder ipv6Addresses​(Consumer<InstanceIpv6Address.Builder>... 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).

        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:
        #ipv6Addresses(java.util.Collection)
      • 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

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

        RunInstancesRequest.Builder maxCount​(Integer 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

        RunInstancesRequest.Builder minCount​(Integer 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

        RunInstancesRequest.Builder monitoring​(RunInstancesMonitoringEnabled 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.
      • 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.
      • 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.
      • 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

        RunInstancesRequest.Builder dryRun​(Boolean 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.
      • 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:
        ShutdownBehavior, ShutdownBehavior
      • 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:
        ShutdownBehavior, ShutdownBehavior
      • networkInterfaces

        RunInstancesRequest.Builder networkInterfaces​(Collection<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

        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.
      • 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.
      • 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).

        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:
        #elasticInferenceAccelerators(java.util.Collection)
      • 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).

        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:
        #tagSpecifications(java.util.Collection)
      • launchTemplate

        RunInstancesRequest.Builder launchTemplate​(LaunchTemplateSpecification 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.
      • 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.
      • 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.
      • cpuOptions

        RunInstancesRequest.Builder cpuOptions​(CpuOptionsRequest 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.
      • 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.
      • 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.
      • 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.
      • 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.
      • 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.
      • 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.
      • 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.