Cleanup the suppression list at AWS SES

Amazon Simple Email Service has a mechanism to prevent sending emails to addresses that bounced or complained. Sometimes the emails are bouncing because of the short time server failures. And if the email is added to the suppression list, this address will never receive an email from you.

AWS has a cli to manipulate with this list. But there is no command to clean up all items on the list. It is designed to remove the items one by one.

Here are the useful commands to watch, save and purge all the suppression list:

# Save the list to file
aws sesv2 list-suppressed-destinations --no-paginate > list.txt

# Watch the entire list of emails
aws sesv2 list-suppressed-destinations --no-paginate | grep -o '"EmailAddress": "[^"]*' | grep -o '[^"]*$'

# Purge the suppression list
for email in $(aws sesv2 list-suppressed-destinations --no-paginate | grep -o '"EmailAddress": "[^"]*' | grep -o '[^"]*$'); do aws sesv2 delete-suppressed-destination --email-address ${email}; echo ${email}; sleep 1; done

2 replies on “Cleanup the suppression list at AWS SES”

You saved me hours by sharing your iterative command to clean up the suppression list in SES. This wasn’t even in the AWS documentation because they still had the more fiddly process of the import job which the new API doesn’t even support. Thank you so much!

Leave a Reply

Your email address will not be published. Required fields are marked *