Monitoring and alerting are important parts of maintaining the reliability, availability, and performance of your AWS SES solution. Whether you’re sending any kind of emails such as transactional emails or marketing emails, it’s crucial to keep track of your email sending limits and usage to ensure smooth email operations. To effectively manage your SES usage and stay informed about your quota limits, configuring SES quota usage alerts is essential. In this article, I will demonstrate to you how to set up these alerts within your AWS environment effectively.
As you may know, Amazon Cloudwatch monitors allow you to collect and track metrics of your AWS resources and help visualize them on customized dashboards. Additionally, It also provides to create alarms that notify you or take actions when a specified metric reaches a threshold that you specify.
Understanding Amazon SES Sending Quotas
Amazon SES account has a sending quota limit that regulates the number of email messages that you can send and the rate at which you can send them. That will enable you to gradually increase your email-sending activities, reducing the risk of email providers blocking your emails due to unexpected spikes in your email-sending volume or rate.
The following quotas apply to sending email through Amazon SES:
- Sending quota – The maximum number of emails that you can send within a 24-hour period. If your total sent emails in the past 24 hours are below this limit, your send request is accepted. However, if sending a message surpasses this daily limit, your sending request will be rejected.
- Sending rate – The maximum number of emails that Amazon SES can accept from your account in each second. You can exceed this quota for short bursts, but not for a sustained time.
You can open the Account dashboard to review your sending limits and the daily email-sending usage. However, the dashboard doesn’t send you notifications when the sending limits reach a certain threshold.
Let’s start to create the Cloudwatch Alarms when the sending limits reach a certain threshold.
Setting Up SES Sending Quota Alerts
Create a SNS Topic
Create a new Amazon SNS topic, and then subscribe to it using your preferred endpoint (such as email or SMS). For more information, see the below post under section 7.1 Create SNS Topic.
Create a Cloudwatch Alarm
Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/.
In the navigation pane, choose All Alarms. Then, click the “Create Alarm” button on the right-hand side.
Under “Specify metric and conditions”, click “Select Metric”. This will open the metrics selection page.
Then do the following:
- In the list of metrics, choose SES.
- Choose Account Metrics.
- Check the “Send” metric checkbox and choose Select Metric.
In the Metric configuration window, we can set the statistics as the Sample Count for our metric. For this scenario, since we are checking the daily limit exceeding the threshold, let’s change the sampling period to 1 day.
Then, scroll down to the next part of the configuration.
Under conditions, we need to set what triggers our alarm. In this case, we want the alarm to trigger when the sending email count has reached 80% of the daily quota limit (50,000).
For that, we will set our condition to “Greater/Equal” and give it a value of “40000” and then click Next.
Now we need to set the notifications, for this scenario, we want to send these notifications via email. So that we can create a SNS topic for it or else you can use an existing SNS topic.
In the last part of the setup add the “Alarm Name” that will displayed, and the description (the description will show in the email body). Finally, click “Next” and go to the overview page.
On the review page, verify all the details of your alarm. And edit them in case you need to.
Finally, click “Create Alarm” on the bottom to create the alarm.
Once you successfully created the Alarm and returned to the main ”CloudWatch” page, you can see it as follows.
Whenever the configured threshold limit is reached you will get an email notification as follows. Here for testing purposes, I have changed the threshold value to 1000 to trigger the alarm immediately.
Configuring AWS SES sending quota alerts is a proactive step in managing your email-sending capabilities effectively. By setting up these alerts through AWS CloudWatch, you can stay informed about your SES usage and take necessary actions to maintain compliance with your quotas. Regular monitoring and fine-tuning of these alerts will ensure smooth email operations within AWS SES.