Fix AWS SNS Bounce

I get stuck at Step 12

Steps

  1. Create a Simple Email Service (SES) domain identity, your.domain, in one of the AWS regions supporting email receiving
  1. Verify domain identity
  1. Create a Simple Notification Service (SNS) topic, feedback-sns-topic, for feedback notifications
  2. Configure the your.domain domain identity
    a. Enable email feedback forwarding
    b. Configure bounce and complaint (not delivery) feedback notifications to use SNS feedback-sns-topic topic
  3. Create a subscription on the SNS feedback-sns-topic topic
    a. Protocol is HTTPS (you’re not still using HTTP are you?)
    b. Set endpoint to https://your.domain/webhooks/aws (see VERP post )
    c. Select enable raw message delivery
  4. Create another SNS topic, incoming-sns-topic, for incoming email
  5. Create an SES email receiving rule set, inbound-mail-set, if there isn’t an existing active one. If so use that as there can only be one active rule set
  6. Create a receipt rule in the inbound-mail-set receiving rule set
    a. Set recipient condition to your.domain
    b. Add action to publish to SNS topic incoming-sns-topic, encoding Base64
  7. Create API key in your Discourse instance for user system, granting receive email action on the email resource
  8. Create a secret in Secret Manager, email-handler-secret, with the following keys and their respective values:
  • api_endpoint - https://your.domain/admin/email/handle_mail
  • api_key - from step 9
  • api_username - system, unless you used something different in step 9
  1. Create a Lambda layer, lambda-receiver-layer, for the python3.10 runtime containing the requests and aws-lambda-powertools libraries
  2. Create a lambda function, email-receiver-lambda, for the python3.10 runtime with the receiver code: