aws-cdk-lib.aws_autoscaling.CfnLaunchConfiguration

class CfnLaunchConfiguration (construct)

LanguageType name
.NETAmazon.CDK.AWS.AutoScaling.CfnLaunchConfiguration
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsautoscaling#CfnLaunchConfiguration
Javasoftware.amazon.awscdk.services.autoscaling.CfnLaunchConfiguration
Pythonaws_cdk.aws_autoscaling.CfnLaunchConfiguration
TypeScript aws-cdk-lib » aws_autoscaling » CfnLaunchConfiguration

Implements IConstruct, IDependable, IInspectable

A CloudFormation AWS::AutoScaling::LaunchConfiguration.

The AWS::AutoScaling::LaunchConfiguration resource specifies the launch configuration that can be used by an Auto Scaling group to configure Amazon EC2 instances.

When you update the launch configuration for an Auto Scaling group, CloudFormation deletes that resource and creates a new launch configuration with the updated properties and a new name. Existing instances are not affected. To update existing instances when you update the AWS::AutoScaling::LaunchConfiguration resource, you can specify an UpdatePolicy attribute for the group. You can find sample update policies for rolling updates in Auto scaling template snippets .

Amazon EC2 Auto Scaling configures instances launched as part of an Auto Scaling group using either a launch template or a launch configuration. We strongly recommend that you do not use launch configurations. They do not provide full functionality for Amazon EC2 Auto Scaling or Amazon EC2. For more information, see Launch configurations and Migrate AWS CloudFormation stacks from launch configurations to launch templates in the Amazon EC2 Auto Scaling User Guide .

Example

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_autoscaling as autoscaling } from 'aws-cdk-lib';
const cfnLaunchConfiguration = new autoscaling.CfnLaunchConfiguration(this, 'MyCfnLaunchConfiguration', {
  imageId: 'imageId',
  instanceType: 'instanceType',

  // the properties below are optional
  associatePublicIpAddress: false,
  blockDeviceMappings: [{
    deviceName: 'deviceName',

    // the properties below are optional
    ebs: {
      deleteOnTermination: false,
      encrypted: false,
      iops: 123,
      snapshotId: 'snapshotId',
      throughput: 123,
      volumeSize: 123,
      volumeType: 'volumeType',
    },
    noDevice: false,
    virtualName: 'virtualName',
  }],
  classicLinkVpcId: 'classicLinkVpcId',
  classicLinkVpcSecurityGroups: ['classicLinkVpcSecurityGroups'],
  ebsOptimized: false,
  iamInstanceProfile: 'iamInstanceProfile',
  instanceId: 'instanceId',
  instanceMonitoring: false,
  kernelId: 'kernelId',
  keyName: 'keyName',
  launchConfigurationName: 'launchConfigurationName',
  metadataOptions: {
    httpEndpoint: 'httpEndpoint',
    httpPutResponseHopLimit: 123,
    httpTokens: 'httpTokens',
  },
  placementTenancy: 'placementTenancy',
  ramDiskId: 'ramDiskId',
  securityGroups: ['securityGroups'],
  spotPrice: 'spotPrice',
  userData: 'userData',
});

Initializer

new CfnLaunchConfiguration(scope: Construct, id: string, props: CfnLaunchConfigurationProps)

Parameters

  • scope Construct — - scope in which this resource is defined.
  • id string — - scoped id of the resource.
  • props CfnLaunchConfigurationProps — - resource properties.

Create a new AWS::AutoScaling::LaunchConfiguration.

Construct Props

NameTypeDescription
imageIdstringThe ID of the Amazon Machine Image (AMI) that was assigned during registration.
instanceTypestringSpecifies the instance type of the EC2 instance.
associatePublicIpAddress?boolean | IResolvableSpecifies whether to assign a public IPv4 address to the group's instances.
blockDeviceMappings?IResolvable | IResolvable | BlockDeviceMappingProperty[]The block device mapping entries that define the block devices to attach to the instances at launch.
classicLinkVpcId?stringAvailable for backward compatibility.
classicLinkVpcSecurityGroups?string[]Available for backward compatibility.
ebsOptimized?boolean | IResolvableSpecifies whether the launch configuration is optimized for EBS I/O ( true ) or not ( false ).
iamInstanceProfile?stringThe name or the Amazon Resource Name (ARN) of the instance profile associated with the IAM role for the instance.
instanceId?stringThe ID of the Amazon EC2 instance to use to create the launch configuration.
instanceMonitoring?boolean | IResolvableControls whether instances in this group are launched with detailed ( true ) or basic ( false ) monitoring.
kernelId?stringThe ID of the kernel associated with the AMI.
keyName?stringThe name of the key pair.
launchConfigurationName?stringThe name of the launch configuration.
metadataOptions?IResolvable | MetadataOptionsPropertyThe metadata options for the instances.
placementTenancy?stringThe tenancy of the instance, either default or dedicated .
ramDiskId?stringThe ID of the RAM disk to select.
securityGroups?string[]A list that contains the security groups to assign to the instances in the Auto Scaling group.
spotPrice?stringThe maximum hourly price to be paid for any Spot Instance launched to fulfill the request.
userData?stringThe Base64-encoded user data to make available to the launched EC2 instances.

imageId

Type: string

The ID of the Amazon Machine Image (AMI) that was assigned during registration.

For more information, see Finding a Linux AMI in the Amazon EC2 User Guide for Linux Instances .

If you specify InstanceId , an ImageId is not required.


instanceType

Type: string

Specifies the instance type of the EC2 instance.

For information about available instance types, see Available instance types in the Amazon EC2 User Guide for Linux Instances .

If you specify InstanceId , an InstanceType is not required.


associatePublicIpAddress?

Type: boolean | IResolvable (optional)

Specifies whether to assign a public IPv4 address to the group's instances.

If the instance is launched into a default subnet, the default is to assign a public IPv4 address, unless you disabled the option to assign a public IPv4 address on the subnet. If the instance is launched into a nondefault subnet, the default is not to assign a public IPv4 address, unless you enabled the option to assign a public IPv4 address on the subnet.

If you specify true , each instance in the Auto Scaling group receives a unique public IPv4 address. For more information, see Launching Auto Scaling instances in a VPC in the Amazon EC2 Auto Scaling User Guide .

If you specify this property, you must specify at least one subnet for VPCZoneIdentifier when you create your group.


blockDeviceMappings?

Type: IResolvable | IResolvable | BlockDeviceMappingProperty[] (optional)

The block device mapping entries that define the block devices to attach to the instances at launch.

By default, the block devices specified in the block device mapping for the AMI are used. For more information, see Block device mappings in the Amazon EC2 User Guide for Linux Instances .


classicLinkVpcId?

Type: string (optional)

Available for backward compatibility.


classicLinkVpcSecurityGroups?

Type: string[] (optional)

Available for backward compatibility.


ebsOptimized?

Type: boolean | IResolvable (optional)

Specifies whether the launch configuration is optimized for EBS I/O ( true ) or not ( false ).

The optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal I/O performance. This optimization is not available with all instance types. Additional fees are incurred when you enable EBS optimization for an instance type that is not EBS-optimized by default. For more information, see Amazon EBS-optimized instances in the Amazon EC2 User Guide for Linux Instances .

The default value is false .


iamInstanceProfile?

Type: string (optional)

The name or the Amazon Resource Name (ARN) of the instance profile associated with the IAM role for the instance.

The instance profile contains the IAM role. For more information, see IAM role for applications that run on Amazon EC2 instances in the Amazon EC2 Auto Scaling User Guide .


instanceId?

Type: string (optional)

The ID of the Amazon EC2 instance to use to create the launch configuration.

When you use an instance to create a launch configuration, all properties are derived from the instance with the exception of BlockDeviceMapping and AssociatePublicIpAddress . You can override any properties from the instance by specifying them in the launch configuration.


instanceMonitoring?

Type: boolean | IResolvable (optional)

Controls whether instances in this group are launched with detailed ( true ) or basic ( false ) monitoring.

The default value is true (enabled).

When detailed monitoring is enabled, Amazon CloudWatch generates metrics every minute and your account is charged a fee. When you disable detailed monitoring, CloudWatch generates metrics every 5 minutes. For more information, see Configure Monitoring for Auto Scaling Instances in the Amazon EC2 Auto Scaling User Guide .


kernelId?

Type: string (optional)

The ID of the kernel associated with the AMI.

