aws-ec2: Support EC2Launch v2 userdata
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the feature
[EC2Launch v2](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2launch-v2.html) supports [passing YAML data as userdata](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2launch-v2-settings.html#ec2launch-v2-example-user-data) instead of the legacy XML formatted user data currently produced by `UserData.forWindows()`.
### Use Case
While EC2Launch v2 is backward compatible with the legacy v1, [that format is less configurable than the yaml format](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html#ec2-windows-user-data).
### Proposed Solution
I think a `UserData.forWindowsV2()` or similar is preferable instead of having a flag switching the behaviour of the current class due to the more numerous available task definitions that can directly be employed. `addS3DownloadCommand()` would still need to be a bespoke script as there are no predefined tasks for this.
### Other Information
Task definitions that can be used in user data can be found at https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2launch-v2-task-definitions.html
EC2Launch v2 has existed for over five years now so it might be mature enought to warrant direct support in CDK.
### Acknowledgements
- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change
### AWS CDK Library version (aws-cdk-lib)
2.231.0
### AWS CDK CLI version
2.1102.0
### Environment details (OS name and version, etc.)
Ubuntu
Contributor guide
Research direction
Start by reading the current UserData.forWindows() implementation and the EC2Launch v2 task definitions linked in the issue. Define the V2 user-data API, including how addS3DownloadCommand() remains a bespoke script, and consider how the available task definitions should be exposed; done means CDK can generate YAML-based EC2Launch v2 userdata without changing legacy behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud, infrastructure
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100