Configuring block public access settings for your account - Amazon Simple Storage Service
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China.

Configuring block public access settings for your account

Amazon S3 Block Public Access provides settings for access points, buckets, and accounts to help you manage public access to Amazon S3 resources. By default, new buckets, access points, and objects do not allow public access.

For more information, see Blocking public access to your Amazon S3 storage.

You can use the S3 console, Amazon CLI, Amazon SDKs, and REST API to configure block public access settings for all the buckets in your account. For more information, see the sections below.

To configure block public access settings for your buckets, see Configuring block public access settings for your S3 buckets. For information about access points, see Performing block public access operations on an access point.

Amazon S3 block public access prevents the application of any settings that allow public access to data within S3 buckets. This section describes how to edit block public access settings for all the S3 buckets in your Amazon Web Services account. For more information about blocking public access, see Blocking public access to your Amazon S3 storage.

To edit block public access settings for all the S3 buckets in an Amazon Web Services account

  1. Sign in to the Amazon Web Services Management Console and open the Amazon S3 console at https://console.amazonaws.cn/s3/.

  2. Choose Block Public Access settings for this account.

  3. Choose Edit to change the block public access settings for all the buckets in your Amazon Web Services account.

  4. Choose the settings that you want to change, and then choose Save changes.

  5. When you're asked for confirmation, enter confirm. Then choose Confirm to save your changes.

You can use Amazon S3 Block Public Access through the Amazon CLI. For more information about setting up and using the Amazon CLI, see What is the Amazon Command Line Interface?

Account

  • To perform block public access operations on an account, use the Amazon CLI service s3control. The account-level operations that use this service are as follows:

    • PUT PublicAccessBlock (for an account)

    • GET PublicAccessBlock (for an account)

    • DELETE PublicAccessBlock (for an account)

For additional information and examples, see put-public-access-block in the Amazon CLI Reference.

Java

The following examples show you how to use Amazon S3 Block Public Access with the Amazon SDK for Java to put a public access block configuration on an Amazon S3 account. For instructions on how to create and test a working sample, see Using the Amazon SDK for Java.

AWSS3ControlClientBuilder controlClientBuilder = AWSS3ControlClientBuilder.standard(); controlClientBuilder.setRegion(<region>); controlClientBuilder.setCredentials(<credentials>); AWSS3Control client = controlClientBuilder.build(); client.putPublicAccessBlock(new PutPublicAccessBlockRequest() .withAccountId(<account-id>) .withPublicAccessBlockConfiguration(new PublicAccessBlockConfiguration() .withIgnorePublicAcls(<value>) .withBlockPublicAcls(<value>) .withBlockPublicPolicy(<value>) .withRestrictPublicBuckets(<value>)));
Important

This example pertains only to account-level operations, which use the AWSS3Control client class. For bucket-level operations, see the preceding example.

Other SDKs

For information about using the other Amazon SDKs, see Developing with Amazon S3 using the Amazon SDKs, and explorers.

For information about using Amazon S3 Block Public Access through the REST APIs, see the following topics in the Amazon Simple Storage Service API Reference.