AWS Lambda Hands-On
Demo - V2
In this Lab, we will invoke an API configured through API Gateway.
API will in turn invoke the Lambda function, which will trigger an SNS Email Notification.
API Gateway
Lambda Function
Simple Notification Service (SNS)
Hands-On Demo Overview
SNS - Create Topic
SNS - Create subscription
learnpde@gmail.com
SNS - Confirm Subscription
Lambda - Create Function
API-Lambda-SNS-Integration
Lambda - Create Function
Lambda - Function Overview Page
import boto3
def lambda_handler(event, context):
# Initialize SNS client
sns = boto3.client('sns')
# Specify your SNS topic ARN
topic_arn = 'arn:aws:sns:us-east-1:211125437318:MyTopic'
# Publish a message to the SNS topic
sns.publish(
TopicArn=topic_arn,
Message='Hello from Lambda! This is the message that will be sent in the email.',
Subject='Email Subject from Lambda'
)
return {
'statusCode': 200,
'body': 'Message published to SNS topic successfully!'
}
Lambda - Add Lambda Code
Lambda - Add Trigger
Lambda - Function Overview Page
Lambda -
Add destination
Lambda - Save Destination Settings
Lambda - Function Final Overview
Lambda - Go to Trigger
Test the API
Check Email for Verification
Clean Up - Delete Lambda Function
Clean Up - Delete SNS Topic
Clean Up - Delete API
🙏
Thanks
For
Watching
Amazon Lambda - Hands-On Demo - V2
By Deepak Dubey
Amazon Lambda - Hands-On Demo - V2
Amazon Lambda - Hands-On Demo - V2
- 128