In this live AWS environment, you will be using the AWS Simple Notification Service (SNS). You will create an SNS topic and then subscribe to that topic using multiple endpoints (SMS, email, and AWS Lambda). This environment will allow you to demonstrate successful interaction with the SNS service by creating SNS topics and adding subscribers to those topics. At the end of this activity, you will have demonstrated you have a basic understanding of the SNS service, the components within it, and how to use the service in the AWS console.
Successfully complete this lab by achieving the following learning objectives:
- Create an SNS Topic
- Using the Simple Notification Service (SNS) service, create an SNS topic named "mytopic"
- Create an email subscription to the SNS topic using your email address
- Create an SMS subscription to the SNS topic using your phone number
- Create a Lambda Function
- Using the Lambda service, create a Lambda function named "SNSProcessor" using the Python 3.6 runtime and the existing LambdaRoleLA role
- Using the Simple Notificiation Service (SNS) service, create an AWS Lambda subscription to the SNS topic for the Lambda function
- Using the Lambda service, update the Lambda function with the following code:
def lambda_handler(event, context): message = event['Records']['Sns']['Message'] print("From SNS: " + message) return message
- Deploy the Lambda function
- Send Your SNS Topic to Multiple Endpoints
- Using the Simple Notification Service (SNS) service, configure your message content and publish the SNS topic
- Verify that the SNS topic was successfully sent by confirming that you received the email and text message notifications
- Using the Lambda service, verify that the SNS topic was successfully sent by confirming that there is an entry for the Lambda function in CloudWatch Logs