Luke
Luke

Reputation: 59

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?

Upvotes: 0

Views: 1387

Answers (1)

jarmod
jarmod

Reputation: 78553

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.

Upvotes: 2

Related Questions