How To Trigger Lambda From SQS (2 Min) | AWS | SQS Event Source

preview_player
Показать описание
In this tutorial, you'll learn how to trigger a lambda function from an SQS queue using IAM role, CloudWatch Log Stream and SQS event source trigger.



Video Transcript:
_
Hi guys, this is Abhi from Gokcedb. In this video, you're going to learn how to trigger a Lamba function from an SQSQ IN AWS. Let's start by navigating to the IAM service and then clicking on roles. 

Hit create role then choose Lambda under use case then click next. Select the AWS Lambda SQSQ execution role policy then click next. Give your role a name then hit create. Navigate to the SQS service then click on create a queue. 

Give your q a name and leave everything else to default then hit create a queue. Next, navigate the Lambda service. Click on create function then give it a name. 

Choose Python for runtime then select the SQS execution role that we just created then hit create. Scroll down to the code Source section. I'm going to write code to print the event and the record body then hit deploy. 

Scroll back up to the function overview then click on ADD trigger. Choose SQS Source then select the SQS queue that we just created then hit add. After the trigger State changes to enable, navigate back to the SQS window and click on send and receive messages. 

Enter a test message body then click on send a message. Navigate back to the monitor tab of the Lamba window then click on view logs in Cloud watch. Go inside the latest log stream and you should see your event and record body printed in the logs. 

There you have it. Make sure you like, subscribe, and turn on the notification bell. Until next time.
Рекомендации по теме
Комментарии
Автор

Really useful videos, thanks a lot :)

unicronix