Using cfn-signal to inform CloudFormation about resource readiness
CloudFormation reports resource readiness as soon as it retrieves a response from AWS’s API that the resource is created. By this, we understand that if we create a Relational Database Service (RDS) instance and CloudFormation tells us that it’s created, then we can connect to it right away.
While this is applicable for most of the managed services at AWS, it doesn’t work on services that we run based on EC2. You see, CloudFormation is not aware that EC2 has a job to run and reports Done
once the instance is in a Running
state.
For small development environments, this might be fine, but imagine running a web application on an AutoScaling
group. While the instance takes time to install packages and start services, AutoScaling
reports that the instance is unhealthy and terminates it. A new one starts, time passes, and then it gets terminated. The worst thing here is that CloudFormation will...