aws-cdk icon indicating copy to clipboard operation
aws-cdk copied to clipboard

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

Open SokiKawashima opened this issue 1 year ago • 1 comments

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

  • [x] 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

SokiKawashima avatar Feb 16 '25 16:02 SokiKawashima

Comments on closed issues and PRs are hard for our team to see. If you need help, please open a new issue that references this one.

github-actions[bot] avatar Feb 16 '25 17:02 github-actions[bot]