Lately, I've found CloudFormation custom resources to be supremely helpful for many use cases. I actually wanted to write a post mimicking Real Ultimate Power:
Hi, this post is all about CloudFormation custom resources, REAL CUSTOM RESOURCES. This post is awesome. My name is Chase and I can't stop thinking about custom resources. These things are cool; and by cool, I mean totally sweet.
Trust me, it would have been hilarious, but rather than spend a whole post on a meme that's past its prime, let's take a look at the real reasons why custom resources are so powerful!
Custom resources are virtual CloudFormation resources that can invoke AWS Lambda functions. Inside the Lambda function you have access to the properties of the custom resource (which can include information about other resources in the same CloudFormation stack by way of Ref and Fn::GetAtt functions). The function can then do anything in the world as long as it (or another resource it invokes) reports success or failure back to CloudFormation within one hour. In the response to CloudFormation, the custom resource can provide data that can be referenced from other resources within the same stack.
Custom resources are such a fundamental resource that it isn't obvious at first glance all the use cases it enables. Because it can be invoked once or on every deployment, it's a powerful mechanism for lifecycle management of many resources. Here are a few examples:
You could even use custom resources to enable post-provisioning smoke/verification testing:
Honestly, while I have begun using custom resources for many use cases, I discover new use cases all the time. I feel like I have hardly scratched the surface of what's possible through custom resources.
And that's what I call REAL Ultimate Power!!!!!!!!!!!!!!!!!!