Configuring AWS SES with Pulumi

Not long ago I started using Pulumi for deploying the infrastructure for my projects. I’m always trying to automate things as much as possible, and having everything coded in my repo for my projects. I had used the serverless framework in the past, but it’s true that for a project that involves different providers and configurations, that framework cannot do the job.

Pulumi is basically Terraform but using some programming language. I may say that I don’t see really big advantages, and I even think that it’s more messy than Terraform. But still, it’s kind of nice to have everything in the same programming language (in my case, JavaScript).

I couldn’t find a complete example to configure AWS Simple Email Service (SES) with Pulumi, so I’ve created a gist with all the configuration. In my case, I’m using CloudFlare as my DNS server, so I use it to create the different DNS records. But if you’re using Route 53 or other, just change the line swhere the CF records are created.

This code will:

  1. Create a domain in AWS SES
  2. Create DKIM validation and add the needed records in CloudFlare
  3. Create the record in CloudFlare to validate domain ownership for SES
  4. Request to validate the domain

From my experience, it took some time for the domain to be validated. So if you use this together with other resources (like Cognito for example), you may need to run run the deployment twice.

For more information on Pulumi and AWS SES, refer to its docs here