Skip to content

ec2-alpha: Incorrect 'domain' property for CfnEIP in NAT Gateway creation #33469

@SokiKawashima

Description

@SokiKawashima

Describe the feature

The current implementation of CfnEIP in ec2-alpha uses props.vpc?.vpcId for the domain property when creating a NAT Gateway. However, according to the AWS CloudFormation Documentation, the domain should be set to the string "vpc" when creating an Elastic IP for a VPC.

Use Case

When deploying a NAT Gateway using CfnEIP, CloudFormation may fail due to an invalid domain property. This causes frustration for users because they must manually override the property to avoid deployment errors.

Additionally, correcting this behavior will align the CDK implementation with AWS CloudFormation standards and reduce unexpected failures.

Proposed Solution

Modify the CfnEIP definition in ec2-alpha to ensure that the domain property is always set to "vpc" for VPC-associated Elastic IPs.

let eip = new CfnEIP(this, 'EIP', {
  domain: 'vpc',
});

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.178.2

Environment details (OS name and version, etc.)

MacOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions