Skip to content

Instantly share code, notes, and snippets.

@corpulentcoffee
Created September 23, 2018 22:10
Show Gist options
  • Save corpulentcoffee/350e2c9fb54ed00d66755d55693d7d29 to your computer and use it in GitHub Desktop.
Save corpulentcoffee/350e2c9fb54ed00d66755d55693d7d29 to your computer and use it in GitHub Desktop.
Example CloudFormation nested stack for enabling G Suite e-mail in a Route 53 zone
Parameters:
Zone: {Type: String}
Domain: {Type: String}
DKIMPubKey: {Type: String}
Resources:
MX:
Type: AWS::Route53::RecordSet
Properties:
HostedZoneId: !Ref Zone
Name: !Ref Domain
TTL: 86400
Type: MX
ResourceRecords:
- 1 aspmx.l.google.com.
- 5 alt1.aspmx.l.google.com.
- 5 alt2.aspmx.l.google.com.
- 9 alt3.aspmx.l.google.com.
- 9 alt4.aspmx.l.google.com.
DKIM:
Type: AWS::Route53::RecordSet
Properties:
HostedZoneId: !Ref Zone
Name: !Sub ['google._domainkey.${Domain}', {Domain: !Ref Domain}]
TTL: 86400
Type: TXT
ResourceRecords:
- !Sub ['"v=DKIM1; k=rsa; p=${PubKey}"', {PubKey: !Ref DKIMPubKey}]
SPF:
Type: AWS::Route53::RecordSet
Properties:
HostedZoneId: !Ref Zone
Name: !Ref Domain
TTL: 86400
Type: TXT
ResourceRecords:
- '"v=spf1 include:_spf.google.com ~all"'
Resources:
Zone:
Type: AWS::Route53::HostedZone
Properties:
Name: example.com
Email:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: gsuite.yaml
Parameters:
Zone: !Ref Zone
Domain: example.com
DKIMPubKey: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment