@Generated(value="software.amazon.awssdk:codegen") public final class RunInstancesRequest extends Ec2Request implements ToCopyableBuilder<RunInstancesRequest.Builder,RunInstancesRequest>
| Modifier and Type | Class and Description |
|---|---|
static interface |
RunInstancesRequest.Builder |
| Modifier and Type | Method and Description |
|---|---|
String |
additionalInfo()
Reserved.
|
List<BlockDeviceMapping> |
blockDeviceMappings()
The block device mapping, which defines the EBS volumes and instance store volumes to attach to the instance at
launch.
|
static RunInstancesRequest.Builder |
builder() |
CapacityReservationSpecification |
capacityReservationSpecification()
Information about the Capacity Reservation targeting option.
|
String |
clientToken()
Unique, case-sensitive identifier you provide to ensure the idempotency of the request.
|
CpuOptionsRequest |
cpuOptions()
The CPU options for the instance.
|
CreditSpecificationRequest |
creditSpecification()
The credit option for CPU usage of the burstable performance instance.
|
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. |
Boolean |
ebsOptimized()
Indicates whether the instance is optimized for Amazon EBS I/O.
|
List<ElasticGpuSpecification> |
elasticGpuSpecification()
An elastic GPU to associate with the instance.
|
List<ElasticInferenceAccelerator> |
elasticInferenceAccelerators()
An elastic inference accelerator to associate with the instance.
|
EnclaveOptionsRequest |
enclaveOptions()
Indicates whether the instance is enabled for Amazon Web Services Nitro Enclaves.
|
boolean |
equals(Object obj) |
boolean |
equalsBySdkFields(Object obj) |
<T> Optional<T> |
getValueForField(String fieldName,
Class<T> clazz) |
boolean |
hasBlockDeviceMappings()
For responses, this returns true if the service returned a value for the BlockDeviceMappings property.
|
boolean |
hasElasticGpuSpecification()
For responses, this returns true if the service returned a value for the ElasticGpuSpecification property.
|
boolean |
hasElasticInferenceAccelerators()
For responses, this returns true if the service returned a value for the ElasticInferenceAccelerators property.
|
int |
hashCode() |
boolean |
hasIpv6Addresses()
For responses, this returns true if the service returned a value for the Ipv6Addresses property.
|
boolean |
hasLicenseSpecifications()
For responses, this returns true if the service returned a value for the LicenseSpecifications property.
|
boolean |
hasNetworkInterfaces()
For responses, this returns true if the service returned a value for the NetworkInterfaces property.
|
boolean |
hasSecurityGroupIds()
For responses, this returns true if the service returned a value for the SecurityGroupIds property.
|
boolean |
hasSecurityGroups()
For responses, this returns true if the service returned a value for the SecurityGroups property.
|
boolean |
hasTagSpecifications()
For responses, this returns true if the service returned a value for the TagSpecifications property.
|
HibernationOptionsRequest |
hibernationOptions()
Indicates whether an instance is enabled for hibernation.
|
IamInstanceProfileSpecification |
iamInstanceProfile()
The name or Amazon Resource Name (ARN) of an IAM instance profile.
|
String |
imageId()
The ID of the AMI.
|
ShutdownBehavior |
instanceInitiatedShutdownBehavior()
Indicates whether an instance stops or terminates when you initiate shutdown from the instance (using the
operating system command for system shutdown).
|
String |
instanceInitiatedShutdownBehaviorAsString()
Indicates whether an instance stops or terminates when you initiate shutdown from the instance (using the
operating system command for system shutdown).
|
InstanceMarketOptionsRequest |
instanceMarketOptions()
The market (purchasing) option for the instances.
|
InstanceType |
instanceType()
The instance type.
|
String |
instanceTypeAsString()
The instance type.
|
Integer |
ipv6AddressCount()
[EC2-VPC] The number of IPv6 addresses to associate with the primary network interface.
|
List<InstanceIpv6Address> |
ipv6Addresses()
[EC2-VPC] The IPv6 addresses from the range of the subnet to associate with the primary network interface.
|
String |
kernelId()
The ID of the kernel.
|
String |
keyName()
The name of the key pair.
|
LaunchTemplateSpecification |
launchTemplate()
The launch template to use to launch the instances.
|
List<LicenseConfigurationRequest> |
licenseSpecifications()
The license configurations.
|
InstanceMaintenanceOptionsRequest |
maintenanceOptions()
The maintenance and recovery options for the instance.
|
Integer |
maxCount()
The maximum number of instances to launch.
|
InstanceMetadataOptionsRequest |
metadataOptions()
The metadata options for the instance.
|
Integer |
minCount()
The minimum number of instances to launch.
|
RunInstancesMonitoringEnabled |
monitoring()
Specifies whether detailed monitoring is enabled for the instance.
|
List<InstanceNetworkInterfaceSpecification> |
networkInterfaces()
The network interfaces to associate with the instance.
|
Placement |
placement()
The placement for the instance.
|
PrivateDnsNameOptionsRequest |
privateDnsNameOptions()
The options for the instance hostname.
|
String |
privateIpAddress()
[EC2-VPC] The primary IPv4 address.
|
String |
ramdiskId()
The ID of the RAM disk to select.
|
List<SdkField<?>> |
sdkFields() |
List<String> |
securityGroupIds()
The IDs of the security groups.
|
List<String> |
securityGroups()
[EC2-Classic, default VPC] The names of the security groups.
|
static Class<? extends RunInstancesRequest.Builder> |
serializableBuilderClass() |
String |
subnetId()
[EC2-VPC] The ID of the subnet to launch the instance into.
|
List<TagSpecification> |
tagSpecifications()
The tags to apply to the resources during launch.
|
RunInstancesRequest.Builder |
toBuilder() |
String |
toString()
Returns a string representation of this object.
|
String |
userData()
The user data to make available to the instance.
|
overrideConfigurationclone, finalize, getClass, notify, notifyAll, wait, wait, waitcopypublic final boolean hasBlockDeviceMappings()
isEmpty() method on the property).
This is useful because the SDK will never return a null collection or map, but you may need to differentiate
between the service returning nothing (or null) and the service returning an empty collection or map. For
requests, this returns true if a value for the property was specified in the request builder, and false if a
value was not specified.public final List<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.
Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
This method will never return null. If you would like to know whether the service returned this field (so that
you can differentiate between null and empty), you can use the hasBlockDeviceMappings() method.
public final 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.
public final InstanceType instanceType()
The instance type. For more information, see Instance types in the Amazon EC2 User Guide.
Default: m1.small
If the service returns an enum value that is not available in the current SDK version, instanceType will
return InstanceType.UNKNOWN_TO_SDK_VERSION. The raw value returned by the service is available from
instanceTypeAsString().
Default: m1.small
InstanceTypepublic final String instanceTypeAsString()
The instance type. For more information, see Instance types in the Amazon EC2 User Guide.
Default: m1.small
If the service returns an enum value that is not available in the current SDK version, instanceType will
return InstanceType.UNKNOWN_TO_SDK_VERSION. The raw value returned by the service is available from
instanceTypeAsString().
Default: m1.small
InstanceTypepublic final Integer ipv6AddressCount()
[EC2-VPC] 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.
You cannot specify this option and the network interfaces option in the same request.
public final boolean hasIpv6Addresses()
isEmpty() method on the property).
This is useful because the SDK will never return a null collection or map, but you may need to differentiate
between the service returning nothing (or null) and the service returning an empty collection or map. For
requests, this returns true if a value for the property was specified in the request builder, and false if a
value was not specified.public final List<InstanceIpv6Address> ipv6Addresses()
[EC2-VPC] 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.
Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
This method will never return null. If you would like to know whether the service returned this field (so that
you can differentiate between null and empty), you can use the hasIpv6Addresses() method.
You cannot specify this option and the network interfaces option in the same request.
public final 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.
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.
public final 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.
If you do not specify a key pair, you can't connect to the instance unless you choose an AMI that is configured to allow users another way to log in.
public final 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.
MinCount.
Constraints: Between 1 and the maximum number you're allowed for the specified instance type. For more information about the default limits, and how to request an increase, see How many instances can I run in Amazon EC2 in the Amazon EC2 FAQ.
public final 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.
Constraints: Between 1 and the maximum number you're allowed for the specified instance type. For more information about the default limits, and how to request an increase, see How many instances can I run in Amazon EC2 in the Amazon EC2 General FAQ.
public final RunInstancesMonitoringEnabled monitoring()
Specifies whether detailed monitoring is enabled for the instance.
public final Placement placement()
The placement for the instance.
public final 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.
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.
public final boolean hasSecurityGroupIds()
isEmpty() method on the property).
This is useful because the SDK will never return a null collection or map, but you may need to differentiate
between the service returning nothing (or null) and the service returning an empty collection or map. For
requests, this returns true if a value for the property was specified in the request builder, and false if a
value was not specified.public final List<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.
Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
This method will never return null. If you would like to know whether the service returned this field (so that
you can differentiate between null and empty), you can use the hasSecurityGroupIds() method.
If you specify a network interface, you must specify any security groups as part of the network interface.
public final boolean hasSecurityGroups()
isEmpty() method on the property).
This is useful because the SDK will never return a null collection or map, but you may need to differentiate
between the service returning nothing (or null) and the service returning an empty collection or map. For
requests, this returns true if a value for the property was specified in the request builder, and false if a
value was not specified.public final List<String> securityGroups()
[EC2-Classic, default VPC] The names of the security groups. For a nondefault VPC, you must use security group IDs instead.
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.
Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
This method will never return null. If you would like to know whether the service returned this field (so that
you can differentiate between null and empty), you can use the hasSecurityGroups() method.
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.
public final String subnetId()
[EC2-VPC] 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.
If you specify a network interface, you must specify any subnets as part of the network interface.
public final String userData()
The user data 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.
public final String additionalInfo()
Reserved.
public final 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
For more information, see Ensuring Idempotency.
Constraints: Maximum 64 ASCII characters
public final 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
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
public final 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
Default: false
public final IamInstanceProfileSpecification iamInstanceProfile()
The name or Amazon Resource Name (ARN) of an IAM instance profile.
public final 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
If the service returns an enum value that is not available in the current SDK version,
instanceInitiatedShutdownBehavior will return ShutdownBehavior.UNKNOWN_TO_SDK_VERSION. The raw
value returned by the service is available from instanceInitiatedShutdownBehaviorAsString().
Default: stop
ShutdownBehaviorpublic final String instanceInitiatedShutdownBehaviorAsString()
Indicates whether an instance stops or terminates when you initiate shutdown from the instance (using the operating system command for system shutdown).
Default: stop
If the service returns an enum value that is not available in the current SDK version,
instanceInitiatedShutdownBehavior will return ShutdownBehavior.UNKNOWN_TO_SDK_VERSION. The raw
value returned by the service is available from instanceInitiatedShutdownBehaviorAsString().
Default: stop
ShutdownBehaviorpublic final boolean hasNetworkInterfaces()
isEmpty() method on the property).
This is useful because the SDK will never return a null collection or map, but you may need to differentiate
between the service returning nothing (or null) and the service returning an empty collection or map. For
requests, this returns true if a value for the property was specified in the request builder, and false if a
value was not specified.public final List<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.
Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
This method will never return null. If you would like to know whether the service returned this field (so that
you can differentiate between null and empty), you can use the hasNetworkInterfaces() method.
public final String privateIpAddress()
[EC2-VPC] The primary IPv4 address. You must specify a value from the IPv4 address range of the subnet.
Only one private IP address can be designated as primary. You can't specify this option if you've specified the option to designate a private IP address as the primary IP address in a network interface specification. You cannot specify this option if you're launching more than one instance in the request.
You cannot specify this option and the network interfaces option in the same request.
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.
public final boolean hasElasticGpuSpecification()
isEmpty() method on the
property). This is useful because the SDK will never return a null collection or map, but you may need to
differentiate between the service returning nothing (or null) and the service returning an empty collection or
map. For requests, this returns true if a value for the property was specified in the request builder, and false
if a value was not specified.public final List<ElasticGpuSpecification> elasticGpuSpecification()
An elastic GPU to associate with the instance. An Elastic GPU is a GPU resource that you can attach to your Windows instance to accelerate the graphics performance of your applications. For more information, see Amazon EC2 Elastic GPUs in the Amazon EC2 User Guide.
Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
This method will never return null. If you would like to know whether the service returned this field (so that
you can differentiate between null and empty), you can use the hasElasticGpuSpecification() method.
public final boolean hasElasticInferenceAccelerators()
isEmpty() method on the
property). This is useful because the SDK will never return a null collection or map, but you may need to
differentiate between the service returning nothing (or null) and the service returning an empty collection or
map. For requests, this returns true if a value for the property was specified in the request builder, and false
if a value was not specified.public final List<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.
Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
This method will never return null. If you would like to know whether the service returned this field (so that
you can differentiate between null and empty), you can use the hasElasticInferenceAccelerators() method.
You cannot specify accelerators from different generations in the same request.
public final boolean hasTagSpecifications()
isEmpty() method on the property).
This is useful because the SDK will never return a null collection or map, but you may need to differentiate
between the service returning nothing (or null) and the service returning an empty collection or map. For
requests, this returns true if a value for the property was specified in the request builder, and false if a
value was not specified.public final List<TagSpecification> tagSpecifications()
The tags to apply to the resources during launch. You can only tag instances and volumes on launch. The specified tags are applied to all instances or volumes that are created during launch. To tag a resource after it has been created, see CreateTags.
Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
This method will never return null. If you would like to know whether the service returned this field (so that
you can differentiate between null and empty), you can use the hasTagSpecifications() method.
public final 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.
public final 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.
For RunInstances, persistent Spot Instance requests are only supported when
InstanceInterruptionBehavior is set to either hibernate or stop.
public final 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 instances)
For T3 instances with host tenancy, only standard is supported.
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 instances)
For T3 instances with host tenancy, only standard is supported.
public final CpuOptionsRequest cpuOptions()
The CPU options for the instance. For more information, see Optimize CPU options in the Amazon EC2 User Guide.
public final 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).
open, which enables it to run in any
open Capacity Reservation that has matching attributes (instance type, platform, Availability Zone).public final HibernationOptionsRequest hibernationOptions()
Indicates whether an instance is enabled for hibernation. 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.
You can't enable hibernation and Amazon Web Services Nitro Enclaves on the same instance.
public final boolean hasLicenseSpecifications()
isEmpty() method on the
property). This is useful because the SDK will never return a null collection or map, but you may need to
differentiate between the service returning nothing (or null) and the service returning an empty collection or
map. For requests, this returns true if a value for the property was specified in the request builder, and false
if a value was not specified.public final List<LicenseConfigurationRequest> licenseSpecifications()
The license configurations.
Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
This method will never return null. If you would like to know whether the service returned this field (so that
you can differentiate between null and empty), you can use the hasLicenseSpecifications() method.
public final InstanceMetadataOptionsRequest metadataOptions()
The metadata options for the instance. For more information, see Instance metadata and user data.
public final 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.
You can't enable Amazon Web Services Nitro Enclaves and hibernation on the same instance.
public final PrivateDnsNameOptionsRequest privateDnsNameOptions()
The options for the instance hostname. The default values are inherited from the subnet.
public final InstanceMaintenanceOptionsRequest maintenanceOptions()
The maintenance and recovery options for the instance.
public RunInstancesRequest.Builder toBuilder()
toBuilder in interface ToCopyableBuilder<RunInstancesRequest.Builder,RunInstancesRequest>toBuilder in class Ec2Requestpublic static RunInstancesRequest.Builder builder()
public static Class<? extends RunInstancesRequest.Builder> serializableBuilderClass()
public final int hashCode()
hashCode in class AwsRequestpublic final boolean equals(Object obj)
equals in class AwsRequestpublic final boolean equalsBySdkFields(Object obj)
equalsBySdkFields in interface SdkPojopublic final String toString()
public final <T> Optional<T> getValueForField(String fieldName, Class<T> clazz)
getValueForField in class SdkRequestCopyright © 2022. All rights reserved.