(aws-ec2) Support cfn-hup
See original GitHub issueLove the recent support for cfn-init and it makes life a lot better already, but it would be great if we can add support for cfn-hup too: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-hup.html
I tried to add support for cfn-hup in our application but found it very tedious to do as I will need to add a cfn-init command for the cfn-hup but it required the asg id which you cannot access at creation, I can use asg.applyCloudFormationInit
to solve it but it just looks so hacky.
I search around in issues/pull requests but couldn’t find one for this, so thought I would open one. I am happy to contribute this if no one already started.
Use Case
cfn-hup is really useful when/if we want to update our cfn-init without replacing the host, it makes cfn-init change really easy to apply without much disruption. (e.g. installing additional yum packages)
Proposed Solution
I proposed we build on top of the existing cfn-init solution, which should be trivial here (I think!)
Other
N/A
- 👋 I may be able to implement this feature request
- ⚠️ This feature might incur a breaking change (breaking as in we might need to change userdata which will trigger host replacements, need to double check this though might not need it)
This is a 🚀 Feature Request
Issue Analytics
- State:
- Created 3 years ago
- Reactions:11
- Comments:5 (3 by maintainers)
Top GitHub Comments
Hi all, in our case we have a lot of existing applications and 3rd party software that don’t support the instance replacement behavior, either way we want to automate the provisioning of that kind of instances and cloudformation has been key in the effort, but now we migrated everything from cfn to cdk and it would be nice that we can remove all the custom code used to work with cfn script helpers and used some cdk out-of-the-box implementation. I liked very much the cdk cfn-init implementation but is lacking the support for the cfn-hup.
I think that providing support for cfh hup will help a lot of people that is working with legacy software and applications.
Another use case: I have some legacy software which stores state locally on disk. I make sure this state is stored on a non-root volumes so that if the instance is replaced, I can just swap the volume over to the new instance, thus preserving the state. Automating this process in cloudformation would be horrible, and not much better in CDK. But, if I can reduce the number of instance replacements to an absolute minimum then it would be acceptable to handle the volume attachment manually. If, as @rix0rrr suggests, I just replace the instance every time, then the burden of moving around data volumes would probably cause me to look for an alternative to cloudformation/cdk.
Also, causing an instance replacement is not as simple as it sounds. Sure, there might be ways to make that easier, but rather than investing in making replacements easier, it seems to me that it would be better to invest in making them less necessary (by making cfn-hup easier to configure).
Fundamentally, I think most people would reasonably expect to be able to make changes to their cfn-init config in the template and have it automatically reflected on the instance. I was pretty shocked to discover that this isn’t the case. Yes, that’s a problem with cloudformation not CDK, but I think the problem can be addressed for more easily and elegantly in CDK than in raw cloudformation.