Created
July 25, 2021 07:36
-
-
Save markilott/4d2aa026dc0aa66c630ca20c1eabc878 to your computer and use it in GitHub Desktop.
CDK Custom Resource - SES Domain Identity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add and verify Domain using DKIM | |
const domainIdentity = new AwsCustomResource(this, 'domainIdentity', { | |
onUpdate: { | |
service: 'SESV2', | |
action: 'createEmailIdentity', | |
parameters: { | |
EmailIdentity: zoneName, | |
ConfigurationSetName, // Will set the default Configuration Set for the domain | |
}, | |
physicalResourceId: {}, | |
}, | |
onDelete: { | |
service: 'SESV2', | |
action: 'deleteEmailIdentity', | |
parameters: { | |
EmailIdentity: zoneName, | |
}, | |
}, | |
policy: AwsCustomResourcePolicy.fromStatements([sesPolicy]), | |
logRetention: 7, | |
}); | |
// Assuming there are always 3 tokens returned as that is what all the docs indicate | |
const dkimTokens = [ | |
domainIdentity.getResponseField('DkimAttributes.Tokens.0'), | |
domainIdentity.getResponseField('DkimAttributes.Tokens.1'), | |
domainIdentity.getResponseField('DkimAttributes.Tokens.2'), | |
]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment