Export AWS SES suppressed Email list to S3

0

The primary way of exporting a list of suppressed email is through CLI. but is there a way to export these suppressed emails to S3 in CSV if yes how do I go about it? all suggestions are welcomed.

1 Antwort
0

Hello.

There is an AWS CLI command that retrieves the list of email addresses registered in the suppression list, so I think it is possible to do this by creating a shell script using that command.
https://docs.aws.amazon.com/ses/latest/dg/sending-email-suppression-list.html#sending-email-suppression-list-view-entries

aws sesv2 list-suppressed-destinations

Running the above command will give you the following output:
I think it would be a good idea to process this and create a CSV.

{
    "SuppressedDestinationSummaries": [
        {
            "EmailAddress": "recipient2@example.com",
            "Reason": "COMPLAINT",
            "LastUpdateTime": "2020-04-10T21:03:05Z"
        },
        {
            "EmailAddress": "recipient0@example.com",
            "Reason": "COMPLAINT",
            "LastUpdateTime": "2020-04-10T21:04:26Z"
        },
        {
            "EmailAddress": "recipient1@example.com",
            "Reason": "BOUNCE",
            "LastUpdateTime": "2020-04-10T22:07:59Z"
        }
    ]
}

I think it is possible by combining the "jq" commands as shown below.

aws sesv2 list-suppressed-destinations | jq -r '.SuppressedDestinationSummaries[] | [.EmailAddress, .Reason] | @csv' > suppression_list.csv

Once processed into CSV, you can upload it to S3 using the "aws s3 cp" command.

aws s3 cp ./suppression_list.csv s3://test-s3
profile picture
EXPERTE
beantwortet vor 2 Monaten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen