SES activate rule set custom resource

Some background on managing SES with CDK

const ruleSet = new ReceiptRuleSet(this, 'MyRuleSet', {
receiptRuleSetName: 'default',
rules: [
{
//some rule
},
]
});
const ruleSet = new ReceiptRuleSet(this, 'ArchivalRuleSet', {
receiptRuleSetName: 'my-rule-set',
rules: [
{
enabled: true,
actions: [
new actions.S3({
bucket: some-bucket-object,
objectKeyPrefix: 'emails/'
})
],
},
]
});

Solution for activating the SES receipt ruleset

// Actual service call that will activate our ruleconst awsSdkCall: AwsSdkCall = {
service: 'SES',
action: 'setActiveReceiptRuleSet',
physicalResourceId: PhysicalResourceId.of('DefaultSesCustomResource'),
parameters: {
RuleSetName: 'my-rule-set',
}
}
// Execution context for this service callconst customResource: AwsCustomResource = new AwsCustomResource(this, "ses_default_rule_set_custom_resource", {
onCreate: awsSdkCall,
onUpdate: awsSdkCall,
logRetention: RetentionDays.ONE_WEEK,
policy: AwsCustomResourcePolicy.fromStatements([
new PolicyStatement({
sid: 'SesCustomResourceSetActiveReceiptRuleSet',
effect: Effect.ALLOW,
actions: ['ses:SetActiveReceiptRuleSet'],
resources: ['*']
})
]),
timeout: Duration.seconds(30)
}
);

--

--

--

Software delivery and cloud enthousiast

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Business Law

business law

Making a Grid Inventory System with Godot

Docker Secret — How to use in Docker Swarm and Compose

https://foxutech.com/docker-secret-how-to-use-in-docker-swarm-and-compose/

Testing Web Server: Part 3

SOC / Security Analyst Fundamentals Part 2

The Ark Command Line Client (ark-client)

Breaking down first Hyperledger tutorial (Build Your First Network), Part 3

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Kevin van Ingen

Kevin van Ingen

Software delivery and cloud enthousiast

More from Medium

Custom Lenses for the AWS Well-Architected Tool

GitHub Actions self-hosted runners with AWS CDK

The Magic of a Serverless Upgrade Without Terminating Active TCP Connections

Go Module Decoupling: A Rescue Guide