This talk is about the journey of migrating the rootmail feature into a standalone
cdk construct. The challenges, obstacles and solution.
As mentioned in the linked post here
I wanted port the existing superwerker rootmail feature for AWS to cdk.
TL;DR
You can use the construct in your cdk app as follows:
import { Rootmail } from '@mavogel/awscdk-rootmail';
import {
App,
Stack,
StackProps,
aws_route53 as r53,
} from 'aws-cdk-lib';
import { Construct } from 'constructs';
export class BoostrapStack extends Stack {
constructor(scope: Construct, id: string, props: StackProps = {}) {
super(scope, id, props);
const domain = 'mycompany.test'
const hostedZone = r53.HostedZone.fromLookup(this, 'rootmail-parent-hosted-zone', {
domainName: domain,
});
new Rootmail(this, 'rootmail', {
// 1. a domain you own, registered via Route53 in the SAME account
domain: domain,
// 2. so the subdomain will be aws.mycompany.test and
subdomain: 'aws',
// wired / delegated automatically
wireDNSToHostedZoneID: hostedZone.hostedZoneId,
});
}
}Architecture
Next up is a short overview of the architecture:
All the lessons learned are documented in the linked blog post in the slides, also the associated repositories are the following:
- code here for awscdk-rootmail
- the released construct
- the corresponding npm package: @mavogel/awscdk-rootmail
Some impressions
Feel free to provide feedback in the form of issues or pull requests. There is also a CONTRIBUTING.md in the repository, which explains it in more detail.

