Running code in a CloudFormation deployment
Before the availability of more sophisticated code-based solutions such as CDK or Terraform, AWS CloudFormation was the standard to automate AWS deployments for more than a decade. It started as a purely template solution but then introduced the ability to call functions with custom resource deployment.
While CloudFormation templates are not a fully fledged IaC solution, since it was the only AWS deployment solution for years, they are still present on many projects. Often, the effort of migrating to a tool such as CDK doesn’t justify the benefit, so instead, it makes sense to use CloudFormation’s advanced features and automation infrastructure, despite its limitations.
In this recipe, you’ll learn how to use CloudFormation custom resources to run your own code on deployment, which overcomes the limitations of templates. In this case, the code will be used to set up a file on S3, but the same concept can be used...