ses-cloudwatch
Small CDK construct that routes Amazon SES sending events to a CloudWatch LogGroup through EventBridge. It creates:
- CloudWatch LogGroup (optionally named)
- SES Configuration Set (optionally named)
- EventBridge Rule (matches all
aws.sesevents) - Configuration Set Event Destination that sends
SENDevents to the default EventBridge bus which the rule targets to the LogGroup
Install
Add as a dependency to your CDK app (peer deps aws-cdk-lib and constructs must already be present at compatible versions):
npm install ses-cloudwatchUsage
import { Stack } from 'aws-cdk-lib';
import { SesCloudWatch } from 'ses-cloudwatch';
class MyStack extends Stack {
constructor(scope: Construct, id: string) {
super(scope, id);
new SesCloudWatch(this, 'SesEvents');
}
}With custom names
new SesCloudWatch(this, 'SesEvents', {
logGroupName: 'my-ses-event-logs',
configurationSetName: 'marketing-emails',
eventRuleName: 'marketing-emails-events',
});Capturing additional SES events
By default only SEND events are forwarded. Supply the events prop to include more:
import { aws_ses as ses } from 'aws-cdk-lib';
new SesCloudWatch(this, 'SesEvents', {
events: [
ses.EmailSendingEvent.SEND,
ses.EmailSendingEvent.REJECT,
ses.EmailSendingEvent.DELIVERY,
],
});Props
| Name | Type | Default | Description |
|---|---|---|---|
logGroupName |
string? |
auto-generated by CloudFormation | Explicit name for the CloudWatch LogGroup that stores SES events. |
configurationSetName |
string? |
<stackName>-ses-config-set |
Name for the SES Configuration Set whose events are logged. |
eventRuleName |
string? |
<stackName>-ses-event-rule |
Name for the EventBridge Rule that matches SES events. |
events |
ses.EmailSendingEvent[]? |
[ses.EmailSendingEvent.SEND] |
Set of SES sending event types to capture. |
Testing
Run the Jest tests (auto-generated by projen) which validate both default and custom prop behavior:
npm testContributing & Build
To set up this repository for development or contribution:
-
Install dependencies:
yarn install
-
Synthesize project files (if needed):
npx projen
-
Build the project:
yarn build
-
Run tests:
yarn test
Note: Always run yarn install before npx projen to ensure all required packages are available locally.
License
MIT © Merapar Technologies Group B.V.
On this page
Languages
TypeScript100.0%
MIT License
Created August 28, 2025
Updated August 28, 2025