AWS CDK with CloudFormation
Deploy an AWS CDK application through the native aws/cloudformation component. A before-hook synthesizes the template, Atmos previews and deploys it, and a local Floci AWS emulator stands in for an…
Try it out
- Install Atmos
- Try the example
Copy the example into a new directory and make it your own:
atmos init examples/cdk-cloudformation
cd cdk-cloudformation
Follow the README for prerequisites and next steps.
See it in action
RECORDED DEMO Notes
This example is the native CloudFormation track of the
Deploy AWS CDK with lifecycle hooks
tutorial. A TypeScript AWS CDK app in components/cloudformation/greeting/ creates one
AWS::SSM::Parameter. The component's synth hook installs dependencies when package-lock.json changed or the CLI is missing, then runs
npm run synth before diff, apply, and changeset create, so Atmos always reads a freshly
synthesized cdk.out/Demo.template.json. Deployment state stays in CloudFormation.
The local stack declares a Floci AWS emulator and
an aws/emulator identity in atmos.yaml points the component at it, so no AWS account is
needed. Remove that identity and the emulator import to deploy to a real account.
Requirements: Node.js 22 or later, npm, and Docker or Podman for the emulator.
Usage
atmos validate stacksatmos emulator up aws -s localatmos aws cloudformation diff greeting -s localatmos aws cloudformation deploy greeting -s localatmos aws cloudformation output greeting -s localatmos aws cloudformation delete greeting -s local --auto-approveatmos emulator down aws -s local
Change parameters.Message in stacks/deploy/local.yaml and run diff again to see the
synthesized template re-read. render and validate do not fire the hook; run
npm --prefix components/cloudformation/greeting run synth (after an initial npm ci) before
those commands.
Run the whole lifecycle with atmos test.