Lambda / Client / put_resource_policy
put_resource_policy¶
- Lambda.Client.put_resource_policy(**kwargs)¶
Adds a resource-based policy to a Lambda resource. Resource-based policies grant access to other Amazon Web Services accounts, organizations, or services. Resource-based policies apply to a single Lambda resource (for example, a function, function version, or function alias).
Warning
This operation replaces any existing policy on the Lambda resource. If you previously added permissions using the AddPermission operation, the new policy overwrites those permissions.
See also: AWS API Documentation
Request Syntax
response = client.put_resource_policy( ResourceArn='string', Policy='string', RevisionId='string' )
- Parameters:
ResourceArn (string) –
[REQUIRED]
The Amazon Resource Name (ARN) of the Lambda resource you want to add the policy to. You can use a qualified or an unqualified ARN. The value must be a complete ARN, and the operation does not accept wildcard characters.
Policy (string) –
[REQUIRED]
The policy document you want to add to your Lambda resource. This is formatted as a JSON string.
For more information, see Working with resource-based policies in Lambda in the Lambda Developer Guide.
RevisionId (string) – The revision ID that the existing policy must match for the replacement to proceed. If the revision ID doesn’t match, the operation fails with a
PreconditionFailedExceptionerror. To retrieve the current revision ID, use the GetResourcePolicy operation.
- Return type:
dict
- Returns:
Response Syntax
{ 'Policy': 'string', 'RevisionId': 'string' }
Response Structure
(dict) –
Policy (string) –
The resource-based policy that Lambda adds to the resource.
RevisionId (string) –
The revision ID of the policy that Lambda adds to your Lambda resource.
Exceptions
Lambda.Client.exceptions.InvalidParameterValueExceptionLambda.Client.exceptions.ResourceConflictExceptionLambda.Client.exceptions.PublicPolicyExceptionLambda.Client.exceptions.ServiceExceptionLambda.Client.exceptions.TooManyRequestsExceptionLambda.Client.exceptions.PolicyLengthExceededExceptionLambda.Client.exceptions.ResourceNotFoundExceptionLambda.Client.exceptions.PreconditionFailedException