We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see User provided kernels in the Amazon EC2 User Guide for Linux Instances .


keyName?

Type: string (optional)

The name of the key pair.

For more information, see Amazon EC2 key pairs and Linux instances in the Amazon EC2 User Guide for Linux Instances .


launchConfigurationName?

Type: string (optional)

The name of the launch configuration.

This name must be unique per Region per account.


metadataOptions?

Type: IResolvable | MetadataOptionsProperty (optional)

The metadata options for the instances.

For more information, see Configuring the Instance Metadata Options in the Amazon EC2 Auto Scaling User Guide .


placementTenancy?

Type: string (optional)

The tenancy of the instance, either default or dedicated .

An instance with dedicated tenancy runs on isolated, single-tenant hardware and can only be launched into a VPC. To launch dedicated instances into a shared tenancy VPC (a VPC with the instance placement tenancy attribute set to default ), you must set the value of this property to dedicated . For more information, see Configuring instance tenancy with Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide .

If you specify PlacementTenancy , you must specify at least one subnet for VPCZoneIdentifier when you create your group.

Valid values: default | dedicated


ramDiskId?

Type: string (optional)

The ID of the RAM disk to select.

We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see User provided kernels in the Amazon EC2 User Guide for Linux Instances .


securityGroups?

Type: string[] (optional)

A list that contains the security groups to assign to the instances in the Auto Scaling group.

The list can contain both the IDs of existing security groups and references to SecurityGroup resources created in the template.

For more information, see Control traffic to resources using security groups in the Amazon Virtual Private Cloud User Guide .


spotPrice?

Type: string (optional)

The maximum hourly price to be paid for any Spot Instance launched to fulfill the request.

Spot Instances are launched when the price you specify exceeds the current Spot price. For more information, see Request Spot Instances for fault-tolerant and flexible applications in the Amazon EC2 Auto Scaling User Guide .

Valid Range: Minimum value of 0.001

When you change your maximum price by creating a new launch configuration, running instances will continue to run as long as the maximum price for those running instances is higher than the current Spot price.


userData?

Type: string (optional)

The Base64-encoded user data to make available to the launched EC2 instances.

For more information, see Instance metadata and user data in the Amazon EC2 User Guide for Linux Instances .

Properties

NameTypeDescription
cfnOptionsICfnResourceOptionsOptions for this resource, such as condition, update policy etc.
cfnProperties{ [string]: any }
cfnResourceTypestringAWS resource type.
creationStackstring[]
imageIdstringThe ID of the Amazon Machine Image (AMI) that was assigned during registration.
instanceTypestringSpecifies the instance type of the EC2 instance.
logicalIdstringThe logical ID for this CloudFormation stack element.
nodeNodeThe tree node.
refstringReturn a string that will be resolved to a CloudFormation { Ref } for this element.
stackStackThe stack in which this element is defined.
associatePublicIpAddress?boolean | IResolvableSpecifies whether to assign a public IPv4 address to the group's instances.
blockDeviceMappings?IResolvable | IResolvable | BlockDeviceMappingProperty[]The block device mapping entries that define the block devices to attach to the instances at launch.
classicLinkVpcId?stringAvailable for backward compatibility.
classicLinkVpcSecurityGroups?string[]Available for backward compatibility.
ebsOptimized?boolean | IResolvableSpecifies whether the launch configuration is optimized for EBS I/O ( true ) or not ( false ).
iamInstanceProfile?stringThe name or the Amazon Resource Name (ARN) of the instance profile associated with the IAM role for the instance.
instanceId?stringThe ID of the Amazon EC2 instance to use to create the launch configuration.
instanceMonitoring?boolean | IResolvableControls whether instances in this group are launched with detailed ( true ) or basic ( false ) monitoring.
kernelId?stringThe ID of the kernel associated with the AMI.
keyName?stringThe name of the key pair.
launchConfigurationName?stringThe name of the launch configuration.
metadataOptions?IResolvable | MetadataOptionsPropertyThe metadata options for the instances.
placementTenancy?stringThe tenancy of the instance, either default or dedicated .
ramDiskId?stringThe ID of the RAM disk to select.
securityGroups?string[]A list that contains the security groups to assign to the instances in the Auto Scaling group.
spotPrice?stringThe maximum hourly price to be paid for any Spot Instance launched to fulfill the request.
userData?stringThe Base64-encoded user data to make available to the launched EC2 instances.
static CFN_RESOURCE_TYPE_NAMEstringThe CloudFormation resource type name for this resource class.

cfnOptions

Type: ICfnResourceOptions

Options for this resource, such as condition, update policy etc.


cfnProperties

Type: { [string]: any }


cfnResourceType

Type: string

AWS resource type.


creationStack

Type: string[]


imageId

Type: string

The ID of the Amazon Machine Image (AMI) that was assigned during registration.

For more information, see Finding a Linux AMI in the Amazon EC2 User Guide for Linux Instances .

If you specify InstanceId , an ImageId is not required.


instanceType

Type: string

Specifies the instance type of the EC2 instance.

For information about available instance types, see Available instance types in the Amazon EC2 User Guide for Linux Instances .

If you specify InstanceId , an InstanceType is not required.


logicalId

Type: string

The logical ID for this CloudFormation stack element.

The logical ID of the element is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).


node

Type: Node

The tree node.


ref

Type: string

Return a string that will be resolved to a CloudFormation { Ref } for this element.

If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through Lazy.any({ produce: resource.ref }).


stack

Type: Stack

The stack in which this element is defined.

CfnElements must be defined within a stack scope (directly or indirectly).


associatePublicIpAddress?

Type: boolean | IResolvable (optional)

Specifies whether to assign a public IPv4 address to the group's instances.

If the instance is launched into a default subnet, the default is to assign a public IPv4 address, unless you disabled the option to assign a public IPv4 address on the subnet. If the instance is launched into a nondefault subnet, the default is not to assign a public IPv4 address, unless you enabled the option to assign a public IPv4 address on the subnet.

If you specify true , each instance in the Auto Scaling group receives a unique public IPv4 address. For more information, see Launching Auto Scaling instances in a VPC in the Amazon EC2 Auto Scaling User Guide .

If you specify this property, you must specify at least one subnet for VPCZoneIdentifier when you create your group.


blockDeviceMappings?

Type: IResolvable | IResolvable | BlockDeviceMappingProperty[] (optional)

The block device mapping entries that define the block devices to attach to the instances at launch.

By default, the block devices specified in the block device mapping for the AMI are used. For more information, see Block device mappings in the Amazon EC2 User Guide for Linux Instances .


classicLinkVpcId?

Type: string (optional)

Available for backward compatibility.


classicLinkVpcSecurityGroups?

Type: string[] (optional)

Available for backward compatibility.


ebsOptimized?

Type: boolean | IResolvable (optional)

Specifies whether the launch configuration is optimized for EBS I/O ( true ) or not ( false ).

The optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal I/O performance. This optimization is not available with all instance types. Additional fees are incurred when you enable EBS optimization for an instance type that is not EBS-optimized by default. For more information, see Amazon EBS-optimized instances in the Amazon EC2 User Guide for Linux Instances .

The default value is false .


iamInstanceProfile?

Type: string (optional)

The name or the Amazon Resource Name (ARN) of the instance profile associated with the IAM role for the instance.

The instance profile contains the IAM role. For more information, see IAM role for applications that run on Amazon EC2 instances in the Amazon EC2 Auto Scaling User Guide .


instanceId?

Type: string (optional)

The ID of the Amazon EC2 instance to use to create the launch configuration.

When you use an instance to create a launch configuration, all properties are derived from the instance with the exception of BlockDeviceMapping and AssociatePublicIpAddress . You can override any properties from the instance by specifying them in the launch configuration.


instanceMonitoring?

Type: boolean | IResolvable (optional)

Controls whether instances in this group are launched with detailed ( true ) or basic ( false ) monitoring.

The default value is true (enabled).

When detailed monitoring is enabled, Amazon CloudWatch generates metrics every minute and your account is charged a fee. When you disable detailed monitoring, CloudWatch generates metrics every 5 minutes. For more information, see Configure Monitoring for Auto Scaling Instances in the Amazon EC2 Auto Scaling User Guide .


kernelId?

Type: string (optional)

The ID of the kernel associated with the AMI.

We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see User provided kernels in the Amazon EC2 User Guide for Linux Instances .


keyName?

Type: string (optional)

The name of the key pair.

For more information, see Amazon EC2 key pairs and Linux instances in the Amazon EC2 User Guide for Linux Instances .


launchConfigurationName?

Type: string (optional)

The name of the launch configuration.

This name must be unique per Region per account.


metadataOptions?

Type: IResolvable | MetadataOptionsProperty (optional)

The metadata options for the instances.

For more information, see Configuring the Instance Metadata Options in the Amazon EC2 Auto Scaling User Guide .


placementTenancy?

Type: string (optional)

The tenancy of the instance, either default or dedicated .

An instance with dedicated tenancy runs on isolated, single-tenant hardware and can only be launched into a VPC. To launch dedicated instances into a shared tenancy VPC (a VPC with the instance placement tenancy attribute set to default ), you must set the value of this property to dedicated . For more information, see Configuring instance tenancy with Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide .

If you specify PlacementTenancy , you must specify at least one subnet for VPCZoneIdentifier when you create your group.

Valid values: default | dedicated


ramDiskId?

Type: string (optional)

The ID of the RAM disk to select.

We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see User provided kernels in the Amazon EC2 User Guide for Linux Instances .


securityGroups?

Type: string[] (optional)

A list that contains the security groups to assign to the instances in the Auto Scaling group.

The list can contain both the IDs of existing security groups and references to SecurityGroup resources created in the template.

For more information, see Control traffic to resources using security groups in the Amazon Virtual Private Cloud User Guide .


spotPrice?

Type: string (optional)

The maximum hourly price to be paid for any Spot Instance launched to fulfill the request.

Spot Instances are launched when the price you specify exceeds the current Spot price. For more information, see Request Spot Instances for fault-tolerant and flexible applications in the Amazon EC2 Auto Scaling User Guide .

Valid Range: Minimum value of 0.001

When you change your maximum price by creating a new launch configuration, running instances will continue to run as long as the maximum price for those running instances is higher than the current Spot price.


userData?

Type: string (optional)

The Base64-encoded user data to make available to the launched EC2 instances.

For more information, see Instance metadata and user data in the Amazon EC2 User Guide for Linux Instances .


static CFN_RESOURCE_TYPE_NAME

Type: string

The CloudFormation resource type name for this resource class.

Methods

NameDescription
addDeletionOverride(path)Syntactic sugar for addOverride(path, undefined).
addDependency(target)Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
addDependsOn(target)⚠️Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
addMetadata(key, value)Add a value to the CloudFormation Resource Metadata.
addOverride(path, value)Adds an override to the synthesized CloudFormation resource.
addPropertyDeletionOverride(propertyPath)Adds an override that deletes the value of a property from the resource definition.
addPropertyOverride(propertyPath, value)Adds an override to a resource property.
applyRemovalPolicy(policy?, options?)Sets the deletion policy of the resource based on the removal policy specified.
getAtt(attributeName, typeHint?)Returns a token for an runtime attribute of this resource.
getMetadata(key)Retrieve a value value from the CloudFormation Resource Metadata.
inspect(inspector)Examines the CloudFormation resource and discloses attributes.
obtainDependencies()Retrieves an array of resources this resource depends on.
obtainResourceDependencies()Get a shallow copy of dependencies between this resource and other resources in the same stack.
overrideLogicalId(newLogicalId)Overrides the auto-generated logical ID with a specific ID.
removeDependency(target)Indicates that this resource no longer depends on another resource.
replaceDependency(target, newTarget)Replaces one dependency with another.
toString()Returns a string representation of this construct.
protected renderProperties(props)

addDeletionOverride(path)

public addDeletionOverride(path: string): void

Parameters

  • path string — The path of the value to delete.

Syntactic sugar for addOverride(path, undefined).


addDependency(target)

public addDependency(target: CfnResource): void

Parameters

  • target CfnResource

Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.

This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.


addDependsOn(target)⚠️

public addDependsOn(target: CfnResource): void

⚠️ Deprecated: use addDependency

Parameters

  • target CfnResource

Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.


addMetadata(key, value)

public addMetadata(key: string, value: any): void

Parameters

  • key string
  • value any

Add a value to the CloudFormation Resource Metadata.

See also: [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html

Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html

Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.)


addOverride(path, value)

public addOverride(path: string, value: any): void

Parameters

  • path string — - The path of the property, you can use dot notation to override values in complex types.
  • value any — - The value.

Adds an override to the synthesized CloudFormation resource.

To add a property override, either use addPropertyOverride or prefix path with "Properties." (i.e. Properties.TopicName).

If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.

To include a literal . in the property name, prefix with a \. In most programming languages you will need to write this as "\\." because the \ itself will need to be escaped.

For example,

cfnResource.addOverride('Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes', ['myattribute']);
cfnResource.addOverride('Properties.GlobalSecondaryIndexes.1.ProjectionType', 'INCLUDE');

would add the overrides

"Properties": {
  "GlobalSecondaryIndexes": [
    {
      "Projection": {
        "NonKeyAttributes": [ "myattribute" ]
        ...
      }
      ...
    },
    {
      "ProjectionType": "INCLUDE"
      ...
    },
  ]
  ...
}

The value argument to addOverride will not be processed or translated in any way. Pass raw JSON values in here with the correct capitalization for CloudFormation. If you pass CDK classes or structs, they will be rendered with lowercased key names, and CloudFormation will reject the template.


addPropertyDeletionOverride(propertyPath)

public addPropertyDeletionOverride(propertyPath: string): void

Parameters

  • propertyPath string — The path to the property.

Adds an override that deletes the value of a property from the resource definition.


addPropertyOverride(propertyPath, value)

public addPropertyOverride(propertyPath: string, value: any): void

Parameters

  • propertyPath string — The path of the property.
  • value any — The value.

Adds an override to a resource property.

Syntactic sugar for addOverride("Properties.<...>", value).


applyRemovalPolicy(policy?, options?)

public applyRemovalPolicy(policy?: RemovalPolicy, options?: RemovalPolicyOptions): void

Parameters

  • policy RemovalPolicy
  • options RemovalPolicyOptions

Sets the deletion policy of the resource based on the removal policy specified.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN). In some cases, a snapshot can be taken of the resource prior to deletion (RemovalPolicy.SNAPSHOT). A list of resources that support this policy can be found in the following link:

See also: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html#aws-attribute-deletionpolicy-options


getAtt(attributeName, typeHint?)

public getAtt(attributeName: string, typeHint?: ResolutionTypeHint): Reference

Parameters

  • attributeName string — The name of the attribute.
  • typeHint ResolutionTypeHint

Returns

  • Reference

Returns a token for an runtime attribute of this resource.

Ideally, use generated attribute accessors (e.g. resource.arn), but this can be used for future compatibility in case there is no generated attribute.


getMetadata(key)

public getMetadata(key: string): any

Parameters

  • key string

Returns

  • any

Retrieve a value value from the CloudFormation Resource Metadata.

See also: [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html

Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html

Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.)


inspect(inspector)

public inspect(inspector: TreeInspector): void

Parameters

  • inspector TreeInspector — - tree inspector to collect and process attributes.

Examines the CloudFormation resource and discloses attributes.


obtainDependencies()

public obtainDependencies(): Stack &#124; CfnResource[]

Returns

  • Stack | CfnResource[]

Retrieves an array of resources this resource depends on.

This assembles dependencies on resources across stacks (including nested stacks) automatically.


obtainResourceDependencies()

public obtainResourceDependencies(): CfnResource[]

Returns

  • CfnResource[]

Get a shallow copy of dependencies between this resource and other resources in the same stack.


overrideLogicalId(newLogicalId)

public overrideLogicalId(newLogicalId: string): void

Parameters

  • newLogicalId string — The new logical ID to use for this stack element.

Overrides the auto-generated logical ID with a specific ID.


removeDependency(target)

public removeDependency(target: CfnResource): void

Parameters

  • target CfnResource

Indicates that this resource no longer depends on another resource.

This can be used for resources across stacks (including nested stacks) and the dependency will automatically be removed from the relevant scope.


replaceDependency(target, newTarget)

public replaceDependency(target: CfnResource, newTarget: CfnResource): void

Parameters

  • target CfnResource — The dependency to replace.
  • newTarget CfnResource — The new dependency to add.

Replaces one dependency with another.


toString()

public toString(): string

Returns

  • string

Returns a string representation of this construct.


protected renderProperties(props)

protected renderProperties(props: { [string]: any }): { [string]: any }

Parameters

  • props { [string]: any }

Returns

  • { [string]: any }