Class CfnInstancePropsMixin

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.Mixin
software.amazon.awscdk.cfnpropertymixins.services.ec2.CfnInstancePropsMixin
All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable, software.constructs.IMixin

@Generated(value="jsii-pacmak/1.127.0 (build 2117ad5)", date="2026-03-11T13:19:58.454Z") @Stability(Stable) public class CfnInstancePropsMixin extends Mixin implements software.constructs.IMixin
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.cfnpropertymixins.services.ec2.*;
 import software.amazon.awscdk.*;
 IMergeStrategy mergeStrategy;
 CfnInstancePropsMixin cfnInstancePropsMixin = CfnInstancePropsMixin.Builder.create(CfnInstanceMixinProps.builder()
         .additionalInfo("additionalInfo")
         .affinity("affinity")
         .availabilityZone("availabilityZone")
         .blockDeviceMappings(List.of(BlockDeviceMappingProperty.builder()
                 .deviceName("deviceName")
                 .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()
                 .count(123)
                 .type("type")
                 .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()
                 .launchTemplateId("launchTemplateId")
                 .launchTemplateName("launchTemplateName")
                 .version("version")
                 .build())
         .licenseSpecifications(List.of(LicenseSpecificationProperty.builder()
                 .licenseConfigurationArn("licenseConfigurationArn")
                 .build()))
         .metadataOptions(MetadataOptionsProperty.builder()
                 .httpEndpoint("httpEndpoint")
                 .httpProtocolIpv6("httpProtocolIpv6")
                 .httpPutResponseHopLimit(123)
                 .httpTokens("httpTokens")
                 .instanceMetadataTags("instanceMetadataTags")
                 .build())
         .monitoring(false)
         .networkInterfaces(List.of(NetworkInterfaceProperty.builder()
                 .associateCarrierIpAddress(false)
                 .associatePublicIpAddress(false)
                 .deleteOnTermination(false)
                 .description("description")
                 .deviceIndex("deviceIndex")
                 .enaSrdSpecification(EnaSrdSpecificationProperty.builder()
                         .enaSrdEnabled(false)
                         .enaSrdUdpSpecification(EnaSrdUdpSpecificationProperty.builder()
                                 .enaSrdUdpEnabled(false)
                                 .build())
                         .build())
                 .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()
                 .associationParameters(List.of(AssociationParameterProperty.builder()
                         .key("key")
                         .value(List.of("value"))
                         .build()))
                 .documentName("documentName")
                 .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())
 .strategy(mergeStrategy)
 .build();
 

See Also:
  • Field Details

    • CFN_PROPERTY_KEYS

      @Stability(Stable) protected static final List<String> CFN_PROPERTY_KEYS
  • Constructor Details

    • CfnInstancePropsMixin

      protected CfnInstancePropsMixin(software.amazon.jsii.JsiiObjectRef objRef)
    • CfnInstancePropsMixin

      protected CfnInstancePropsMixin(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • CfnInstancePropsMixin

      @Stability(Stable) public CfnInstancePropsMixin(@NotNull CfnInstanceMixinProps props, @Nullable CfnPropertyMixinOptions options)
      Create a mixin to apply properties to AWS::EC2::Instance.

      Parameters:
      props - L1 properties to apply. This parameter is required.
      options - Mixin options.
    • CfnInstancePropsMixin

      @Stability(Stable) public CfnInstancePropsMixin(@NotNull CfnInstanceMixinProps props)
      Create a mixin to apply properties to AWS::EC2::Instance.

      Parameters:
      props - L1 properties to apply. This parameter is required.
  • Method Details

    • applyTo

      @Stability(Stable) public void applyTo(@NotNull software.constructs.IConstruct construct)
      Apply the mixin properties to the construct.

      Specified by:
      applyTo in interface software.constructs.IMixin
      Specified by:
      applyTo in class Mixin
      Parameters:
      construct - This parameter is required.
    • supports

      @Stability(Stable) @NotNull public Boolean supports(@NotNull software.constructs.IConstruct construct)
      Check if this mixin supports the given construct.

      Specified by:
      supports in interface software.constructs.IMixin
      Overrides:
      supports in class Mixin
      Parameters:
      construct - This parameter is required.
    • getProps

      @Stability(Stable) @NotNull protected CfnInstanceMixinProps getProps()
    • getStrategy

      @Stability(Stable) @NotNull protected IMergeStrategy getStrategy()