How to set the active Receipt Rule Set in SES using CloudFormation

Cloud Migration Scenarios

Four scenarios to migrate to AWS – from infrastructure to ML

In AWS CloudFormation there is no way to set the active receipt rule set of the AWS Simple Email Service. As we strive for 100% reproducibility, we created a custom resource to
do just that.

How do I set the active receipt rule set in CloudFormation?

After you have defined the receipt rule set with the standard CloudFormation resources, just add a CloudFormation resource of type Custom::ActiveReceiptRuleSet:

    Type: Custom::ActiveReceiptRuleSet
      RuleSetName: !Ref 'ReceiptRuleSet'
      Region: !Ref 'AWS::Region'
      ServiceToken: !Sub 'arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:binxio-cfn-ses-provider'

    Type: AWS::SES::ConfigurationSet
      Name: default

This will activate the specified receipt rule set.

## Installation
To install this custom resource provider, type:
git clone
cd cfn-ses-provider
aws cloudformation deploy \
    --capabilities CAPABILITY_IAM \
    --stack-name cfn-ses-provider \
    --template-file ./cloudformation/cfn-resource-provider.yaml 

This CloudFormation template will use our pre-packaged provider from s3://binxio-public-$(aws configure get region)/lambdas/


Although there is a CloudFormation resource to define a receipt rule set, there is no way to indicate which one should be active. With this SES custom provider you can. This ensures that your complete environment can be defined using CloudFormation and is fully reproducible without manual interventions.

To configure your SES domain identity, check out How to deploy AWS SES Domain Identities and DKIM records using CloudFormation.

If you have any questions, do not hesitate to contact me.

Mark van Holsteijn is a senior software systems architect, and CTO of He is passionate about removing waste in the software delivery process and keeping things clear and simple.
Share this article: Tweet this post / Post on LinkedIn