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달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