Skip to content

S3  >  Operations  >  get_public_access_block

get_public_access_block

Operation

get_public_access_block async

get_public_access_block(request: GetPublicAccessBlockInput | GetPublicAccessBlockInputDict, /, *, plugins: list[Plugin] | None = None) -> GetPublicAccessBlockOutput
get_public_access_block(*, plugins: list[Plugin] | None = None, **kwargs: Unpack[GetPublicAccessBlockInputDict]) -> GetPublicAccessBlockOutput
Note

This operation is not supported for directory buckets.

Retrieves the PublicAccessBlock configuration for an Amazon S3 bucket. This operation returns the bucket-level configuration only. To understand the effective public access behavior, you must also consider account-level settings (which may inherit from organization-level policies). To use this operation, you must have the s3:GetBucketPublicAccessBlock permission. For more information about Amazon S3 permissions, see Specifying Permissions in a Policy.

Warning

When Amazon S3 evaluates the PublicAccessBlock configuration for a bucket or an object, it checks the PublicAccessBlock configuration for both the bucket (or the bucket that contains the object) and the bucket owner's account. Account-level settings automatically inherit from organization-level policies when present. If the PublicAccessBlock settings are different between the bucket and the account, Amazon S3 uses the most restrictive combination of the bucket-level and account-level settings.

For more information about when Amazon S3 considers a bucket or an object public, see The Meaning of "Public".

The following operations are related to GetPublicAccessBlock:

Warning

You must URL encode any signed header values that contain spaces. For example, if your header value is my file.txt, containing two spaces after my, you must URL encode this value to my%20%20file.txt.

Parameters:

Name Type Description Default
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None

Returns:

Type Description
GetPublicAccessBlockOutput

An instance of GetPublicAccessBlockOutput.

Input

Pass the input fields as keyword arguments, or pass a model or dictionary as the first positional argument. Pass plugins separately as a keyword argument.

Model

GetPublicAccessBlockInput dataclass

Bases: _SerdeShape

Dataclass for GetPublicAccessBlockInput structure.

Attributes
bucket class-attribute instance-attribute
bucket: str | None = ...

The name of the Amazon S3 bucket whose PublicAccessBlock configuration you want to retrieve.

expected_bucket_owner class-attribute instance-attribute
expected_bucket_owner: str | None = ...

The account ID of the expected bucket owner. If the account ID that you provide does not match the actual owner of the bucket, the request fails with the HTTP status code 403 Forbidden (access denied).

Dictionaries

GetPublicAccessBlockInputDict

Bases: TypedDict

Dictionary form of GetPublicAccessBlockInput.

Attributes
bucket instance-attribute
bucket: Required[str]

The name of the Amazon S3 bucket whose PublicAccessBlock configuration you want to retrieve.

expected_bucket_owner instance-attribute
expected_bucket_owner: str | None

The account ID of the expected bucket owner. If the account ID that you provide does not match the actual owner of the bucket, the request fails with the HTTP status code 403 Forbidden (access denied).

Output

GetPublicAccessBlockOutput dataclass

Bases: _SerdeShape

Dataclass for GetPublicAccessBlockOutput structure.

Attributes

public_access_block_configuration class-attribute instance-attribute
public_access_block_configuration: PublicAccessBlockConfiguration | None = ...

The PublicAccessBlock configuration currently in effect for this Amazon S3 bucket.

response_metadata class-attribute instance-attribute
response_metadata: ResponseMetadata = ...

Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.