(ec2): Make it easy/possible to create persistent UserData on a Windows instance. #21708
Closed
2 tasks
Labels
@aws-cdk/aws-ec2
Related to Amazon Elastic Compute Cloud
effort/small
Small work item – less than a day of effort
feature-request
A feature should be added or improved.
p2
Describe the feature
By default, EC2 UserData is run once when an instance is first started after being provisioned. However, it is possible to persist that userdata so that it is run on every instance start. This is a request to expose that functionality in the UserData class for the CDK; specifically, for Windows.
On Linux systems, this persistence is achieved via multipart userdata as in this knowledgebase article. However, on Windows the persist flag must be set as a decorator to the userdata script itself -- outside of the tags (see the tag).
Right now, the only way to achieve this on Windows is through the use of an escape hatch with code that looks something like:
This is extremely non-obvious for anyone that isn't a fairly expert user of the CDK; just creating this code involved digging into the depths of the implementation of the ASG L2 construct.
Use Case
Anyone dynamically attaching their Windows instance to an Active Directory (AD) during instance startup needs this functionality; connecting to an AD involves rebooting the instance while running startup scripting both before and after that reboot.
Proposed Solution
I have a PR prepared and will be posting it momentarily.
Other Information
No response
Acknowledgements
CDK version used
2.38.1
Environment details (OS name and version, etc.)
Any
The text was updated successfully, but these errors were encountered: