Zest4Quest
Zest4Quest

Reputation: 13

Uploading AWS Lambda Function Failure from Visual Studio 2019

I am new to AWS and Lambda. When I try to publish my Lambda from Visual Studio by using the "Publish to AWS Lambda" option, I get this error:

Error creating IAM Role: User: arn:aws:iam::585066325803:user/MyLambda is not authorized to perform: iam:CreateRole on resource: arn:aws:iam::585066325803:role/lambda_exec_MyFunction

Permissions policies I added for the IAM user

I just tried different policies and added them. Do I need to do anything more than that? I thought publishing a test lambda would be easy. Please advice.

Roles displayed for the profile

Upvotes: 1

Views: 494

Answers (1)

Marcin
Marcin

Reputation: 238727

You need to add iam:PassRole permission to the user/MyLambda.

You can add such policy as an inline policy. An example of the policy is as follows:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": "iam:PassRole",
            "Resource": "*"
        }
    ]
}

Upvotes: 0

Related Questions