1
votes

I am going through the AWS tutorial: Tutorial: Using AWS Lambda with Amazon Simple Queue Service - AWS Lambda

Steps:

  1. Create the Execution Role. – OK

  2. Create the Function – OK

  3. Test the Function – OK

  4. Create an Amazon SQS Queue -OK

The step that is failing is “Configure Event Source”:

aws lambda create-event-source-mapping --function-name AlexProcessSQSRecord  --batch-size 10  --event-source arn:aws:sqs:us-east-1:12345678901:AlexTrainingQueu

The error that I see is as follows:

aws: error: argument --starting-position is required

However, no value for starting-position fits

Also, there is a post in StackOverflow that states that it is not possible to use SQS as an event source for Lambda:

Why isn't SQS an event source for lambda?

So, why the Amazon tutorial suggests:

Using AWS Lambda with Amazon Simple Queue Service

2
Hi Alex, what do you mean by "no value for starting-position fits"? Do you get an error when you pass it in, or you're not sure what value to pass in? I'd assume that "LATEST" is what you'd want from the documentation: docs.aws.amazon.com/lambda/latest/dg/… - TheJeff
What version of aws cli do you use ? - Traycho Ivanov

2 Answers

0
votes

I got the same error message even using --event-source-arn

Upgrading to latest aws cli solve it.

Example:

Lets have a sqs queue name ingest and lambda function message-receiver

aws lambda \
    create-event-source-mapping \
    --batch-size 1 \
    --event-source-arn arn:aws:sqs:us-east-1:000000000000:ingest \
    --function-name message-receiver
-1
votes

You can use interface on console.

Open lambda function => click Add trigger, select SQS

Also, use --event-source-arn not --event-source (it is a mistake in the documentation).