Sending html content in AWS SNSSimple Notification Service emails notifications
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Understanding SNS and Its Role in Email Notifications
Amazon Simple Notification Service (SNS) is a fully managed messaging service provided by AWS that enables you to decouple microservices, distributed systems, and serverless applications. SNS supports message delivery to several endpoints, including HTTP/S, email, SMS, and AWS Lambda. In this article, we’ll focus on sending HTML-formatted email notifications using SNS.
Sending HTML Emails with AWS SNS
Step 1: Creating an SNS Topic
To send emails via SNS, you first need to create a topic. A topic is a logical access point that allows you to group multiple recipients.
- Log in to the AWS Management Console.
- Navigate to the SNS Dashboard.
- Click Create Topic.
- Choose the type: Standard for most use cases.
- Enter the name of the topic.
- Optionally add a display name, which is used for SMS and email notifications.
- Click Create topic.
Step 2: Subscribing an Email Address to the Topic
- Go to the Topics page in the SNS Dashboard.
- Select the topic you just created.
- Click Create subscription.
- Choose Email as the protocol.
- Enter the recipient’s email address.
- The recipient must confirm the subscription via a confirmation link sent to the email.
Step 3: Preparing an HTML Email
SNS itself does not directly support sending emails with custom HTML content. However, it is possible by using AWS Lambda in conjunction with SES (Simple Email Service). Here's a basic example of how to format an HTML message in Python using Boto3:
- AWS Regions: Ensure SNS and SES are supported in your AWS region.
- Costs: Evaluate the costs associated with SNS and SES usage.
- Security: Implement appropriate IAM policies to restrict access.
- Feedback: Enable feedback notifications to capture bounces and complaints from email recipients.
Related reading
- Sending SMS with Amazon AWS services PHP
- Server Sent Events In a Kubernetes Cluster
- Serverless framework deployment error You're not authorized to access this resource
- Serverless Framework with AWS Lambda error Cannot find module
- Serializing to JSON in jQuery
- Set select option ''selected'', by value
- Service account secret is not listed. How to fix it?
- Service discovery vs load balancing

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.