Bryce York
Bryce York

Reputation: 1056

Why does the AWS cli reject my IAM ARN for not matching the regex/pattern?

I'm trying in a number of different ways to push my .zip to AWS Lambda. All of the methods I've tried (grunt, gulp, and cli) are throwing an error despite having copied my ARN straight from the IAM console.

I'm running the following in the CLI

aws lambda create-function --function-name myFunctionName --runtime nodejs4.3 --role="arn:aws:iam::848602986150:user/lambda" --handler index.handler --zip-file fileb://./path/to/my.zip

and receiving this error:

A client error (ValidationException) occurred when calling the CreateFunction operation: 1 validation error detected: Value 'arn:aws:iam::848602986150:user/lambda' at 'role' failed to satisfy constraint: Member must satisfy regular expression pattern: arn:aws:iam::\d{12}:role/?[a-zA-Z_0-9+=,.@\-_/]+

Anyone know what I'm doing wrong?

Upvotes: 7

Views: 18445

Answers (1)

Vor
Vor

Reputation: 35149

You have to create and pass IAM Role not IAM User

From the docs:

--role :

Services (AWS) resources. The Amazon Resource Name (ARN) of the IAM role that Lambda assumes when it executes your function to access any other Amazon Web

Upvotes: 16

Related Questions