AWS SNS Email Alerts Not Arriving? The Subscription Confirmation Trap Explained
You've wired up an SNS topic, attached an email endpoint, and deployed your alerting pipeline — but your inbox is silent. Nine times out of ten, the culprit is a single missed step: the subscription confirmation email that AWS sends before it will deliver a single message to your endpoint.
TL;DR
| Step | Action | Status if Skipped |
|---|---|---|
| 1 | Create SNS Topic | Topic exists but is inert |
| 2 | Subscribe email endpoint to topic | Subscription stays in PendingConfirmation |
| 3 | Click confirmation link in inbox | ❌ No messages ever delivered |
| 4 | Publish message to topic | ✅ Email delivered only after step 3 |
Why SNS Requires Subscription Confirmation
AWS SNS uses a double opt-in model for email and HTTP/HTTPS endpoints. This is not an arbitrary UX decision — it is a security and anti-spam control. Without it, any AWS account could weaponize SNS to flood arbitrary email addresses with messages. The confirmation handshake proves that the endpoint owner consents to receiving messages from that specific topic.
Analogy: Think of SNS subscription confirmation like a postal service requiring a signed delivery receipt before adding your address to a mailing list. The list owner cannot send you anything until you physically sign and return that receipt. Your inbox is the locked mailbox; the confirmation link is the key you must hand over.
The Subscription Lifecycle: State Machine
Understanding the states a subscription moves through clarifies exactly where the failure occurs.
- Subscribe API call: You call
sns:SubscribewithProtocol: emailand your endpoint address. SNS immediately creates the subscription record. - PendingConfirmation: The subscription is created but inactive. SNS sends a single confirmation email containing a unique token URL. No topic messages are routed to this endpoint yet.
- Confirmed: The subscriber clicks the confirmation link (or calls
ConfirmSubscriptionwith the token). The subscription becomes active and SNS will now deliver published messages. - Deleted/Expired: If the confirmation link is not clicked within 3 days, the pending subscription is automatically deleted by AWS. You must re-subscribe.
End-to-End Message Flow
Once confirmed, here is how a published alert travels from your application to your inbox.
(App / Lambda / CloudWatch)" participant SNS as "SNS Topic" participant EmailSvc as "SNS Email Service" participant Inbox as "Subscriber Inbox" Publisher->>SNS: sns:Publish(TopicArn, Message) SNS-->>SNS: Fan-out to confirmed subscriptions SNS->>EmailSvc: Route message to email endpoint EmailSvc->>Inbox: Deliver formatted email Note over SNS,EmailSvc: Pending subscriptions are silently skipped Note over EmailSvc,Inbox: Best-effort delivery — no SLA guarantee for email protocol
- Publisher (your app, Lambda, CloudWatch Alarm, etc.) calls
sns:Publishtargeting the topic ARN. - SNS Topic fans the message out to all confirmed subscriptions. Pending subscriptions are silently skipped.
- SNS Email Service formats the payload as a plain-text email and hands it to AWS's internal mail infrastructure.
- Subscriber Inbox receives the email. Delivery is best-effort; SNS does not guarantee delivery SLAs for email endpoints (use SQS or Lambda for guaranteed processing).
Diagnosing the Problem: Step-by-Step
Step 1 — Check Subscription Status via AWS Console
Navigate to SNS → Topics → [Your Topic] → Subscriptions. Look at the Status column. If it reads PendingConfirmation, you have not confirmed yet.
Step 2 — Check Subscription Status via AWS CLI
aws sns list-subscriptions-by-topic \
--topic-arn arn:aws:sns:us-east-1:123456789012:MyAlertTopic \
--query 'Subscriptions[*].{Endpoint:Endpoint,Status:SubscriptionArn}' \
--output table
A PendingConfirmation value in the SubscriptionArn field confirms the issue.
Step 3 — Re-send the Confirmation Email
If the original confirmation email is lost or expired, you can re-trigger it:
# Re-subscribe the email address to regenerate the confirmation email
aws sns subscribe \
--topic-arn arn:aws:sns:us-east-1:123456789012:MyAlertTopic \
--protocol email \
--notification-endpoint your-alert-address@example.com
Check your inbox (and spam/junk folder) for an email from no-reply@sns.amazonaws.com with subject "AWS Notification - Subscription Confirmation". Click Confirm subscription.
Step 4 — Programmatic Confirmation (Optional)
If you are automating infrastructure setup and need to confirm programmatically, extract the token from the confirmation URL and call:
aws sns confirm-subscription \
--topic-arn arn:aws:sns:us-east-1:123456789012:MyAlertTopic \
--token <TOKEN_FROM_CONFIRMATION_URL>
Full Setup: SNS Topic + Email Subscription via CLI
🔽 [Click to expand] — Full CLI setup script
# 1. Create the SNS topic
TOPIC_ARN=$(aws sns create-topic \
--name MyAlertTopic \
--query 'TopicArn' \
--output text)
echo "Topic ARN: $TOPIC_ARN"
# 2. Subscribe an email endpoint
aws sns subscribe \
--topic-arn "$TOPIC_ARN" \
--protocol email \
--notification-endpoint your-alert-address@example.com
# ⚠️ At this point, check your inbox and click the confirmation link.
# The subscription will remain in PendingConfirmation until you do.
# 3. Verify subscription is confirmed (run after clicking the link)
aws sns list-subscriptions-by-topic \
--topic-arn "$TOPIC_ARN" \
--output table
# 4. Publish a test message
aws sns publish \
--topic-arn "$TOPIC_ARN" \
--subject "Test Alert" \
--message "SNS email subscription is working correctly."
IAM: Least-Privilege Permissions
If your application or CI/CD pipeline manages SNS subscriptions programmatically, scope the IAM policy tightly. Do not grant sns:*.
🔽 [Click to expand] — Least-privilege IAM policy for SNS alerting
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowSNSPublishAndSubscribe",
"Effect": "Allow",
"Action": [
"sns:Publish",
"sns:Subscribe",
"sns:ConfirmSubscription",
"sns:ListSubscriptionsByTopic",
"sns:GetSubscriptionAttributes"
],
"Resource": "arn:aws:sns:us-east-1:123456789012:MyAlertTopic"
}
]
}
Common Pitfalls Checklist
| Pitfall | Symptom | Fix |
|---|---|---|
| Confirmation email in spam | Never saw the email | Check junk folder; sender is no-reply@sns.amazonaws.com |
| Confirmation link expired (3-day TTL) | Link returns an error page | Re-subscribe to generate a new confirmation email |
| Wrong email address entered | Confirmation sent to wrong inbox | Delete subscription, re-subscribe with correct address |
| Topic in wrong region | Cannot find topic in console | Verify the AWS region in your CLI/console matches where the topic was created |
| SNS topic has a restrictive access policy | Publish calls succeed but no delivery | Review the topic's Access Policy to ensure the publisher principal is allowed |
Wrap-Up & Next Steps
The SNS email subscription confirmation step is the single most common reason alerts go silent. It is a deliberate, security-enforced gate — not a bug. Once confirmed, your pipeline is robust. For production alerting systems, consider pairing SNS with SQS (for guaranteed, durable message processing) or Lambda (for enriched, formatted notifications) rather than relying solely on the email protocol, which offers no delivery guarantees or retry visibility.
- 📖 AWS Docs: Email notifications via SNS
- 📖 AWS Docs: SNS Subscription Filter Policies
- 📖 AWS Docs: SNS Access Control
Glossary
| Term | Definition |
|---|---|
| SNS Topic | A logical access point and communication channel in Amazon SNS. Publishers send messages to a topic; SNS fans them out to all confirmed subscribers. |
| Subscription | The binding between an SNS topic and an endpoint (email, SQS, Lambda, HTTP, etc.) that defines where messages are delivered. |
| PendingConfirmation | The initial state of an email or HTTP/HTTPS subscription before the endpoint owner confirms consent. No messages are delivered in this state. |
| Double Opt-In | A two-step subscription process where the subscriber must explicitly confirm their intent to receive messages, preventing unsolicited delivery. |
| Topic Access Policy | A resource-based IAM policy attached to an SNS topic that controls which AWS principals and accounts can publish or subscribe to it. |
Comments
Post a Comment