AWS Lambda
개발자 가이드


Adds permissions to the resource-based policy of a version of an AWS Lambda layer. Use this action to grant layer usage permission to other accounts. You can grant permission to a single account, all AWS accounts, or all accounts in an organization.

To revoke permission, call RemoveLayerVersionPermission with the statement ID that you specified when you added it.

Request Syntax

POST /2018-10-31/layers/LayerName/versions/VersionNumber/policy?RevisionId=RevisionId HTTP/1.1 Content-type: application/json { "Action": "string", "OrganizationId": "string", "Principal": "string", "StatementId": "string" }

URI Request Parameters

The request requires the following URI parameters.


The name or Amazon Resource Name (ARN) of the layer.

Length Constraints: Minimum length of 1. Maximum length of 140.

Pattern: (arn:[a-zA-Z0-9-]+:lambda:[a-zA-Z0-9-]+:\d{12}:layer:[a-zA-Z0-9-_]+)|[a-zA-Z0-9-_]+


Only update the policy if the revision ID matches the ID specified. Use this option to avoid modifying a policy that has changed since you last read it.


The version number.

Request Body

The request accepts the following data in JSON format.


The API action that grants access to the layer. For example, lambda:GetLayerVersion.

Type: String

Pattern: lambda:GetLayerVersion

Required: Yes


With the principal set to *, grant permission to all accounts in the specified organization.

Type: String

Pattern: o-[a-z0-9]{10,32}

Required: No


An account ID, or * to grant permission to all AWS accounts.

Type: String

Pattern: \d{12}|\*|arn:(aws[a-zA-Z-]*):iam::\d{12}:root

Required: Yes


An identifier that distinguishes the policy from others on the same layer version.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 100.

Pattern: ([a-zA-Z0-9-_]+)

Required: Yes

Response Syntax

HTTP/1.1 201 Content-type: application/json { "RevisionId": "string", "Statement": "string" }

Response Elements

If the action is successful, the service sends back an HTTP 201 response.

The following data is returned in JSON format by the service.


A unique identifier for the current revision of the policy.

Type: String


The permission statement.

Type: String



One of the parameters in the request is invalid. For example, if you provided an IAM role for AWS Lambda to assume in the CreateFunction or the UpdateFunctionConfiguration API, that AWS Lambda is unable to assume you will get this exception.

HTTP Status Code: 400


The permissions policy for the resource is too large. Learn more

HTTP Status Code: 400


The RevisionId provided does not match the latest RevisionId for the Lambda function or alias. Call the GetFunction or the GetAlias API to retrieve the latest RevisionId for your resource.

HTTP Status Code: 412


The resource already exists.

HTTP Status Code: 409


The resource (for example, a Lambda function or access policy statement) specified in the request does not exist.

HTTP Status Code: 404


The AWS Lambda service encountered an internal error.

HTTP Status Code: 500


Request throughput limit exceeded.

HTTP Status Code: 429

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: