About migrating the rootmail feature to cdk
Photo by MV Consulting
Talk

About migrating the rootmail feature to cdk

The story of the migration of the opinionated rootmail from superwerker on AWS to cdk and the learnings.

  • Date: 18 Oct, 2023
  • Client: AWS UG Frankfurt
  • Role: Speaker

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,
    });
  }
}

Next up is a short overview of the architecture:

Blog Architecture

All the lessons learned are documented in the linked blog post 📄 in the slides 🧑‍🏫, also the associated repositories are the following:

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.