In my previous article, I explained how to build a simple news summarizer using AWS Lambda and API Gateway. I used AWS SAM to build, invoke locally and then deploy using IaC (infrastructure as code) approach.
This is Part 2 of the series.
In this article, I’ll show you how to further enhance the news summarizer by automating news alerts with AWS Lambda, SNS and Event Bridge.
Lambda function will fetch the desired news content using a public news API and will be integrated via Event Bridge scheduler and SNS to send daily news summary to the subscribed email.
I will use Event Bridge service to create a scheduler that invoke this Lambda function once a day and send the news summary via email using AWS SNS.
As I have stated in the prior part, I am building this solution in multiple part where I will incrementally add features to this solution.
Part 1: Building a Simple News Summarizer with AWS Lambda and API Gateway
Part 2: Automating News Alerts with AWS Lambda, SNS, and EventBridge
Part 3: Adding Generative AI Summarization with Amazon Bedrock to Your News
Part 4: Build a Serverless Generative AI News Summarizer API with AWS Lambda and Bedrock
Part 5: Serverless HTML News Delivery Using Bedrock, EventBridge, Lambda, and SNS
Before diving in, let’s review the architecture diagram to understand how these components interact.
Architecture
Prerequisites
- Familiarity with the AWS Management Console.
- Knowledge of Python/Boto3
- Basic understanding of AWS SAM
- Basic understanding of Lambda, Event Bridge and SNS
- Basic familiarity with event driven design and architecture
- Sign up at https://newsapi.org and get the API Key
What Are We Building and Why?
We are building a serverless news summarizer that fetches the latest technology news from a public news API and delivers it through an AWS Lambda function. This function is integrated with Amazon EventBridge Scheduler and Amazon SNS to send daily news alerts directly to subscribed email addresses.
The EventBridge scheduler uses cron expressions, allowing you to define the exact time you want to receive your daily email summary.
Why build this solution?
Because staying up to date with the latest tech news is exciting—but manually checking blogs, RSS feeds, and recap sites can be time-consuming. What if you could automate that process using AWS Serverless and AI tools?
With this automated workflow, you’ll receive daily tech news highlights straight to your inbox—simple, fast, and serverless.
Introduction to Public News API
NewsAPI.org is a news aggregation service that provides programmatic access to headlines and articles from major publications including CNN, BBC, TechCrunch and many more.
According to their website, NewsAPI returns JSON search results from over 150,000 sources!
The API allows developers to retrieve top headlines filtered by country or category (such as technology or business) and search across thousands of articles from various sources.
The service offers a free tier with up to 100 requests per day, though this free access is restricted to non-commercial use. For developers building news applications or integrating current events into their projects, NewsAPI provides a straightforward way to access real-time news content from reputable sources worldwide.
Review AWS SAM template
Let's review the template.yaml for the AWS SAM:
Key resources defined in this template:
- Lambda function
- Event Bridge Scheduler
- Amazon SNS Topic
This SAM template creates a serverless news summarizer that automatically fetches technology news articles and emails them daily. It deploys a Python Lambda function that calls the NewsAPI, schedules it to run daily using EventBridge Scheduler, and sets up an SNS topic with email subscription to send the news summaries. The template includes necessary IAM permissions for the Lambda to publish to SNS and requires an email parameter for the recipient address.
Review AWS Lambda function (Python/Boto3 Library)
This Lambda function fetches the top 5 US technology news articles from NewsAPI and automatically emails them as a formatted summary. It calls the NewsAPI with predefined parameters (US country, technology category, latest articles), formats the results into a readable email with titles, sources, URLs and descriptions, then publishes the summary to an SNS topic for email delivery. The function handles errors gracefully and returns status information about both the news fetching and email sending operations.
Build function locally using AWS SAM
Since I am using AWS SAM for this function, let’s begin by building the function. Use the following command to build the function:
Command: sam build
Invoke function locally using AWS SAM
Once the build is successful, you can invoke the function locally using the sam local invoke command:
Command: sam local invoke <function name>
For example:
sam local invoke GbNewsSummarizerFn
When this function is executed, you should expect the following output:
Deploy function using AWS SAM
After validating the function locally, you can deploy it to the AWS Cloud using the sam deploy command:
Command: sam deploy
This concise workflow demonstrates how to create, validate, and deploy Lambda functions using AWS SAM. By leveraging AWS SAM, you can streamline the development process and ensure your functions are tested thoroughly before deployment.
SAM deploy process will create the change set and you can review and confirm the change set before it gets deployed in your AWS Cloud environment.
Confirm the change set
Review the cloud formation change set creation!
Review created resources (Event Bridge Scheduler, SNS, Lambda Function)
If you login to AWS Console and navigate to Event Bridge, you should see that event bridge schedule has been created:
You can also navigate to Lambda and SNS service view and should see the resources created.
Confirm the subscription!
Yes, you need to verify the email address. When you deploy the CloudFormation stack, SNS will automatically send a subscription confirmation email to the email provided in your template.
The verification is a security feature to prevent spam and ensure only authorized recipients receive notifications.
Without confirmation, the function will publish to SNS but no emails will be delivered to unconfirmed addresses.
Wait for Event Bridge to invoke Lambda and Monitor the Cloud Watch Logs
Now that the Lambda function, SNS topic, and EventBridge scheduler are all configured, I’ll wait for the scheduler to invoke the Lambda function.
To monitor the invocation and logs in real time, I’ll use the CloudWatch Live Tail feature.
Live Tail Log
Check your email!
From the logs, you can see that the function was invoked and the email was sent. Now, let’s check your inbox, you should see a news summary email similar to the one below:
Cleaning Up Resources
Once you have completed the setup, ensure you delete the Lambda function to avoid unnecessary resource usage.
You can delete the resources via AWS Console.
Delete entire stack
- Delete the Lambda function
- Delete the Event Bridge Scheduler
- Delete SNS Topic
- Delete the Log Group
- Delete the IAM Role
Since these resources were build and deployed using AWS SAM, these can be deleted using AWS SAM command.
Command: sam delete
Conclusion
In this article, I demonstrated how to build a news summarizer using an AWS Lambda function and automate it with Amazon EventBridge Scheduler and Amazon SNS email notifications. The Lambda function uses the NewsAPI.org aggregator, which returns news results in JSON format.
With this solution, you can receive your own daily news summary delivered straight to your inbox via SNS email!
I hope you found this tutorial both helpful and informative!
If you're interested in extending this project further, stay tuned for my upcoming 5-part deep dive series, where I’ll walk through building a full-featured, AI-powered news delivery system using AWS:
- Part 1: Building a Simple News Summarizer with AWS Lambda and API Gateway
- Part 2: Automating News Alerts with AWS Lambda, SNS, and EventBridge
- Part 3: Adding Generative AI Summarization with Amazon Bedrock to Your News
- Part 4: Build a Serverless Generative AI News Summarizer API with AWS Lambda and Bedrock
- Part 5: Serverless HTML News Delivery Using Bedrock, EventBridge, Lambda, and SNS
Thank you for reading!
Watch the video here:
𝒢𝒾𝓇𝒾𝓈𝒽 ℬ𝒽𝒶𝓉𝒾𝒶
𝘈𝘞𝘚 𝘊𝘦𝘳𝘵𝘪𝘧𝘪𝘦𝘥 𝘚𝘰𝘭𝘶𝘵𝘪𝘰𝘯 𝘈𝘳𝘤𝘩𝘪𝘵𝘦𝘤𝘵
𝘈𝘞𝘚 𝘊𝘦𝘳𝘵𝘪𝘧𝘪𝘦𝘥 𝘋𝘦𝘷𝘦𝘭𝘰𝘱𝘦𝘳 𝘈𝘴𝘴𝘰𝘤𝘪𝘢𝘵𝘦
𝘈𝘞𝘚 𝘊𝘦𝘳𝘵𝘪𝘧𝘪𝘦𝘥 𝘎𝘦𝘯𝘈𝘐 𝘗𝘳𝘢𝘤𝘵𝘪𝘵𝘪𝘰𝘯𝘦𝘳
𝘈𝘞𝘚 𝘊𝘭𝘰𝘶𝘥 𝘛𝘦𝘤𝘩𝘯𝘰𝘭𝘰𝘨𝘺 𝘌𝘯𝘵𝘩𝘶𝘴𝘪𝘢𝘴𝘵
Top comments (0)