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 回答
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
专家
已回答 2 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则