Lambda / Client / put_public_access_block_config
put_public_access_block_config#
- Lambda.Client.put_public_access_block_config(**kwargs)#
Note
The option to configure public-access settings, and to use the PutPublicAccessBlock and GetPublicAccessBlock APIs, won’t be available in all Amazon Web Services Regions until September 30, 2024.
Configure your function’s public-access settings.
To control public access to a Lambda function, you can choose whether to allow the creation of resource-based policies that allow public access to that function. You can also block public access to a function, even if it has an existing resource-based policy that allows it.
See also: AWS API Documentation
Request Syntax
response = client.put_public_access_block_config( ResourceArn='string', PublicAccessBlockConfig={ 'BlockPublicPolicy': True|False, 'RestrictPublicResource': True|False } )
- Parameters:
ResourceArn (string) –
[REQUIRED]
The Amazon Resource Name (ARN) of the function you want to configure public-access settings for. Public-access settings are applied at the function level, so you can’t apply different settings to function versions or aliases.
PublicAccessBlockConfig (dict) –
[REQUIRED]
An object defining the public-access settings you want to apply.
To block the creation of resource-based policies that would grant public access to your function, set
BlockPublicPolicy
totrue
. To allow the creation of resource-based policies that would grant public access to your function, setBlockPublicPolicy
tofalse
.To block public access to your function, even if its resource-based policy allows it, set
RestrictPublicResource
totrue
. To allow public access to a function with a resource-based policy that permits it, setRestrictPublicResource
tofalse
.The default setting for both
BlockPublicPolicy
andRestrictPublicResource
istrue
.BlockPublicPolicy (boolean) –
To block the creation of resource-based policies that would grant public access to your function, set
BlockPublicPolicy
totrue
. To allow the creation of resource-based policies that would grant public access to your function, setBlockPublicPolicy
tofalse
.RestrictPublicResource (boolean) –
To block public access to your function, even if its resource-based policy allows it, set
RestrictPublicResource
totrue
. To allow public access to a function with a resource-based policy that permits it, setRestrictPublicResource
tofalse
.
- Return type:
dict
- Returns:
Response Syntax
{ 'PublicAccessBlockConfig': { 'BlockPublicPolicy': True|False, 'RestrictPublicResource': True|False } }
Response Structure
(dict) –
PublicAccessBlockConfig (dict) –
The public-access settings Lambda applied to your function.
BlockPublicPolicy (boolean) –
To block the creation of resource-based policies that would grant public access to your function, set
BlockPublicPolicy
totrue
. To allow the creation of resource-based policies that would grant public access to your function, setBlockPublicPolicy
tofalse
.RestrictPublicResource (boolean) –
To block public access to your function, even if its resource-based policy allows it, set
RestrictPublicResource
totrue
. To allow public access to a function with a resource-based policy that permits it, setRestrictPublicResource
tofalse
.
Exceptions
Lambda.Client.exceptions.ServiceException
Lambda.Client.exceptions.ResourceNotFoundException
Lambda.Client.exceptions.ResourceConflictException
Lambda.Client.exceptions.InvalidParameterValueException
Lambda.Client.exceptions.TooManyRequestsException