Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ec2):
NatInstanceProviderV2
improvements (#29729)
### Issue # (if applicable) Closes #29720 Might fix other issues, will need check the backlog ### Reason for this change The user data script used to initialize NAT instances was at present incorrect, assuming an incorrect default interface name. I wanted to both update this script, and allow CDK users to update this user data if needed in the future, both in case of an issue with the script or just to extend/override the initialization procedure. ### Description of changes Apologies for the non-atomic PR, as I was working on the unit and integration tests, I noticed additional issues and missing features. These are the initially targeted changes: * Add `userData` field to `NatInstanceProps`, allowing the user to overwrite the NAT instances initialization script * Add static `NatInstanceProps.DEFAULT_USER_DATA_COMMANDS` field, allowing the user to more easily extend the default script * Fix default `userData` to query the instance `default` network interface, instead of always using `eth0` These were found along the way: * Add getter `gatewayInstances` method to `NatInstanceProps`, allowing the user to interact with the created NAT instances once they're attached to the VPC * This allowed me to give the instance role additional permissions, but has more potential uses * Fix `creditSpecification` not being implemented correctly * Updated existing unit and integ tests to increase coverage * Add warning in `README` about potential issues with NAT instances as is implemented ### Description of how you validated changes I've updated and added unit and integration tests ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information