0

I am trying to listen to events when sending emails via SES in localstack. I have created corresponding queues and SNS topics.

I define a configuration set for when sending email:

aws --endpoint-url=http://localhost:4566 ses create-configuration-set --configuration-set "{\"Name\":\"ses_config_set\"}" --profile test-profile --region eu-central-1 --output table | cat

I define the event destination:

aws --endpoint-url=http://localhost:4566 ses create-configuration-set-event-destination --configuration-set-name ses_config_set --event-destination '{"Name":"some_name2","Enabled":true,"MatchingEventTypes":["send","bounce","delibery","open","click"],"SNSDestination":{"TopicARN":"arn:aws:sns:eu-central-1:000000000000:ses_events_topic"}}' --profile test-profile --region eu-central-1 --output table | cat

I've also tried to define the event destination via file:

aws --endpoint-url=http://localhost:4566 ses create-configuration-set-event-destination --configuration-set-name ses_config_set --event-destination file://set_event_destination_attrs.json --profile test-profile --region eu-central-1 --output table | cat

// set_event_destination_attrs.json

{
  "Name": "string some",
  "Enabled": true,
  "MatchingEventTypes": ["send","reject","bounce","complaint","delivery","open","click","renderingFailure"],
  "SNSDestination": {
    "TopicARN": "arn:aws:sns:eu-central-1:000000000000:ses_events_topic"
  }
}

Both ses create-configuration-set-event-destination commands seem to work, no error is given in the console.

But when sending an email using this config set:

aws --endpoint-url=http://localhost:4566 ses send-email --destination '{"ToAddresses":["receiver@mail.com"]}' --message '{"Subject":{"Data":"foo subject","Charset":"string"},"Body":{"Text":{"Data":"foo body","Charset":"string"}}}' --configuration-set-name ses_config_set --from 'sender@test.com' --profile test-profile --region eu-central-1 --output table | cat

I can't see any event in my queue. Theoretically, SES should send an event to the SNS topic (like bounce, click etc.), and the queue is subscribed to the SNS. Publishing a message from the SNS topic to the queue works fine.

  1. I have the suspicion that the create-configuration-set-event-destination might be wrong. Maybe the --event-destination json, the format, etc.

  2. How can I debug that the event destination is properly set?

Thanks in advance

AlbertMunichMar
  • 1,680
  • 5
  • 25
  • 49
  • Maybe this [related question](https://stackoverflow.com/questions/74436394/sending-email-via-ses-in-localstack-with-an-event-destination-with-a-sns-topic/75440135#75440135) can help you find the solution. It's a similar question – Jerome Dh Feb 15 '23 at 11:33
  • they didn't have this implementation at the time, I opened an issue and they added it: https://github.com/localstack/localstack/issues/7184 – AlbertMunichMar Feb 15 '23 at 13:17

0 Answers0