I needed to export my Simple Email Service (SES) suppression list from time to time to manually confirm that the unsubscribe/spam/bounce notifications were working and to compare with my own suppression lists.
The current (as of 5/24/2022) version of the AWS console does not provide an export option for the Suppression List, so I made this simple script to export using the AWS CLI client. I decided to publish since there were a others who were seeking to do the same. Use at your own risk.
Tested on OS X 11.6 (Big Sur) and steps will be
Dependencies:
- AWS CLI Client to query the api
- Dasel for parsing the JSON responses in the terminal
Usage:
Install the dependencies and make sure to configure and authorize the AWS client using aws configure
and entering your keys.
Create a folder and put the fetch.sh
script in the folder. Navigate to the folder in your terminal and run bash fetch.sh
, zsh fetch.sh
or whatever terminal you prefer. It might not work on other terminals.
The script operates like so:
- Create an empty CSV file named
list.csv
- Query the API for the suppression list
- Append to the results to the CSV file
- Check if a
NextToken
is present indicating that there are more results - If a token is present in the response, repeat steps 2-4.