Deep DivesInfrastructure

Testing

Testing guide for the RawStack Infrastructure component.

CDK assertions

CDK stacks can be tested with the aws-cdk-lib/assertions module, which lets you assert against the synthesised CloudFormation template without deploying anything.

npm run test

Preview before deploying

Always run a diff before deploying to catch unintended changes — especially resource replacements (which cause downtime) or deletions:

npm run cdk diff

Pay attention to resources marked with ~ (update), + (create), and - (destroy). A - on a stateful resource like RDS or ElastiCache requires careful review.

Synthesise templates

To inspect the raw CloudFormation templates that CDK will deploy:

npm run cdk synth

Templates are written to cdk.out/. They can be reviewed manually or checked into version control for auditing.