简体   繁体   中英

AWS Lambda SQS Trigger

I have added a new AWS Lambda in visual studio. It has generated a function that passes a SQS Message.

The template I have been generated is similar to the one here

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html

I can't for the life of me find anywhere that tells me where to pass the queue name? So that my lambda can trigger after a message has been put into that queue. I imagine its a property in that json file? How about a schedule? Anyone know the name of the property to add a schedule?

It looks like you are using CloudFormation to create the Lambda function.

To trigger that Lambda function from SQS, you should create an AWS::Lambda::EventSourceMapping . For example, in YAML:

Type: AWS::Lambda::EventSourceMapping
Properties: 
  BatchSize: 1
  Enabled: true
  EventSourceArn: arn:aws:sqs:us-east-2:444455556666:queue1
  FunctionName: myfunc

Increase the BatchSize if you want SQS messages batched.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM