Skip to content

Couldn't create version $LATEST.PUBLISHED of function my-function: The function's execution role doesn't have permission to perform this operation.

0

Trying to use lambda provisioned capacity in eu-west-1. Been struggling with this for a few days and still getting the same error:

Couldn't create version $LATEST.PUBLISHED of function my-function: The function's execution role doesn't have permission to perform this operation.

The lambda has access to AWS Managed Policies of:

  • AWSLambdaBasicExecutionRole
  • AWS managed

..and a custom one with the following configuration:

{
	"Version": "2012-10-17",
	"Statement": [
		{
			"Sid": "VisualEditor0",
			"Effect": "Allow",
			"Action": [
				"lambda:CreateFunction",
				"lambda:TagResource",
				"lambda:DeleteProvisionedConcurrencyConfig",
				"lambda:GetFunctionConfiguration",
				"lambda:GetCapacityProvider",
				"lambda:EnableReplication",
				"lambda:PassCapacityProvider",
				"lambda:ListProvisionedConcurrencyConfigs",
				"lambda:DisableReplication",
				"lambda:GetProvisionedConcurrencyConfig",
				"lambda:SendDurableExecutionCallbackSuccess",
				"lambda:SendDurableExecutionCallbackFailure",
				"lambda:DeleteFunction",
				"lambda:GetAlias",
				"lambda:UpdateFunctionUrlConfig",
				"lambda:CreateFunctionUrlConfig",
				"lambda:UpdateFunctionEventInvokeConfig",
				"lambda:DeleteFunctionCodeSigningConfig",
				"lambda:DeleteCapacityProvider",
				"lambda:InvokeFunctionUrl",
				"lambda:GetEventSourceMapping",
				"lambda:PutFunctionScalingConfig",
				"lambda:InvokeFunction",
				"lambda:GetFunctionRecursionConfig",
				"lambda:GetFunctionScalingConfig",
				"lambda:ListAliases",
				"lambda:GetFunctionUrlConfig",
				"lambda:AddLayerVersionPermission",
				"lambda:GetFunctionCodeSigningConfig",
				"lambda:UpdateAlias",
				"lambda:UpdateFunctionCode",
				"lambda:ListFunctionEventInvokeConfigs",
				"lambda:PutRuntimeManagementConfig",
				"lambda:CheckpointDurableExecution",
				"lambda:ListFunctionsByCodeSigningConfig",
				"lambda:GetFunctionConcurrency",
				"lambda:PutProvisionedConcurrencyConfig",
				"lambda:GetDurableExecution",
				"lambda:PublishVersion",
				"lambda:DeleteEventSourceMapping",
				"lambda:CreateAlias",
				"lambda:GetDurableExecutionState",
				"lambda:UpdateCapacityProvider",
				"lambda:ListVersionsByFunction",
				"lambda:GetLayerVersion",
				"lambda:PublishLayerVersion",
				"lambda:InvokeAsync",
				"lambda:ListFunctionVersionsByCapacityProvider",
				"lambda:GetLayerVersionPolicy",
				"lambda:UntagResource",
				"lambda:RemoveLayerVersionPermission",
				"lambda:PutFunctionConcurrency",
				"lambda:DeleteCodeSigningConfig",
				"iam:PassRole",
				"lambda:ListTags",
				"lambda:GetRuntimeManagementConfig",
				"lambda:DeleteLayerVersion",
				"lambda:GetDurableExecutionHistory",
				"lambda:PutFunctionEventInvokeConfig",
				"lambda:DeleteFunctionEventInvokeConfig",
				"lambda:PutFunctionCodeSigningConfig",
				"lambda:UpdateEventSourceMapping",
				"lambda:UpdateFunctionCodeSigningConfig",
				"lambda:GetFunction",
				"lambda:PutFunctionRecursionConfig",
				"lambda:UpdateFunctionConfiguration",
				"lambda:ListFunctionUrlConfigs",
				"lambda:StopDurableExecution",
				"lambda:SendDurableExecutionCallbackHeartbeat",
				"lambda:UpdateCodeSigningConfig",
				"lambda:ListDurableExecutionsByFunction",
				"lambda:AddPermission",
				"lambda:GetFunctionEventInvokeConfig",
				"lambda:DeleteAlias",
				"lambda:DeleteFunctionConcurrency",
				"lambda:GetCodeSigningConfig",
				"lambda:DeleteFunctionUrlConfig",
				"lambda:RemovePermission",
				"lambda:GetPolicy"
			],
			"Resource": [
				 "arn:aws:lambda:eu-west-1:123456789012:function:my-function",
				"arn:aws:iam::206779301971:role/arn:aws:lambda:eu-west-1:123456789012:function:my-function"
			]
		}
	]
}

Why can't a get a better error message? AWS used to have decent ones.

I'm not the only one stuggling?: https://repost.aws/questions/QU200TpTq6TWSh8ODkupCGBg/unable-to-update-aws-lambda-because-function-execution-role-doesnt-have-permission

asked 10 months ago165 views

2 Answers
0

Based on the error message you're encountering when trying to create the $LATEST.PUBLISHED version of your Lambda function, it appears to be a permissions issue with the execution role.

The $LATEST.PUBLISHED version is a feature specific to Lambda Managed Instances that allows you to create or republish a latest published version without managing numbered versions. When you try to publish this version, Lambda needs appropriate permissions.

Looking at your IAM policy, I notice a potential issue with the Resource section. The second resource ARN appears to be incorrectly formatted:

"arn:aws:iam::206779301971:role/arn:aws:lambda:eu-west-1:123456789012:function:my-function"

This doesn't look like a valid IAM role ARN format. It seems to be combining a role ARN with a function ARN.

Additionally, when working with Lambda Managed Instances and the $LATEST.PUBLISHED version, you need to ensure:

  1. The execution role has the necessary permissions to publish versions
  2. The IAM policy attached to the role is correctly formatted
  3. The account numbers in your ARNs are consistent

To troubleshoot further, you could:

  1. Check the actual execution role attached to your Lambda function (not just the policies you've added)
  2. Use the get-policy command to view the resource-based policy of your function
  3. Ensure the account number in your ARNs matches your actual AWS account
  4. Fix the malformed role ARN in your policy

The error message is unfortunately not very descriptive, but it's indicating that the execution role Lambda is using doesn't have the permissions needed for this specific operation.
Sources
$LATEST.PUBLISHED version in Lambda Managed Instances - AWS Lambda
Viewing resource-based IAM policies in Lambda - AWS Lambda

answered 10 months ago

  • I think you'll find from my policy document that it indeed has "lambda:PublishVersion". Furthermore, all of your steps (bar one) I already went through since how else would I have published the policy document. I fixed my typo in the role ARN you spotted, but still getting the error: Couldn't create version 4 of function my-function: The function's execution role doesn't have permission to perform this operation..

  • Can you post your latest policy along with role you mentioned, must be a problem in resource section.

0

In your IAM role, where you have listed the resources. Can you change from "arn:aws:lambda:eu-west-1:123456789012:function:my-function" to "arn:aws:lambda:eu-west-1:123456789012:function:my-function*"

When you publish multiple versions the arn will contain the version number and the arn will be like below. "arn:aws:lambda:eu-west-1:123456789012:function:my-function:1"

EXPERT

answered 10 months ago

  • Good catch and I wish that was it! I tried adding the wildcard to both resource ARNs but it's still failing.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.