question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(aws-ec2) Support cfn-hup

See original GitHub issue

Love 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:open
  • Created 3 years ago
  • Reactions:11
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
hnajeracommented, Jun 2, 2021

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.

0reactions
tstibbscommented, Oct 14, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

cfn-hup - AWS CloudFormation
Description. The cfn-hup helper is a daemon that detects changes in resource metadata and runs user-specified actions when a change is detected.
Read more >
cfn-hup - Amazon CloudFormation - 亚马逊云科技
The cfn-hup helper is a daemon that detects changes in resource metadata and runs user-specified actions when a change is detected. This allows...
Read more >
how to configure cfn-hup helper script? #14855 - aws/aws-cdk
I'm implementing the cfn-hub configuration because I didn't see any feature for that in the cdk documentation. ... ec2.InitFile.fromString('/etc/ ...
Read more >
cfn-hup Archives - Jayendra's Cloud Certification Blog
AWS CloudFormation helper scripts can be used to install software and start services on an EC2 instance created as a part of the...
Read more >
Helper scripts - AWS CloudFormation Workshop
The helper scripts come pre-installed on Amazon Linux and can be updated ... Installing the cfn-hup helper script enables existing EC2 instances to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found