/* * Copyright 2010-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ package com.amazonaws.services.ec2.model; import java.io.Serializable; import com.amazonaws.AmazonWebServiceRequest; import com.amazonaws.Request; import com.amazonaws.services.ec2.model.transform.RunInstancesRequestMarshaller; /** * Container for the parameters to the {@link com.amazonaws.services.ec2.AmazonEC2#runInstances(RunInstancesRequest) RunInstances operation}. *
* Launches the specified number of instances using an AMI for which you * have permissions. *
*
* When you launch an instance, it enters the pending
state.
* After the instance is ready for you, it enters the
* running
state. To check the state of your instance, call
* DescribeInstances.
*
* To ensure faster instance launches, break up large requests into * smaller batches. For example, create five separate launch requests for * 100 instances each instead of one launch request for 500 instances. *
*
* To tag your instance, ensure that it is running
as
* CreateTags requires a resource ID. For more information about tagging,
* see
* Tagging Your Amazon EC2 Resources
* .
*
* If you don't specify a security group when launching an instance, * Amazon EC2 uses the default security group. For more information, see * Security Groups * in the Amazon Elastic Compute Cloud User Guide . *
** [EC2-VPC only accounts] If you don't specify a subnet in the request, * we choose a default subnet from your default VPC for you. *
** [EC2-Classic accounts] If you're launching into EC2-Classic and you * don't specify an Availability Zone, we choose one for you. *
** Linux instances have access to the public key of the key pair at boot. * You can use this key to provide secure access to the instance. Amazon * EC2 public images use this feature to provide secure access without * passwords. For more information, see * Key Pairs * in the Amazon Elastic Compute Cloud User Guide . *
** You can provide optional user data when launching an instance. For * more information, see * Instance Metadata * in the Amazon Elastic Compute Cloud User Guide . *
*
* If any of the AMIs have a product code attached for which the user has
* not subscribed, RunInstances
fails.
*
* Some instance types can only be launched into a VPC. If you do not
* have a default VPC, or if you do not specify a subnet ID in the
* request, RunInstances
fails. For more information, see
* Instance Types Available Only in a VPC
* .
*
* For more information about troubleshooting, see * What To Do If An Instance Immediately Terminates , and Troubleshooting Connecting to Your Instance * in the Amazon Elastic Compute Cloud User Guide . *
* * @see com.amazonaws.services.ec2.AmazonEC2#runInstances(RunInstancesRequest) */ public class RunInstancesRequest extends AmazonWebServiceRequest implements Serializable, DryRunSupportedRequestConstraints:
* 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.
*/
private Integer minCount;
/**
* 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.
*/
private Integer maxCount;
/**
* 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.
*
Default:
* Amazon EC2 uses the default security group.
*/
private com.amazonaws.internal.ListWithAutoConstructFlag Default: Amazon EC2 uses the default
* security group.
*/
private com.amazonaws.internal.ListWithAutoConstructFlag Default:
* Constraints: We recommend that you use PV-GRUB
* instead of kernels and RAM disks. For more information, see
* PV-GRUB in the Amazon Elastic Compute Cloud User Guide.
* We recommend that you use
* PV-GRUB instead of kernels and RAM disks. For more information, see
* PV-GRUB in the Amazon Elastic Compute Cloud User Guide.
* Default: Default:
* Constraints: Only one private IP address can be
* designated as primary. Therefore, you can't specify this parameter if
* Default: We select an IP address from the IP address range
* of the subnet.
*/
private String privateIpAddress;
/**
* Unique, case-sensitive identifier you provide to ensure the
* idempotency of the request. For more information, see Ensuring
* Idempotency. Constraints: Maximum 64 ASCII characters
*/
private String clientToken;
/**
* Reserved.
*/
private String additionalInfo;
/**
* One or more network interfaces.
*/
private com.amazonaws.internal.ListWithAutoConstructFlag Default:
* 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.
* @param 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 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 RunInstancesRequest(String imageId, Integer minCount, Integer maxCount) {
setImageId(imageId);
setMinCount(minCount);
setMaxCount(maxCount);
}
/**
* The ID of the AMI, which you can get by calling DescribeImages.
*
* @return The ID of the AMI, which you can get by calling DescribeImages.
*/
public String getImageId() {
return imageId;
}
/**
* The ID of the AMI, which you can get by calling DescribeImages.
*
* @param imageId The ID of the AMI, which you can get by calling DescribeImages.
*/
public void setImageId(String imageId) {
this.imageId = imageId;
}
/**
* The ID of the AMI, which you can get by calling DescribeImages.
*
* Returns a reference to this object so that method calls can be chained together.
*
* @param imageId The ID of the AMI, which you can get by calling DescribeImages.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public RunInstancesRequest withImageId(String imageId) {
this.imageId = imageId;
return this;
}
/**
* 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.
*
* @return The minimum number of instances to launch. If you specify a minimum
* that is more instances than Amazon EC2 can launch in the target
* Availability Zone, Amazon EC2 launches no instances. Constraints:
* Between 1 and the maximum number you're allowed for the specified
* instance type. For more information about the default limits, and how
* to request an increase, see How
* many instances can I run in Amazon EC2 in the Amazon EC2 General
* FAQ.
*/
public Integer getMinCount() {
return 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.
*
* @param minCount The minimum number of instances to launch. If you specify a minimum
* that is more instances than Amazon EC2 can launch in the target
* Availability Zone, Amazon EC2 launches no instances. Constraints:
* Between 1 and the maximum number you're allowed for the specified
* instance type. For more information about the default limits, and how
* to request an increase, see How
* many instances can I run in Amazon EC2 in the Amazon EC2 General
* FAQ.
*/
public void setMinCount(Integer minCount) {
this.minCount = 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 a reference to this object so that method calls can be chained together.
*
* @param 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.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public RunInstancesRequest withMinCount(Integer minCount) {
this.minCount = minCount;
return this;
}
/**
* 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
* 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.
*
* @return 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
* 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 Integer getMaxCount() {
return 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
* 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.
*
* @param 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
* 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 void setMaxCount(Integer maxCount) {
this.maxCount = 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
* 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 a reference to this object so that method calls can be chained together.
*
* @param 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
* 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.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public RunInstancesRequest withMaxCount(Integer maxCount) {
this.maxCount = maxCount;
return this;
}
/**
* 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.
* 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.
* 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 a reference to this object so that method calls can be chained together.
*
* @param 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.
* Default:
* Amazon EC2 uses the default security group.
*
* @return [EC2-Classic, default VPC] One or more security group names. For a
* nondefault VPC, you must use security group IDs instead. Default:
* Amazon EC2 uses the default security group.
*/
public java.util.List Default:
* Amazon EC2 uses the default security group.
*
* @param securityGroups [EC2-Classic, default VPC] One or more security group names. For a
* nondefault VPC, you must use security group IDs instead. Default:
* Amazon EC2 uses the default security group.
*/
public void setSecurityGroups(java.util.Collection Default:
* Amazon EC2 uses the default security group.
*
* Returns a reference to this object so that method calls can be chained together.
*
* @param securityGroups [EC2-Classic, default VPC] One or more security group names. For a
* nondefault VPC, you must use security group IDs instead. Default:
* Amazon EC2 uses the default security group.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public RunInstancesRequest withSecurityGroups(String... securityGroups) {
if (getSecurityGroups() == null) setSecurityGroups(new java.util.ArrayList Default:
* Amazon EC2 uses the default security group.
*
* Returns a reference to this object so that method calls can be chained together.
*
* @param securityGroups [EC2-Classic, default VPC] One or more security group names. For a
* nondefault VPC, you must use security group IDs instead. Default:
* Amazon EC2 uses the default security group.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public RunInstancesRequest withSecurityGroups(java.util.Collection Default: Amazon EC2 uses the default
* security group.
*
* @return One or more security group IDs. You can create a security group using
* CreateSecurityGroup. Default: Amazon EC2 uses the default
* security group.
*/
public java.util.List Default: Amazon EC2 uses the default
* security group.
*
* @param securityGroupIds One or more security group IDs. You can create a security group using
* CreateSecurityGroup. Default: Amazon EC2 uses the default
* security group.
*/
public void setSecurityGroupIds(java.util.Collection Default: Amazon EC2 uses the default
* security group.
*
* Returns a reference to this object so that method calls can be chained together.
*
* @param securityGroupIds One or more security group IDs. You can create a security group using
* CreateSecurityGroup. Default: Amazon EC2 uses the default
* security group.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public RunInstancesRequest withSecurityGroupIds(String... securityGroupIds) {
if (getSecurityGroupIds() == null) setSecurityGroupIds(new java.util.ArrayList Default: Amazon EC2 uses the default
* security group.
*
* Returns a reference to this object so that method calls can be chained together.
*
* @param securityGroupIds One or more security group IDs. You can create a security group using
* CreateSecurityGroup. Default: Amazon EC2 uses the default
* security group.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public RunInstancesRequest withSecurityGroupIds(java.util.Collection
* Returns a reference to this object so that method calls can be chained together.
*
* @param userData Data to configure the instance, or a script to run during instance
* launch. For more information, see Running
* Commands on Your Linux Instance at Launch (Linux) and Adding
* User Data (Windows). For API calls, the text must be
* base64-encoded. For command line tools, the encoding is performed for
* you, and you can load the text from a file.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public RunInstancesRequest withUserData(String userData) {
this.userData = userData;
return this;
}
/**
* The instance type. For more information, see Instance
* Types in the Amazon Elastic Compute Cloud User Guide.
* Default:
* Constraints: Default: Default:
* Constraints: Default: Default:
* Returns a reference to this object so that method calls can be chained together.
*
* Constraints: Default: Default:
* Constraints: Default: Default:
* Returns a reference to this object so that method calls can be chained together.
*
* Constraints: Default:
* Returns a reference to this object so that method calls can be chained together.
*
* @param placement The placement for the instance.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public RunInstancesRequest withPlacement(Placement placement) {
this.placement = placement;
return this;
}
/**
* The ID of the kernel. We recommend that you use PV-GRUB
* instead of kernels and RAM disks. For more information, see
* PV-GRUB in the Amazon Elastic Compute Cloud User Guide.
* We recommend that you use PV-GRUB
* instead of kernels and RAM disks. For more information, see
* PV-GRUB in the Amazon Elastic Compute Cloud User Guide.
* We recommend that you use PV-GRUB
* instead of kernels and RAM disks. For more information, see
* PV-GRUB in the Amazon Elastic Compute Cloud User Guide.
* We recommend that you use PV-GRUB
* instead of kernels and RAM disks. For more information, see
* PV-GRUB in the Amazon Elastic Compute Cloud User Guide.
* We recommend that you use PV-GRUB
* instead of kernels and RAM disks. For more information, see
* PV-GRUB in the Amazon Elastic Compute Cloud User Guide.
*
* Returns a reference to this object so that method calls can be chained together.
*
* @param kernelId The ID of the kernel. We recommend that you use PV-GRUB
* instead of kernels and RAM disks. For more information, see
* PV-GRUB in the Amazon Elastic Compute Cloud User Guide.
* We recommend that you use
* PV-GRUB instead of kernels and RAM disks. For more information, see
* PV-GRUB in the Amazon Elastic Compute Cloud User Guide.
* We recommend that you use
* PV-GRUB instead of kernels and RAM disks. For more information, see
* PV-GRUB in the Amazon Elastic Compute Cloud User Guide.
* We recommend that you use
* PV-GRUB instead of kernels and RAM disks. For more information, see
* PV-GRUB in the Amazon Elastic Compute Cloud User Guide.
* We recommend that you use
* PV-GRUB instead of kernels and RAM disks. For more information, see
* PV-GRUB in the Amazon Elastic Compute Cloud User Guide.
* We recommend that you use
* PV-GRUB instead of kernels and RAM disks. For more information, see
* PV-GRUB in the Amazon Elastic Compute Cloud User Guide.
*
* Returns a reference to this object so that method calls can be chained together.
*
* @param ramdiskId The ID of the RAM disk. We recommend that you use
* PV-GRUB instead of kernels and RAM disks. For more information, see
* PV-GRUB in the Amazon Elastic Compute Cloud User Guide.
*
* Returns a reference to this object so that method calls can be chained together.
*
* @param blockDeviceMappings The block device mapping.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public RunInstancesRequest withBlockDeviceMappings(BlockDeviceMapping... blockDeviceMappings) {
if (getBlockDeviceMappings() == null) setBlockDeviceMappings(new java.util.ArrayList
* Returns a reference to this object so that method calls can be chained together.
*
* @param blockDeviceMappings The block device mapping.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public RunInstancesRequest withBlockDeviceMappings(java.util.Collection
* Returns a reference to this object so that method calls can be chained together.
*
* @param monitoring The monitoring for the instance.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public RunInstancesRequest withMonitoring(Boolean monitoring) {
this.monitoring = monitoring;
return this;
}
/**
* The monitoring for the instance.
*
* @return The monitoring for the instance.
*/
public Boolean getMonitoring() {
return monitoring;
}
/**
* [EC2-VPC] The ID of the subnet to launch the instance into.
*
* @return [EC2-VPC] The ID of the subnet to launch the instance into.
*/
public String getSubnetId() {
return subnetId;
}
/**
* [EC2-VPC] The ID of the subnet to launch the instance into.
*
* @param subnetId [EC2-VPC] The ID of the subnet to launch the instance into.
*/
public void setSubnetId(String subnetId) {
this.subnetId = subnetId;
}
/**
* [EC2-VPC] The ID of the subnet to launch the instance into.
*
* Returns a reference to this object so that method calls can be chained together.
*
* @param subnetId [EC2-VPC] The ID of the subnet to launch the instance into.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public RunInstancesRequest withSubnetId(String subnetId) {
this.subnetId = subnetId;
return this;
}
/**
* If you set this parameter to Default: Default: Default: Default: Default:
* Returns a reference to this object so that method calls can be chained together.
*
* @param disableApiTermination If you set this parameter to Default: Default: Default: Default:
* Constraints: Default: Default:
* Constraints: Default: Default:
* Returns a reference to this object so that method calls can be chained together.
*
* Constraints: Default: Default:
* Constraints: Default: Default:
* Returns a reference to this object so that method calls can be chained together.
*
* Constraints: Default: Only one private IP address can be
* designated as primary. Therefore, you can't specify this parameter if
* Default: We select an IP address from the IP address range
* of the subnet.
*
* @return [EC2-VPC] The primary IP address. You must specify a value from the IP
* address range of the subnet. Only one private IP address can be
* designated as primary. Therefore, you can't specify this parameter if
* Default: We select an IP address from the IP address range
* of the subnet.
*/
public String getPrivateIpAddress() {
return privateIpAddress;
}
/**
* [EC2-VPC] The primary IP address. You must specify a value from the IP
* address range of the subnet. Only one private IP address can be
* designated as primary. Therefore, you can't specify this parameter if
* Default: We select an IP address from the IP address range
* of the subnet.
*
* @param privateIpAddress [EC2-VPC] The primary IP address. You must specify a value from the IP
* address range of the subnet. Only one private IP address can be
* designated as primary. Therefore, you can't specify this parameter if
* Default: We select an IP address from the IP address range
* of the subnet.
*/
public void setPrivateIpAddress(String privateIpAddress) {
this.privateIpAddress = privateIpAddress;
}
/**
* [EC2-VPC] The primary IP address. You must specify a value from the IP
* address range of the subnet. Only one private IP address can be
* designated as primary. Therefore, you can't specify this parameter if
* Default: We select an IP address from the IP address range
* of the subnet.
*
* Returns a reference to this object so that method calls can be chained together.
*
* @param privateIpAddress [EC2-VPC] The primary IP address. You must specify a value from the IP
* address range of the subnet. Only one private IP address can be
* designated as primary. Therefore, you can't specify this parameter if
* Default: We select an IP address from the IP address range
* of the subnet.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public RunInstancesRequest withPrivateIpAddress(String privateIpAddress) {
this.privateIpAddress = privateIpAddress;
return this;
}
/**
* Unique, case-sensitive identifier you provide to ensure the
* idempotency of the request. For more information, see Ensuring
* Idempotency. Constraints: Maximum 64 ASCII characters
*
* @return Unique, case-sensitive identifier you provide to ensure the
* idempotency of the request. For more information, see Ensuring
* Idempotency. Constraints: Maximum 64 ASCII characters
*/
public String getClientToken() {
return clientToken;
}
/**
* Unique, case-sensitive identifier you provide to ensure the
* idempotency of the request. For more information, see Ensuring
* Idempotency. Constraints: Maximum 64 ASCII characters
*
* @param clientToken Unique, case-sensitive identifier you provide to ensure the
* idempotency of the request. For more information, see Ensuring
* Idempotency. Constraints: Maximum 64 ASCII characters
*/
public void setClientToken(String clientToken) {
this.clientToken = clientToken;
}
/**
* Unique, case-sensitive identifier you provide to ensure the
* idempotency of the request. For more information, see Ensuring
* Idempotency. Constraints: Maximum 64 ASCII characters
*
* Returns a reference to this object so that method calls can be chained together.
*
* @param clientToken Unique, case-sensitive identifier you provide to ensure the
* idempotency of the request. For more information, see Ensuring
* Idempotency. Constraints: Maximum 64 ASCII characters
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public RunInstancesRequest withClientToken(String clientToken) {
this.clientToken = clientToken;
return this;
}
/**
* Reserved.
*
* @return Reserved.
*/
public String getAdditionalInfo() {
return additionalInfo;
}
/**
* Reserved.
*
* @param additionalInfo Reserved.
*/
public void setAdditionalInfo(String additionalInfo) {
this.additionalInfo = additionalInfo;
}
/**
* Reserved.
*
* Returns a reference to this object so that method calls can be chained together.
*
* @param additionalInfo Reserved.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public RunInstancesRequest withAdditionalInfo(String additionalInfo) {
this.additionalInfo = additionalInfo;
return this;
}
/**
* One or more network interfaces.
*
* @return One or more network interfaces.
*/
public java.util.List
* Returns a reference to this object so that method calls can be chained together.
*
* @param networkInterfaces One or more network interfaces.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public RunInstancesRequest withNetworkInterfaces(InstanceNetworkInterfaceSpecification... networkInterfaces) {
if (getNetworkInterfaces() == null) setNetworkInterfaces(new java.util.ArrayList
* Returns a reference to this object so that method calls can be chained together.
*
* @param networkInterfaces One or more network interfaces.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public RunInstancesRequest withNetworkInterfaces(java.util.Collection
* Returns a reference to this object so that method calls can be chained together.
*
* @param iamInstanceProfile The IAM instance profile.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public RunInstancesRequest withIamInstanceProfile(IamInstanceProfileSpecification iamInstanceProfile) {
this.iamInstanceProfile = iamInstanceProfile;
return this;
}
/**
* Indicates whether the instance is optimized for EBS I/O. This
* optimization provides dedicated throughput to Amazon EBS and an
* optimized configuration stack to provide optimal EBS I/O performance.
* This optimization isn't available with all instance types. Additional
* usage charges apply when using an EBS-optimized instance. Default:
* Default:
* Default:
* Default:
* Default:
*
* Returns a reference to this object so that method calls can be chained together.
*
* @param ebsOptimized Indicates whether the instance is optimized for EBS I/O. This
* optimization provides dedicated throughput to Amazon EBS and an
* optimized configuration stack to provide optimal EBS I/O performance.
* This optimization isn't available with all instance types. Additional
* usage charges apply when using an EBS-optimized instance. Default:
* Default:
* Default:
* m1.small
*
* Allowed Values: t1.micro, t2.nano, t2.micro, t2.small, t2.medium, t2.large, m1.small, m1.medium, m1.large, m1.xlarge, m3.medium, m3.large, m3.xlarge, m3.2xlarge, m4.large, m4.xlarge, m4.2xlarge, m4.4xlarge, m4.10xlarge, m2.xlarge, m2.2xlarge, m2.4xlarge, cr1.8xlarge, r3.large, r3.xlarge, r3.2xlarge, r3.4xlarge, r3.8xlarge, x1.4xlarge, x1.8xlarge, x1.16xlarge, x1.32xlarge, i2.xlarge, i2.2xlarge, i2.4xlarge, i2.8xlarge, hi1.4xlarge, hs1.8xlarge, c1.medium, c1.xlarge, c3.large, c3.xlarge, c3.2xlarge, c3.4xlarge, c3.8xlarge, c4.large, c4.xlarge, c4.2xlarge, c4.4xlarge, c4.8xlarge, cc1.4xlarge, cc2.8xlarge, g2.2xlarge, g2.8xlarge, cg1.4xlarge, d2.xlarge, d2.2xlarge, d2.4xlarge, d2.8xlarge
*/
private String instanceType;
/**
* The placement for the instance.
*/
private Placement placement;
/**
* The ID of the kernel. true
, you can't terminate
* the instance using the Amazon EC2 console, CLI, or API; otherwise, you
* can. If you set this parameter to true
and then later
* want to be able to terminate the instance, you must first change the
* value of the disableApiTermination
attribute to
* false
using ModifyInstanceAttribute.
* Alternatively, if you set
* InstanceInitiatedShutdownBehavior
to
* terminate
, you can terminate the instance by running the
* shutdown command from the instance. false
*/
private Boolean disableApiTermination;
/**
* Indicates whether an instance stops or terminates when you initiate
* shutdown from the instance (using the operating system command for
* system shutdown). stop
*
* Allowed Values: stop, terminate
*/
private String instanceInitiatedShutdownBehavior;
/**
* [EC2-VPC] The primary IP address. You must specify a value from the IP
* address range of the subnet. PrivateIpAddresses.n.Primary
is set to true
* and PrivateIpAddresses.n.PrivateIpAddress
is set to an IP
* address. false
*/
private Boolean ebsOptimized;
/**
* Default constructor for a new RunInstancesRequest object. Callers should use the
* setter or fluent setter (with...) methods to initialize this object after creating it.
*/
public RunInstancesRequest() {}
/**
* Constructs a new RunInstancesRequest object.
* Callers should use the setter or fluent setter (with...) methods to
* initialize any additional object members.
*
* @param imageId The ID of the AMI, which you can get by calling
* DescribeImages.
* @param 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.
* MinCount
. MinCount
. MinCount
. MinCount
. MinCount
. MinCount
. MinCount
. m1.small
*
* Allowed Values: t1.micro, t2.nano, t2.micro, t2.small, t2.medium, t2.large, m1.small, m1.medium, m1.large, m1.xlarge, m3.medium, m3.large, m3.xlarge, m3.2xlarge, m4.large, m4.xlarge, m4.2xlarge, m4.4xlarge, m4.10xlarge, m2.xlarge, m2.2xlarge, m2.4xlarge, cr1.8xlarge, r3.large, r3.xlarge, r3.2xlarge, r3.4xlarge, r3.8xlarge, x1.4xlarge, x1.8xlarge, x1.16xlarge, x1.32xlarge, i2.xlarge, i2.2xlarge, i2.4xlarge, i2.8xlarge, hi1.4xlarge, hs1.8xlarge, c1.medium, c1.xlarge, c3.large, c3.xlarge, c3.2xlarge, c3.4xlarge, c3.8xlarge, c4.large, c4.xlarge, c4.2xlarge, c4.4xlarge, c4.8xlarge, cc1.4xlarge, cc2.8xlarge, g2.2xlarge, g2.8xlarge, cg1.4xlarge, d2.xlarge, d2.2xlarge, d2.4xlarge, d2.8xlarge
*
* @return The instance type. For more information, see Instance
* Types in the Amazon Elastic Compute Cloud User Guide.
* m1.small
*
* @see InstanceType
*/
public String getInstanceType() {
return instanceType;
}
/**
* The instance type. For more information, see Instance
* Types in the Amazon Elastic Compute Cloud User Guide.
* m1.small
*
* Allowed Values: t1.micro, t2.nano, t2.micro, t2.small, t2.medium, t2.large, m1.small, m1.medium, m1.large, m1.xlarge, m3.medium, m3.large, m3.xlarge, m3.2xlarge, m4.large, m4.xlarge, m4.2xlarge, m4.4xlarge, m4.10xlarge, m2.xlarge, m2.2xlarge, m2.4xlarge, cr1.8xlarge, r3.large, r3.xlarge, r3.2xlarge, r3.4xlarge, r3.8xlarge, x1.4xlarge, x1.8xlarge, x1.16xlarge, x1.32xlarge, i2.xlarge, i2.2xlarge, i2.4xlarge, i2.8xlarge, hi1.4xlarge, hs1.8xlarge, c1.medium, c1.xlarge, c3.large, c3.xlarge, c3.2xlarge, c3.4xlarge, c3.8xlarge, c4.large, c4.xlarge, c4.2xlarge, c4.4xlarge, c4.8xlarge, cc1.4xlarge, cc2.8xlarge, g2.2xlarge, g2.8xlarge, cg1.4xlarge, d2.xlarge, d2.2xlarge, d2.4xlarge, d2.8xlarge
*
* @param instanceType The instance type. For more information, see Instance
* Types in the Amazon Elastic Compute Cloud User Guide.
* m1.small
*
* @see InstanceType
*/
public void setInstanceType(String instanceType) {
this.instanceType = instanceType;
}
/**
* The instance type. For more information, see Instance
* Types in the Amazon Elastic Compute Cloud User Guide.
* m1.small
*
* Allowed Values: t1.micro, t2.nano, t2.micro, t2.small, t2.medium, t2.large, m1.small, m1.medium, m1.large, m1.xlarge, m3.medium, m3.large, m3.xlarge, m3.2xlarge, m4.large, m4.xlarge, m4.2xlarge, m4.4xlarge, m4.10xlarge, m2.xlarge, m2.2xlarge, m2.4xlarge, cr1.8xlarge, r3.large, r3.xlarge, r3.2xlarge, r3.4xlarge, r3.8xlarge, x1.4xlarge, x1.8xlarge, x1.16xlarge, x1.32xlarge, i2.xlarge, i2.2xlarge, i2.4xlarge, i2.8xlarge, hi1.4xlarge, hs1.8xlarge, c1.medium, c1.xlarge, c3.large, c3.xlarge, c3.2xlarge, c3.4xlarge, c3.8xlarge, c4.large, c4.xlarge, c4.2xlarge, c4.4xlarge, c4.8xlarge, cc1.4xlarge, cc2.8xlarge, g2.2xlarge, g2.8xlarge, cg1.4xlarge, d2.xlarge, d2.2xlarge, d2.4xlarge, d2.8xlarge
*
* @param instanceType The instance type. For more information, see Instance
* Types in the Amazon Elastic Compute Cloud User Guide.
* m1.small
*
* @return A reference to this updated object so that method calls can be chained
* together.
*
* @see InstanceType
*/
public RunInstancesRequest withInstanceType(String instanceType) {
this.instanceType = instanceType;
return this;
}
/**
* The instance type. For more information, see Instance
* Types in the Amazon Elastic Compute Cloud User Guide.
* m1.small
*
* Allowed Values: t1.micro, t2.nano, t2.micro, t2.small, t2.medium, t2.large, m1.small, m1.medium, m1.large, m1.xlarge, m3.medium, m3.large, m3.xlarge, m3.2xlarge, m4.large, m4.xlarge, m4.2xlarge, m4.4xlarge, m4.10xlarge, m2.xlarge, m2.2xlarge, m2.4xlarge, cr1.8xlarge, r3.large, r3.xlarge, r3.2xlarge, r3.4xlarge, r3.8xlarge, x1.4xlarge, x1.8xlarge, x1.16xlarge, x1.32xlarge, i2.xlarge, i2.2xlarge, i2.4xlarge, i2.8xlarge, hi1.4xlarge, hs1.8xlarge, c1.medium, c1.xlarge, c3.large, c3.xlarge, c3.2xlarge, c3.4xlarge, c3.8xlarge, c4.large, c4.xlarge, c4.2xlarge, c4.4xlarge, c4.8xlarge, cc1.4xlarge, cc2.8xlarge, g2.2xlarge, g2.8xlarge, cg1.4xlarge, d2.xlarge, d2.2xlarge, d2.4xlarge, d2.8xlarge
*
* @param instanceType The instance type. For more information, see Instance
* Types in the Amazon Elastic Compute Cloud User Guide.
* m1.small
*
* @see InstanceType
*/
public void setInstanceType(InstanceType instanceType) {
this.instanceType = instanceType.toString();
}
/**
* The instance type. For more information, see Instance
* Types in the Amazon Elastic Compute Cloud User Guide.
* m1.small
*
* Allowed Values: t1.micro, t2.nano, t2.micro, t2.small, t2.medium, t2.large, m1.small, m1.medium, m1.large, m1.xlarge, m3.medium, m3.large, m3.xlarge, m3.2xlarge, m4.large, m4.xlarge, m4.2xlarge, m4.4xlarge, m4.10xlarge, m2.xlarge, m2.2xlarge, m2.4xlarge, cr1.8xlarge, r3.large, r3.xlarge, r3.2xlarge, r3.4xlarge, r3.8xlarge, x1.4xlarge, x1.8xlarge, x1.16xlarge, x1.32xlarge, i2.xlarge, i2.2xlarge, i2.4xlarge, i2.8xlarge, hi1.4xlarge, hs1.8xlarge, c1.medium, c1.xlarge, c3.large, c3.xlarge, c3.2xlarge, c3.4xlarge, c3.8xlarge, c4.large, c4.xlarge, c4.2xlarge, c4.4xlarge, c4.8xlarge, cc1.4xlarge, cc2.8xlarge, g2.2xlarge, g2.8xlarge, cg1.4xlarge, d2.xlarge, d2.2xlarge, d2.4xlarge, d2.8xlarge
*
* @param instanceType The instance type. For more information, see Instance
* Types in the Amazon Elastic Compute Cloud User Guide.
* m1.small
*
* @return A reference to this updated object so that method calls can be chained
* together.
*
* @see InstanceType
*/
public RunInstancesRequest withInstanceType(InstanceType instanceType) {
this.instanceType = instanceType.toString();
return this;
}
/**
* The placement for the instance.
*
* @return The placement for the instance.
*/
public Placement getPlacement() {
return placement;
}
/**
* The placement for the instance.
*
* @param placement The placement for the instance.
*/
public void setPlacement(Placement placement) {
this.placement = placement;
}
/**
* The placement for the instance.
* true
, you can't terminate
* the instance using the Amazon EC2 console, CLI, or API; otherwise, you
* can. If you set this parameter to true
and then later
* want to be able to terminate the instance, you must first change the
* value of the disableApiTermination
attribute to
* false
using ModifyInstanceAttribute.
* Alternatively, if you set
* InstanceInitiatedShutdownBehavior
to
* terminate
, you can terminate the instance by running the
* shutdown command from the instance. false
*
* @return If you set this parameter to true
, you can't terminate
* the instance using the Amazon EC2 console, CLI, or API; otherwise, you
* can. If you set this parameter to true
and then later
* want to be able to terminate the instance, you must first change the
* value of the disableApiTermination
attribute to
* false
using ModifyInstanceAttribute.
* Alternatively, if you set
* InstanceInitiatedShutdownBehavior
to
* terminate
, you can terminate the instance by running the
* shutdown command from the instance. false
*/
public Boolean isDisableApiTermination() {
return 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. If you set this parameter to true
and then later
* want to be able to terminate the instance, you must first change the
* value of the disableApiTermination
attribute to
* false
using ModifyInstanceAttribute.
* Alternatively, if you set
* InstanceInitiatedShutdownBehavior
to
* terminate
, you can terminate the instance by running the
* shutdown command from the instance. false
*
* @param 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. If you set this parameter to true
and then later
* want to be able to terminate the instance, you must first change the
* value of the disableApiTermination
attribute to
* false
using ModifyInstanceAttribute.
* Alternatively, if you set
* InstanceInitiatedShutdownBehavior
to
* terminate
, you can terminate the instance by running the
* shutdown command from the instance. false
*/
public void setDisableApiTermination(Boolean disableApiTermination) {
this.disableApiTermination = 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. If you set this parameter to true
and then later
* want to be able to terminate the instance, you must first change the
* value of the disableApiTermination
attribute to
* false
using ModifyInstanceAttribute.
* Alternatively, if you set
* InstanceInitiatedShutdownBehavior
to
* terminate
, you can terminate the instance by running the
* shutdown command from the instance. false
* true
, you can't terminate
* the instance using the Amazon EC2 console, CLI, or API; otherwise, you
* can. If you set this parameter to true
and then later
* want to be able to terminate the instance, you must first change the
* value of the disableApiTermination
attribute to
* false
using ModifyInstanceAttribute.
* Alternatively, if you set
* InstanceInitiatedShutdownBehavior
to
* terminate
, you can terminate the instance by running the
* shutdown command from the instance. false
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public RunInstancesRequest withDisableApiTermination(Boolean disableApiTermination) {
this.disableApiTermination = disableApiTermination;
return this;
}
/**
* If you set this parameter to true
, you can't terminate
* the instance using the Amazon EC2 console, CLI, or API; otherwise, you
* can. If you set this parameter to true
and then later
* want to be able to terminate the instance, you must first change the
* value of the disableApiTermination
attribute to
* false
using ModifyInstanceAttribute.
* Alternatively, if you set
* InstanceInitiatedShutdownBehavior
to
* terminate
, you can terminate the instance by running the
* shutdown command from the instance. false
*
* @return If you set this parameter to true
, you can't terminate
* the instance using the Amazon EC2 console, CLI, or API; otherwise, you
* can. If you set this parameter to true
and then later
* want to be able to terminate the instance, you must first change the
* value of the disableApiTermination
attribute to
* false
using ModifyInstanceAttribute.
* Alternatively, if you set
* InstanceInitiatedShutdownBehavior
to
* terminate
, you can terminate the instance by running the
* shutdown command from the instance. false
*/
public Boolean getDisableApiTermination() {
return disableApiTermination;
}
/**
* Indicates whether an instance stops or terminates when you initiate
* shutdown from the instance (using the operating system command for
* system shutdown). stop
*
* Allowed Values: stop, terminate
*
* @return Indicates whether an instance stops or terminates when you initiate
* shutdown from the instance (using the operating system command for
* system shutdown). stop
*
* @see ShutdownBehavior
*/
public String getInstanceInitiatedShutdownBehavior() {
return instanceInitiatedShutdownBehavior;
}
/**
* Indicates whether an instance stops or terminates when you initiate
* shutdown from the instance (using the operating system command for
* system shutdown). stop
*
* Allowed Values: stop, terminate
*
* @param instanceInitiatedShutdownBehavior Indicates whether an instance stops or terminates when you initiate
* shutdown from the instance (using the operating system command for
* system shutdown). stop
*
* @see ShutdownBehavior
*/
public void setInstanceInitiatedShutdownBehavior(String instanceInitiatedShutdownBehavior) {
this.instanceInitiatedShutdownBehavior = instanceInitiatedShutdownBehavior;
}
/**
* Indicates whether an instance stops or terminates when you initiate
* shutdown from the instance (using the operating system command for
* system shutdown). stop
*
* Allowed Values: stop, terminate
*
* @param instanceInitiatedShutdownBehavior Indicates whether an instance stops or terminates when you initiate
* shutdown from the instance (using the operating system command for
* system shutdown). stop
*
* @return A reference to this updated object so that method calls can be chained
* together.
*
* @see ShutdownBehavior
*/
public RunInstancesRequest withInstanceInitiatedShutdownBehavior(String instanceInitiatedShutdownBehavior) {
this.instanceInitiatedShutdownBehavior = instanceInitiatedShutdownBehavior;
return this;
}
/**
* Indicates whether an instance stops or terminates when you initiate
* shutdown from the instance (using the operating system command for
* system shutdown). stop
*
* Allowed Values: stop, terminate
*
* @param instanceInitiatedShutdownBehavior Indicates whether an instance stops or terminates when you initiate
* shutdown from the instance (using the operating system command for
* system shutdown). stop
*
* @see ShutdownBehavior
*/
public void setInstanceInitiatedShutdownBehavior(ShutdownBehavior instanceInitiatedShutdownBehavior) {
this.instanceInitiatedShutdownBehavior = instanceInitiatedShutdownBehavior.toString();
}
/**
* Indicates whether an instance stops or terminates when you initiate
* shutdown from the instance (using the operating system command for
* system shutdown). stop
*
* Allowed Values: stop, terminate
*
* @param instanceInitiatedShutdownBehavior Indicates whether an instance stops or terminates when you initiate
* shutdown from the instance (using the operating system command for
* system shutdown). stop
*
* @return A reference to this updated object so that method calls can be chained
* together.
*
* @see ShutdownBehavior
*/
public RunInstancesRequest withInstanceInitiatedShutdownBehavior(ShutdownBehavior instanceInitiatedShutdownBehavior) {
this.instanceInitiatedShutdownBehavior = instanceInitiatedShutdownBehavior.toString();
return this;
}
/**
* [EC2-VPC] The primary IP address. You must specify a value from the IP
* address range of the subnet. PrivateIpAddresses.n.Primary
is set to true
* and PrivateIpAddresses.n.PrivateIpAddress
is set to an IP
* address. PrivateIpAddresses.n.Primary
is set to true
* and PrivateIpAddresses.n.PrivateIpAddress
is set to an IP
* address. PrivateIpAddresses.n.Primary
is set to true
* and PrivateIpAddresses.n.PrivateIpAddress
is set to an IP
* address. PrivateIpAddresses.n.Primary
is set to true
* and PrivateIpAddresses.n.PrivateIpAddress
is set to an IP
* address. PrivateIpAddresses.n.Primary
is set to true
* and PrivateIpAddresses.n.PrivateIpAddress
is set to an IP
* address. PrivateIpAddresses.n.Primary
is set to true
* and PrivateIpAddresses.n.PrivateIpAddress
is set to an IP
* address. false
*
* @return Indicates whether the instance is optimized for EBS I/O. This
* optimization provides dedicated throughput to Amazon EBS and an
* optimized configuration stack to provide optimal EBS I/O performance.
* This optimization isn't available with all instance types. Additional
* usage charges apply when using an EBS-optimized instance. false
*/
public Boolean isEbsOptimized() {
return ebsOptimized;
}
/**
* Indicates whether the instance is optimized for EBS I/O. This
* optimization provides dedicated throughput to Amazon EBS and an
* optimized configuration stack to provide optimal EBS I/O performance.
* This optimization isn't available with all instance types. Additional
* usage charges apply when using an EBS-optimized instance. false
*
* @param ebsOptimized Indicates whether the instance is optimized for EBS I/O. This
* optimization provides dedicated throughput to Amazon EBS and an
* optimized configuration stack to provide optimal EBS I/O performance.
* This optimization isn't available with all instance types. Additional
* usage charges apply when using an EBS-optimized instance. false
*/
public void setEbsOptimized(Boolean ebsOptimized) {
this.ebsOptimized = ebsOptimized;
}
/**
* Indicates whether the instance is optimized for EBS I/O. This
* optimization provides dedicated throughput to Amazon EBS and an
* optimized configuration stack to provide optimal EBS I/O performance.
* This optimization isn't available with all instance types. Additional
* usage charges apply when using an EBS-optimized instance. false
* false
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public RunInstancesRequest withEbsOptimized(Boolean ebsOptimized) {
this.ebsOptimized = ebsOptimized;
return this;
}
/**
* Indicates whether the instance is optimized for EBS I/O. This
* optimization provides dedicated throughput to Amazon EBS and an
* optimized configuration stack to provide optimal EBS I/O performance.
* This optimization isn't available with all instance types. Additional
* usage charges apply when using an EBS-optimized instance. false
*
* @return Indicates whether the instance is optimized for EBS I/O. This
* optimization provides dedicated throughput to Amazon EBS and an
* optimized configuration stack to provide optimal EBS I/O performance.
* This optimization isn't available with all instance types. Additional
* usage charges apply when using an EBS-optimized instance. false
*/
public Boolean getEbsOptimized() {
return ebsOptimized;
}
/**
* This method is intended for internal use only.
* Returns the marshaled request configured with additional parameters to
* enable operation dry-run.
*/
@Override
public Request