Class CfnInstance
- All Implemented Interfaces:
IConstruct
,IDependable
,IInspectable
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
AWS::EC2::Instance
.
Specifies an EC2 instance.
If an Elastic IP address is attached to your instance, AWS CloudFormation reattaches the Elastic IP address after it updates the instance. For more information about updating stacks, see AWS CloudFormation Stacks Updates .
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import software.amazon.awscdk.services.ec2.*; CfnInstance cfnInstance = CfnInstance.Builder.create(this, "MyCfnInstance") .additionalInfo("additionalInfo") .affinity("affinity") .availabilityZone("availabilityZone") .blockDeviceMappings(List.of(BlockDeviceMappingProperty.builder() .deviceName("deviceName") // the properties below are optional .ebs(EbsProperty.builder() .deleteOnTermination(false) .encrypted(false) .iops(123) .kmsKeyId("kmsKeyId") .snapshotId("snapshotId") .volumeSize(123) .volumeType("volumeType") .build()) .noDevice(NoDeviceProperty.builder().build()) .virtualName("virtualName") .build())) .cpuOptions(CpuOptionsProperty.builder() .coreCount(123) .threadsPerCore(123) .build()) .creditSpecification(CreditSpecificationProperty.builder() .cpuCredits("cpuCredits") .build()) .disableApiTermination(false) .ebsOptimized(false) .elasticGpuSpecifications(List.of(ElasticGpuSpecificationProperty.builder() .type("type") .build())) .elasticInferenceAccelerators(List.of(ElasticInferenceAcceleratorProperty.builder() .type("type") // the properties below are optional .count(123) .build())) .enclaveOptions(EnclaveOptionsProperty.builder() .enabled(false) .build()) .hibernationOptions(HibernationOptionsProperty.builder() .configured(false) .build()) .hostId("hostId") .hostResourceGroupArn("hostResourceGroupArn") .iamInstanceProfile("iamInstanceProfile") .imageId("imageId") .instanceInitiatedShutdownBehavior("instanceInitiatedShutdownBehavior") .instanceType("instanceType") .ipv6AddressCount(123) .ipv6Addresses(List.of(InstanceIpv6AddressProperty.builder() .ipv6Address("ipv6Address") .build())) .kernelId("kernelId") .keyName("keyName") .launchTemplate(LaunchTemplateSpecificationProperty.builder() .version("version") // the properties below are optional .launchTemplateId("launchTemplateId") .launchTemplateName("launchTemplateName") .build()) .licenseSpecifications(List.of(LicenseSpecificationProperty.builder() .licenseConfigurationArn("licenseConfigurationArn") .build())) .monitoring(false) .networkInterfaces(List.of(NetworkInterfaceProperty.builder() .deviceIndex("deviceIndex") // the properties below are optional .associateCarrierIpAddress(false) .associatePublicIpAddress(false) .deleteOnTermination(false) .description("description") .groupSet(List.of("groupSet")) .ipv6AddressCount(123) .ipv6Addresses(List.of(InstanceIpv6AddressProperty.builder() .ipv6Address("ipv6Address") .build())) .networkInterfaceId("networkInterfaceId") .privateIpAddress("privateIpAddress") .privateIpAddresses(List.of(PrivateIpAddressSpecificationProperty.builder() .primary(false) .privateIpAddress("privateIpAddress") .build())) .secondaryPrivateIpAddressCount(123) .subnetId("subnetId") .build())) .placementGroupName("placementGroupName") .privateDnsNameOptions(PrivateDnsNameOptionsProperty.builder() .enableResourceNameDnsAaaaRecord(false) .enableResourceNameDnsARecord(false) .hostnameType("hostnameType") .build()) .privateIpAddress("privateIpAddress") .propagateTagsToVolumeOnCreation(false) .ramdiskId("ramdiskId") .securityGroupIds(List.of("securityGroupIds")) .securityGroups(List.of("securityGroups")) .sourceDestCheck(false) .ssmAssociations(List.of(SsmAssociationProperty.builder() .documentName("documentName") // the properties below are optional .associationParameters(List.of(AssociationParameterProperty.builder() .key("key") .value(List.of("value")) .build())) .build())) .subnetId("subnetId") .tags(List.of(CfnTag.builder() .key("key") .value("value") .build())) .tenancy("tenancy") .userData("userData") .volumes(List.of(VolumeProperty.builder() .device("device") .volumeId("volumeId") .build())) .build();
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Specifies input parameter values for an SSM document in AWS Systems Manager .static interface
Specifies a block device mapping for an instance.static final class
A fluent builder forCfnInstance
.static interface
Specifies the CPU options for the instance.static interface
Specifies the credit option for CPU usage of a T instance.static interface
Specifies a block device for an EBS volume.static interface
Specifies the type of Elastic GPU.static interface
Specifies the Elastic Inference Accelerator for the instance.static interface
Indicates whether the instance is enabled for AWS Nitro Enclaves.static interface
Specifies the hibernation options for the instance.static interface
Specifies the IPv6 address for the instance.static interface
Specifies a launch template to use when launching an Amazon EC2 instance.static interface
Specifies the license configuration to use.static interface
Specifies a network interface that is to be attached to an instance.static interface
Suppresses the specified device included in the block device mapping of the AMI.static interface
The type of hostnames to assign to instances in the subnet at launch.static interface
Specifies a secondary private IPv4 address for a network interface.static interface
Specifies the SSM document and parameter values in AWS Systems Manager to associate with an instance.static interface
Specifies a volume to attach to an instance.Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.amazon.awscdk.core.IConstruct
IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.core.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The CloudFormation resource type name for this resource class. -
Constructor Summary
ModifierConstructorDescriptionCfnInstance
(Construct scope, String id) Create a newAWS::EC2::Instance
.CfnInstance
(Construct scope, String id, CfnInstanceProps props) Create a newAWS::EC2::Instance
.protected
CfnInstance
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
CfnInstance
(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionThis property is reserved for internal use.Indicates whether the instance is associated with a dedicated host.The Availability Zone where the specified instance is launched.The private DNS name of the specified instance.The private IP address of the specified instance.The public DNS name of the specified instance.The public IP address of the specified instance.The Availability Zone of the instance.The block device mapping entries that defines the block devices to attach to the instance at launch.The CPU options for the instance.The credit option for CPU usage of the burstable performance instance.If you set this parameter totrue
, you can't terminate the instance using the Amazon EC2 console, CLI, or API;Indicates whether the instance is optimized for Amazon EBS I/O.An elastic GPU to associate with the instance.An elastic inference accelerator to associate with the instance.Indicates whether the instance is enabled for AWS Nitro Enclaves.Indicates whether an instance is enabled for hibernation.If you specify host for theAffinity
property, the ID of a dedicated host that the instance is associated with.The ARN of the host resource group in which to launch the instances.The name of an IAM instance profile.The ID of the AMI.Indicates whether an instance stops or terminates when you initiate shutdown from the instance (using the operating system command for system shutdown).The instance type.The number of IPv6 addresses to associate with the primary network interface.The IPv6 addresses from the range of the subnet to associate with the primary network interface.The ID of the kernel.The name of the key pair.The launch template to use to launch the instances.The license configurations.Specifies whether detailed monitoring is enabled for the instance.The network interfaces to associate with the instance.The name of an existing placement group that you want to launch the instance into (cluster | partition | spread).The options for the instance hostname.The primary IPv4 address.Indicates whether to assign the tags from the instance to all of the volumes attached to the instance at launch.The ID of the RAM disk to select.The IDs of the security groups.[Default VPC] The names of the security groups.Enable or disable source/destination checks, which ensure that the instance is either the source or the destination of any traffic that it receives.The SSM document and parameter values in AWS Systems Manager to associate with this instance.The ID of the subnet to launch the instance into.getTags()
The tags to add to the instance.The tenancy of the instance.The user data script to make available to the instance.The volumes to attach to the instance.void
inspect
(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties
(Map<String, Object> props) void
setAdditionalInfo
(String value) This property is reserved for internal use.void
setAffinity
(String value) Indicates whether the instance is associated with a dedicated host.void
setAvailabilityZone
(String value) The Availability Zone of the instance.void
setBlockDeviceMappings
(List<Object> value) The block device mapping entries that defines the block devices to attach to the instance at launch.void
The block device mapping entries that defines the block devices to attach to the instance at launch.void
setCpuOptions
(IResolvable value) The CPU options for the instance.void
The CPU options for the instance.void
The credit option for CPU usage of the burstable performance instance.void
The credit option for CPU usage of the burstable performance instance.void
setDisableApiTermination
(Boolean value) If you set this parameter totrue
, you can't terminate the instance using the Amazon EC2 console, CLI, or API;void
If you set this parameter totrue
, you can't terminate the instance using the Amazon EC2 console, CLI, or API;void
setEbsOptimized
(Boolean value) Indicates whether the instance is optimized for Amazon EBS I/O.void
setEbsOptimized
(IResolvable value) Indicates whether the instance is optimized for Amazon EBS I/O.void
setElasticGpuSpecifications
(List<Object> value) An elastic GPU to associate with the instance.void
An elastic GPU to associate with the instance.void
An elastic inference accelerator to associate with the instance.void
An elastic inference accelerator to associate with the instance.void
setEnclaveOptions
(IResolvable value) Indicates whether the instance is enabled for AWS Nitro Enclaves.void
Indicates whether the instance is enabled for AWS Nitro Enclaves.void
setHibernationOptions
(IResolvable value) Indicates whether an instance is enabled for hibernation.void
Indicates whether an instance is enabled for hibernation.void
If you specify host for theAffinity
property, the ID of a dedicated host that the instance is associated with.void
setHostResourceGroupArn
(String value) The ARN of the host resource group in which to launch the instances.void
setIamInstanceProfile
(String value) The name of an IAM instance profile.void
setImageId
(String value) The ID of the AMI.void
Indicates whether an instance stops or terminates when you initiate shutdown from the instance (using the operating system command for system shutdown).void
setInstanceType
(String value) The instance type.void
setIpv6AddressCount
(Number value) The number of IPv6 addresses to associate with the primary network interface.void
setIpv6Addresses
(List<Object> value) The IPv6 addresses from the range of the subnet to associate with the primary network interface.void
setIpv6Addresses
(IResolvable value) The IPv6 addresses from the range of the subnet to associate with the primary network interface.void
setKernelId
(String value) The ID of the kernel.void
setKeyName
(String value) The name of the key pair.void
setLaunchTemplate
(IResolvable value) The launch template to use to launch the instances.void
The launch template to use to launch the instances.void
setLicenseSpecifications
(List<Object> value) The license configurations.void
The license configurations.void
setMonitoring
(Boolean value) Specifies whether detailed monitoring is enabled for the instance.void
setMonitoring
(IResolvable value) Specifies whether detailed monitoring is enabled for the instance.void
setNetworkInterfaces
(List<Object> value) The network interfaces to associate with the instance.void
setNetworkInterfaces
(IResolvable value) The network interfaces to associate with the instance.void
setPlacementGroupName
(String value) The name of an existing placement group that you want to launch the instance into (cluster | partition | spread).void
The options for the instance hostname.void
The options for the instance hostname.void
setPrivateIpAddress
(String value) The primary IPv4 address.void
Indicates whether to assign the tags from the instance to all of the volumes attached to the instance at launch.void
Indicates whether to assign the tags from the instance to all of the volumes attached to the instance at launch.void
setRamdiskId
(String value) The ID of the RAM disk to select.void
setSecurityGroupIds
(List<String> value) The IDs of the security groups.void
setSecurityGroups
(List<String> value) [Default VPC] The names of the security groups.void
setSourceDestCheck
(Boolean value) Enable or disable source/destination checks, which ensure that the instance is either the source or the destination of any traffic that it receives.void
setSourceDestCheck
(IResolvable value) Enable or disable source/destination checks, which ensure that the instance is either the source or the destination of any traffic that it receives.void
setSsmAssociations
(List<Object> value) The SSM document and parameter values in AWS Systems Manager to associate with this instance.void
setSsmAssociations
(IResolvable value) The SSM document and parameter values in AWS Systems Manager to associate with this instance.void
setSubnetId
(String value) The ID of the subnet to launch the instance into.void
setTenancy
(String value) The tenancy of the instance.void
setUserData
(String value) The user data script to make available to the instance.void
setVolumes
(List<Object> value) The volumes to attach to the instance.void
setVolumes
(IResolvable value) The volumes to attach to the instance.Methods inherited from class software.amazon.awscdk.core.CfnResource
addDeletionOverride, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, isCfnResource, shouldSynthesize, toString, validateProperties
Methods inherited from class software.amazon.awscdk.core.CfnRefElement
getRef
Methods inherited from class software.amazon.awscdk.core.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalId
Methods inherited from class software.amazon.awscdk.core.Construct
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
-
-
Constructor Details
-
CfnInstance
protected CfnInstance(software.amazon.jsii.JsiiObjectRef objRef) -
CfnInstance
protected CfnInstance(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnInstance
@Stability(Stable) public CfnInstance(@NotNull Construct scope, @NotNull String id, @Nullable CfnInstanceProps props) Create a newAWS::EC2::Instance
.- Parameters:
scope
-- scope in which this resource is defined.
id
-- scoped id of the resource.
props
-- resource properties.
-
CfnInstance
Create a newAWS::EC2::Instance
.- Parameters:
scope
-- scope in which this resource is defined.
id
-- scoped id of the resource.
-
-
Method Details
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspect
in interfaceIInspectable
- Parameters:
inspector
-- tree inspector to collect and process attributes.
-
renderProperties
@Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String, Object> props) - Overrides:
renderProperties
in classCfnResource
- Parameters:
props
- This parameter is required.
-
getAttrAvailabilityZone
The Availability Zone where the specified instance is launched. For example:us-east-1b
.You can retrieve a list of all Availability Zones for a Region by using the Fn::GetAZs intrinsic function.
-
getAttrPrivateDnsName
The private DNS name of the specified instance.For example:
ip-10-24-34-0.ec2.internal
. -
getAttrPrivateIp
The private IP address of the specified instance.For example:
10.24.34.0
. -
getAttrPublicDnsName
The public DNS name of the specified instance.For example:
ec2-107-20-50-45.compute-1.amazonaws.com
. -
getAttrPublicIp
The public IP address of the specified instance.For example:
192.0.2.0
. -
getCfnProperties
- Overrides:
getCfnProperties
in classCfnResource
-
getTags
The tags to add to the instance.These tags are not applied to the EBS volumes, such as the root volume, unless PropagateTagsToVolumeOnCreation is
true
. -
getAdditionalInfo
This property is reserved for internal use.If you use it, the stack fails with this error:
Bad property set: [Testing this property] (Service: AmazonEC2; Status Code: 400; Error Code: InvalidParameterCombination; Request ID: 0XXXXXX-49c7-4b40-8bcc-76885dcXXXXX)
. -
setAdditionalInfo
This property is reserved for internal use.If you use it, the stack fails with this error:
Bad property set: [Testing this property] (Service: AmazonEC2; Status Code: 400; Error Code: InvalidParameterCombination; Request ID: 0XXXXXX-49c7-4b40-8bcc-76885dcXXXXX)
. -
getAffinity
Indicates whether the instance is associated with a dedicated host.If you want the instance to always restart on the same host on which it was launched, specify
host
. If you want the instance to restart on any available host, but try to launch onto the last host it ran on (on a best-effort basis), specifydefault
. -
setAffinity
Indicates whether the instance is associated with a dedicated host.If you want the instance to always restart on the same host on which it was launched, specify
host
. If you want the instance to restart on any available host, but try to launch onto the last host it ran on (on a best-effort basis), specifydefault
. -
getAvailabilityZone
The Availability Zone of the instance.If not specified, an Availability Zone will be automatically chosen for you based on the load balancing criteria for the Region.
This parameter is not supported by DescribeImageAttribute .
-
setAvailabilityZone
The Availability Zone of the instance.If not specified, an Availability Zone will be automatically chosen for you based on the load balancing criteria for the Region.
This parameter is not supported by DescribeImageAttribute .
-
getBlockDeviceMappings
The block device mapping entries that defines the block devices to attach to the instance at launch.By default, the block devices specified in the block device mapping for the AMI are used. You can override the AMI block device mapping using the instance block device mapping. For the root volume, you can override only the volume size, volume type, volume encryption settings, and the
DeleteOnTermination
setting.After the instance is running, you can modify only the
DeleteOnTermination
parameter for the attached volumes without interrupting the instance. Modifying any other parameter results in instance replacement . -
setBlockDeviceMappings
The block device mapping entries that defines the block devices to attach to the instance at launch.By default, the block devices specified in the block device mapping for the AMI are used. You can override the AMI block device mapping using the instance block device mapping. For the root volume, you can override only the volume size, volume type, volume encryption settings, and the
DeleteOnTermination
setting.After the instance is running, you can modify only the
DeleteOnTermination
parameter for the attached volumes without interrupting the instance. Modifying any other parameter results in instance replacement . -
setBlockDeviceMappings
The block device mapping entries that defines the block devices to attach to the instance at launch.By default, the block devices specified in the block device mapping for the AMI are used. You can override the AMI block device mapping using the instance block device mapping. For the root volume, you can override only the volume size, volume type, volume encryption settings, and the
DeleteOnTermination
setting.After the instance is running, you can modify only the
DeleteOnTermination
parameter for the attached volumes without interrupting the instance. Modifying any other parameter results in instance replacement . -
getCpuOptions
The CPU options for the instance.For more information, see Optimize CPU options in the Amazon Elastic Compute Cloud User Guide .
-
setCpuOptions
The CPU options for the instance.For more information, see Optimize CPU options in the Amazon Elastic Compute Cloud User Guide .
-
setCpuOptions
The CPU options for the instance.For more information, see Optimize CPU options in the Amazon Elastic Compute Cloud User Guide .
-
getCreditSpecification
The credit option for CPU usage of the burstable performance instance.Valid values are
standard
andunlimited
. 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) orunlimited
(T3/T3a/T4g instances)For T3 instances with
host
tenancy, onlystandard
is supported. -
setCreditSpecification
The credit option for CPU usage of the burstable performance instance.Valid values are
standard
andunlimited
. 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) orunlimited
(T3/T3a/T4g instances)For T3 instances with
host
tenancy, onlystandard
is supported. -
setCreditSpecification
@Stability(Stable) public void setCreditSpecification(@Nullable CfnInstance.CreditSpecificationProperty value) The credit option for CPU usage of the burstable performance instance.Valid values are
standard
andunlimited
. 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) orunlimited
(T3/T3a/T4g instances)For T3 instances with
host
tenancy, onlystandard
is supported. -
getDisableApiTermination
If you set this parameter totrue
, 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
toterminate
, you can terminate the instance by running the shutdown command from the instance.Default:
false
-
setDisableApiTermination
If you set this parameter totrue
, 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
toterminate
, you can terminate the instance by running the shutdown command from the instance.Default:
false
-
setDisableApiTermination
If you set this parameter totrue
, 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
toterminate
, you can terminate the instance by running the shutdown command from the instance.Default:
false
-
getEbsOptimized
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
-
setEbsOptimized
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
-
setEbsOptimized
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
-
getElasticGpuSpecifications
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 .
-
setElasticGpuSpecifications
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 .
-
setElasticGpuSpecifications
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 .
-
getElasticInferenceAccelerators
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, AWS 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.
-
setElasticInferenceAccelerators
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, AWS 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.
-
setElasticInferenceAccelerators
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, AWS 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.
-
getEnclaveOptions
Indicates whether the instance is enabled for AWS Nitro Enclaves. -
setEnclaveOptions
Indicates whether the instance is enabled for AWS Nitro Enclaves. -
setEnclaveOptions
@Stability(Stable) public void setEnclaveOptions(@Nullable CfnInstance.EnclaveOptionsProperty value) Indicates whether the instance is enabled for AWS Nitro Enclaves. -
getHibernationOptions
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 AWS Nitro Enclaves on the same instance.
-
setHibernationOptions
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 AWS Nitro Enclaves on the same instance.
-
setHibernationOptions
@Stability(Stable) public void setHibernationOptions(@Nullable CfnInstance.HibernationOptionsProperty value) 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 AWS Nitro Enclaves on the same instance.
-
getHostId
If you specify host for theAffinity
property, the ID of a dedicated host that the instance is associated with.If you don't specify an ID, Amazon EC2 launches the instance onto any available, compatible dedicated host in your account. This type of launch is called an untargeted launch. Note that for untargeted launches, you must have a compatible, dedicated host available to successfully launch instances.
-
setHostId
If you specify host for theAffinity
property, the ID of a dedicated host that the instance is associated with.If you don't specify an ID, Amazon EC2 launches the instance onto any available, compatible dedicated host in your account. This type of launch is called an untargeted launch. Note that for untargeted launches, you must have a compatible, dedicated host available to successfully launch instances.
-
getHostResourceGroupArn
The ARN of the host resource group in which to launch the instances.If you specify a host resource group ARN, omit the Tenancy parameter or set it to
host
. -
setHostResourceGroupArn
The ARN of the host resource group in which to launch the instances.If you specify a host resource group ARN, omit the Tenancy parameter or set it to
host
. -
getIamInstanceProfile
The name of an IAM instance profile.To create a new IAM instance profile, use the AWS::IAM::InstanceProfile resource.
-
setIamInstanceProfile
The name of an IAM instance profile.To create a new IAM instance profile, use the AWS::IAM::InstanceProfile resource.
-
getImageId
The ID of the AMI.An AMI ID is required to launch an instance and must be specified here or in a launch template.
-
setImageId
The ID of the AMI.An AMI ID is required to launch an instance and must be specified here or in a launch template.
-
getInstanceInitiatedShutdownBehavior
Indicates whether an instance stops or terminates when you initiate shutdown from the instance (using the operating system command for system shutdown).Default:
stop
-
setInstanceInitiatedShutdownBehavior
Indicates whether an instance stops or terminates when you initiate shutdown from the instance (using the operating system command for system shutdown).Default:
stop
-
getInstanceType
The instance type. For more information, see Instance types in the Amazon EC2 User Guide .Default:
m1.small
-
setInstanceType
The instance type. For more information, see Instance types in the Amazon EC2 User Guide .Default:
m1.small
-
getIpv6AddressCount
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.
-
setIpv6AddressCount
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.
-
getIpv6Addresses
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.
-
setIpv6Addresses
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.
-
setIpv6Addresses
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.
-
getKernelId
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 .
-
setKernelId
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 .
-
getKeyName
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.
-
setKeyName
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.
-
getLaunchTemplate
The launch template to use to launch the instances.Any parameters that you specify in the AWS CloudFormation template override the same parameters in the launch template. You can specify either the name or ID of a launch template, but not both.
-
setLaunchTemplate
The launch template to use to launch the instances.Any parameters that you specify in the AWS CloudFormation template override the same parameters in the launch template. You can specify either the name or ID of a launch template, but not both.
-
setLaunchTemplate
@Stability(Stable) public void setLaunchTemplate(@Nullable CfnInstance.LaunchTemplateSpecificationProperty value) The launch template to use to launch the instances.Any parameters that you specify in the AWS CloudFormation template override the same parameters in the launch template. You can specify either the name or ID of a launch template, but not both.
-
getLicenseSpecifications
The license configurations. -
setLicenseSpecifications
The license configurations. -
setLicenseSpecifications
The license configurations. -
getMonitoring
Specifies whether detailed monitoring is enabled for the instance.Specify
true
to enable detailed monitoring. Otherwise, basic monitoring is enabled. For more information about detailed monitoring, see Enable or turn off detailed monitoring for your instances in the Amazon EC2 User Guide . -
setMonitoring
Specifies whether detailed monitoring is enabled for the instance.Specify
true
to enable detailed monitoring. Otherwise, basic monitoring is enabled. For more information about detailed monitoring, see Enable or turn off detailed monitoring for your instances in the Amazon EC2 User Guide . -
setMonitoring
Specifies whether detailed monitoring is enabled for the instance.Specify
true
to enable detailed monitoring. Otherwise, basic monitoring is enabled. For more information about detailed monitoring, see Enable or turn off detailed monitoring for your instances in the Amazon EC2 User Guide . -
getNetworkInterfaces
The network interfaces to associate with the instance.If you use this property to point to a network interface, you must terminate the original interface before attaching a new one to allow the update of the instance to succeed.
If this resource has a public IP address and is also in a VPC that is defined in the same template, you must use the DependsOn Attribute to declare a dependency on the VPC-gateway attachment.
-
setNetworkInterfaces
The network interfaces to associate with the instance.If you use this property to point to a network interface, you must terminate the original interface before attaching a new one to allow the update of the instance to succeed.
If this resource has a public IP address and is also in a VPC that is defined in the same template, you must use the DependsOn Attribute to declare a dependency on the VPC-gateway attachment.
-
setNetworkInterfaces
The network interfaces to associate with the instance.If you use this property to point to a network interface, you must terminate the original interface before attaching a new one to allow the update of the instance to succeed.
If this resource has a public IP address and is also in a VPC that is defined in the same template, you must use the DependsOn Attribute to declare a dependency on the VPC-gateway attachment.
-
getPlacementGroupName
The name of an existing placement group that you want to launch the instance into (cluster | partition | spread). -
setPlacementGroupName
The name of an existing placement group that you want to launch the instance into (cluster | partition | spread). -
getPrivateDnsNameOptions
The options for the instance hostname. -
setPrivateDnsNameOptions
The options for the instance hostname. -
setPrivateDnsNameOptions
@Stability(Stable) public void setPrivateDnsNameOptions(@Nullable CfnInstance.PrivateDnsNameOptionsProperty value) The options for the instance hostname. -
getPrivateIpAddress
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.
If you make an update to an instance that requires replacement, you must assign a new private IP address. During a replacement, AWS CloudFormation creates a new instance but doesn't delete the old instance until the stack has successfully updated. If the stack update fails, AWS CloudFormation uses the old instance to roll back the stack to the previous working state. The old and new instances cannot have the same private IP address.
-
setPrivateIpAddress
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.
If you make an update to an instance that requires replacement, you must assign a new private IP address. During a replacement, AWS CloudFormation creates a new instance but doesn't delete the old instance until the stack has successfully updated. If the stack update fails, AWS CloudFormation uses the old instance to roll back the stack to the previous working state. The old and new instances cannot have the same private IP address.
-
getPropagateTagsToVolumeOnCreation
Indicates whether to assign the tags from the instance to all of the volumes attached to the instance at launch.If you specify
true
and you assign tags to the instance, those tags are automatically assigned to all of the volumes that you attach to the instance at launch. If you specifyfalse
, those tags are not assigned to the attached volumes. -
setPropagateTagsToVolumeOnCreation
Indicates whether to assign the tags from the instance to all of the volumes attached to the instance at launch.If you specify
true
and you assign tags to the instance, those tags are automatically assigned to all of the volumes that you attach to the instance at launch. If you specifyfalse
, those tags are not assigned to the attached volumes. -
setPropagateTagsToVolumeOnCreation
Indicates whether to assign the tags from the instance to all of the volumes attached to the instance at launch.If you specify
true
and you assign tags to the instance, those tags are automatically assigned to all of the volumes that you attach to the instance at launch. If you specifyfalse
, those tags are not assigned to the attached volumes. -
getRamdiskId
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 AWS 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 .
-
setRamdiskId
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 AWS 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 .
-
getSecurityGroupIds
The IDs of the security groups.You can specify the IDs of existing security groups and references to resources created by the stack template.
If you specify a network interface, you must specify any security groups as part of the network interface.
-
setSecurityGroupIds
The IDs of the security groups.You can specify the IDs of existing security groups and references to resources created by the stack template.
If you specify a network interface, you must specify any security groups as part of the network interface.
-
getSecurityGroups
[Default VPC] The names of the security groups. For a nondefault VPC, you must use security group IDs instead.You cannot specify this option and the network interfaces option in the same request. The list can contain both the name of existing Amazon EC2 security groups or references to AWS::EC2::SecurityGroup resources created in the template.
Default: Amazon EC2 uses the default security group.
-
setSecurityGroups
[Default VPC] The names of the security groups. For a nondefault VPC, you must use security group IDs instead.You cannot specify this option and the network interfaces option in the same request. The list can contain both the name of existing Amazon EC2 security groups or references to AWS::EC2::SecurityGroup resources created in the template.
Default: Amazon EC2 uses the default security group.
-
getSourceDestCheck
Enable or disable source/destination checks, which ensure that the instance is either the source or the destination of any traffic that it receives.If the value is
true
, source/destination checks are enabled; otherwise, they are disabled. The default value istrue
. You must disable source/destination checks if the instance runs services such as network address translation, routing, or firewalls. -
setSourceDestCheck
Enable or disable source/destination checks, which ensure that the instance is either the source or the destination of any traffic that it receives.If the value is
true
, source/destination checks are enabled; otherwise, they are disabled. The default value istrue
. You must disable source/destination checks if the instance runs services such as network address translation, routing, or firewalls. -
setSourceDestCheck
Enable or disable source/destination checks, which ensure that the instance is either the source or the destination of any traffic that it receives.If the value is
true
, source/destination checks are enabled; otherwise, they are disabled. The default value istrue
. You must disable source/destination checks if the instance runs services such as network address translation, routing, or firewalls. -
getSsmAssociations
The SSM document and parameter values in AWS Systems Manager to associate with this instance. To use this property, you must specify an IAM instance profile role for the instance. For more information, see Create an IAM instance profile for Systems Manager in the AWS Systems Manager User Guide .You can currently associate only one document with an instance.
-
setSsmAssociations
The SSM document and parameter values in AWS Systems Manager to associate with this instance. To use this property, you must specify an IAM instance profile role for the instance. For more information, see Create an IAM instance profile for Systems Manager in the AWS Systems Manager User Guide .You can currently associate only one document with an instance.
-
setSsmAssociations
The SSM document and parameter values in AWS Systems Manager to associate with this instance. To use this property, you must specify an IAM instance profile role for the instance. For more information, see Create an IAM instance profile for Systems Manager in the AWS Systems Manager User Guide .You can currently associate only one document with an instance.
-
getSubnetId
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.
-
setSubnetId
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.
-
getTenancy
The tenancy of the instance.An instance with a tenancy of
dedicated
runs on single-tenant hardware. -
setTenancy
The tenancy of the instance.An instance with a tenancy of
dedicated
runs on single-tenant hardware. -
getUserData
The user data script to make available to the instance.User data is limited to 16 KB. You must provide base64-encoded text. For more information, see Fn::Base64 .
User data runs only at instance launch. For more information, see Run commands on your Linux instance at launch and Run commands on your Windows instance at launch .
-
setUserData
The user data script to make available to the instance.User data is limited to 16 KB. You must provide base64-encoded text. For more information, see Fn::Base64 .
User data runs only at instance launch. For more information, see Run commands on your Linux instance at launch and Run commands on your Windows instance at launch .
-
getVolumes
The volumes to attach to the instance. -
setVolumes
The volumes to attach to the instance. -
setVolumes
The volumes to attach to the instance.
-