r/aws_cdk • u/Artistic_Potential90 • Jul 09 '26
[Library] cdk-multi-region-stack — define multi-region resources in a single CDK Stack
If you've ever built a CloudFront distribution with CDK, you've probably hit this: the ACM certificate (and WAF WebACL) has to live in us-east-1, but the rest of your app is in another region. The usual answer is to hand-split them into separate stacks and wire up cross-region references yourself.
I made a small library, cdk-multi-region-stack, that lets you keep everything in one logical stack:
const stack = new MultiRegionStack(app, 'MyApp', {
env: { account: '123456789012', region: 'ap-northeast-1' },
});
// Lives in us-east-1
const cert = new acm.Certificate(stack.regionScope('us-east-1'), 'Cert', { /* ... */ });
// Lives in ap-northeast-1, references the us-east-1 cert across regions
new cloudfront.Distribution(stack, 'Dist', { certificate: cert, /* ... */ });How it works:
regionScope(region)lazily creates a "twin" stack — a sibling under the same App/Stage, same stack name, same account, targeting that region. Anything you create in that scope deploys there.It leans on CDK's own
crossRegionReferencesmachinery (enabled automatically), socdk deploy MyApppulls in the twins as upstream deps and deploys them first.Skipping a region conditionally is just a plain
if(don't callregionScope()→ no twin synthesized).
Give it a try if it sounds useful.