DEV Community

Cover image for Day 13: Sending AI Reports via Email using AWS SNS and Python.
Eric Rodríguez
Eric Rodríguez

Posted on

Day 13: Sending AI Reports via Email using AWS SNS and Python.

Welcome to Day 13. Checking CloudWatch logs is fine for debugging, but not for daily use. Today, we add a notification layer.

I chose Amazon SNS because it's the standard "Pub/Sub" service in AWS.

The Setup

Create Topic: FinanceAgent-Alerts.

Subscribe: Added my email and confirmed the subscription link.

Permissions: Gave my Lambda AmazonSNSFullAccess.

The Python Code

Sending an email from Lambda is surprisingly simple with Boto3:

Python
sns = boto3.client('sns')

def send_alert(message):
sns.publish(
TopicArn='arn:aws:sns:eu-north-1:123456:MyTopic',
Subject='Daily AI Update',
Message=message
)

Now, the output of my Bedrock LLM is piped directly to this function. The result? A fully automated financial analyst that slides into my DMs.

Tomorrow: We automate the trigger so I don't have to click "Run".

Top comments (0)