Amazon Simple Storage Service

2018/11/16 - Amazon Simple Storage Service - 4 new api methods

Changes  Add support for new S3 Block Public Access bucket-level APIs. The new Block Public Access settings allow bucket owners to prevent public access to S3 data via bucket/object ACLs or bucket policies.

PutPublicAccessBlock (new) Link ¶

Creates or modifies the Public Access Block configuration for an Amazon S3 bucket.

See also: AWS API Documentation

Request Syntax

client.put_public_access_block(
    Bucket='string',
    ContentMD5='string',
    PublicAccessBlockConfiguration={
        'BlockPublicAcls': True|False,
        'IgnorePublicAcls': True|False,
        'BlockPublicPolicy': True|False,
        'RestrictPublicBuckets': True|False
    }
)
type Bucket

string

param Bucket

[REQUIRED]

The name of the Amazon S3 bucket whose Public Access Block configuration you want to set.

type ContentMD5

string

param ContentMD5

The MD5 hash of the PutPublicBlock request body.

type PublicAccessBlockConfiguration

dict

param PublicAccessBlockConfiguration

[REQUIRED]

The Public Access Block configuration that you want to apply to this Amazon S3 bucket.

  • BlockPublicAcls (boolean) --

    Specifies whether Amazon S3 should block public ACLs for this bucket. Setting this element to TRUE causes the following behavior:

    • PUT Bucket acl and PUT Object acl calls will fail if the specified ACL allows public access.

    • PUT Object calls will fail if the request includes an object ACL.

    Note that enabling this setting doesn't affect existing policies or ACLs.

  • IgnorePublicAcls (boolean) --

    Specifies whether Amazon S3 should ignore public ACLs for this bucket. Setting this element to TRUE causes Amazon S3 to ignore all public ACLs on this bucket and any objects that it contains.

    Note that enabling this setting doesn't affect the persistence of any existing ACLs and doesn't prevent new public ACLs from being set.

  • BlockPublicPolicy (boolean) --

    Specifies whether Amazon S3 should block public bucket policies for this bucket. Setting this element to TRUE causes Amazon S3 to reject calls to PUT Bucket policy if the specified bucket policy allows public access.

    Note that enabling this setting doesn't affect existing bucket policies.

  • RestrictPublicBuckets (boolean) --

    Specifies whether Amazon S3 should restrict public bucket policies for this bucket. If this element is set to TRUE , then only the bucket owner and AWS Services can access this bucket if it has a public policy.

    Note that enabling this setting doesn't affect previously stored bucket policies, except that public and cross-account access within any public bucket policy, including non-public delegation to specific accounts, is blocked.

returns

None

DeletePublicAccessBlock (new) Link ¶

Removes the Public Access Block configuration for an Amazon S3 bucket.

See also: AWS API Documentation

Request Syntax

client.delete_public_access_block(
    Bucket='string'
)
type Bucket

string

param Bucket

[REQUIRED]

The Amazon S3 bucket whose Public Access Block configuration you want to delete.

returns

None

GetBucketPolicyStatus (new) Link ¶

Retrieves the policy status for an Amazon S3 bucket, indicating whether the bucket is public.

See also: AWS API Documentation

Request Syntax

client.get_bucket_policy_status(
    Bucket='string'
)
type Bucket

string

param Bucket

[REQUIRED]

The name of the Amazon S3 bucket whose public-policy status you want to retrieve.

rtype

dict

returns

Response Syntax

{
    'PolicyStatus': {
        'IsPublic': True|False
    }
}

Response Structure

  • (dict) --

    • PolicyStatus (dict) --

      The public-policy status for this bucket.

      • IsPublic (boolean) --

        The public-policy status for this bucket. TRUE indicates that this bucket is public. FALSE indicates that the bucket is not public.

GetPublicAccessBlock (new) Link ¶

Retrieves the Public Access Block configuration for an Amazon S3 bucket.

See also: AWS API Documentation

Request Syntax

client.get_public_access_block(
    Bucket='string'
)
type Bucket

string

param Bucket

[REQUIRED]

The name of the Amazon S3 bucket whose Public Access Block configuration you want to retrieve.

rtype

dict

returns

Response Syntax

{
    'PublicAccessBlockConfiguration': {
        'BlockPublicAcls': True|False,
        'IgnorePublicAcls': True|False,
        'BlockPublicPolicy': True|False,
        'RestrictPublicBuckets': True|False
    }
}

Response Structure

  • (dict) --

    • PublicAccessBlockConfiguration (dict) --

      The Public Access Block configuration currently in effect for this Amazon S3 bucket.

      • BlockPublicAcls (boolean) --

        Specifies whether Amazon S3 should block public ACLs for this bucket. Setting this element to TRUE causes the following behavior:

        • PUT Bucket acl and PUT Object acl calls will fail if the specified ACL allows public access.

        • PUT Object calls will fail if the request includes an object ACL.

        Note that enabling this setting doesn't affect existing policies or ACLs.

      • IgnorePublicAcls (boolean) --

        Specifies whether Amazon S3 should ignore public ACLs for this bucket. Setting this element to TRUE causes Amazon S3 to ignore all public ACLs on this bucket and any objects that it contains.

        Note that enabling this setting doesn't affect the persistence of any existing ACLs and doesn't prevent new public ACLs from being set.

      • BlockPublicPolicy (boolean) --

        Specifies whether Amazon S3 should block public bucket policies for this bucket. Setting this element to TRUE causes Amazon S3 to reject calls to PUT Bucket policy if the specified bucket policy allows public access.

        Note that enabling this setting doesn't affect existing bucket policies.

      • RestrictPublicBuckets (boolean) --

        Specifies whether Amazon S3 should restrict public bucket policies for this bucket. If this element is set to TRUE , then only the bucket owner and AWS Services can access this bucket if it has a public policy.

        Note that enabling this setting doesn't affect previously stored bucket policies, except that public and cross-account access within any public bucket policy, including non-public delegation to specific accounts, is blocked.