BucketPublicAccessBlock

Manages S3 bucket-level Public Access Block configuration. For more information about these settings, see the AWS S3 Block Public Access documentation.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var exampleBucket = new Aws.S3.Bucket("exampleBucket", new Aws.S3.BucketArgs
        {
        });
        var exampleBucketPublicAccessBlock = new Aws.S3.BucketPublicAccessBlock("exampleBucketPublicAccessBlock", new Aws.S3.BucketPublicAccessBlockArgs
        {
            Bucket = exampleBucket.Id,
            BlockPublicAcls = true,
            BlockPublicPolicy = true,
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v4/go/aws/s3"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		exampleBucket, err := s3.NewBucket(ctx, "exampleBucket", nil)
		if err != nil {
			return err
		}
		_, err = s3.NewBucketPublicAccessBlock(ctx, "exampleBucketPublicAccessBlock", &s3.BucketPublicAccessBlockArgs{
			Bucket:            exampleBucket.ID(),
			BlockPublicAcls:   pulumi.Bool(true),
			BlockPublicPolicy: pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_aws as aws

example_bucket = aws.s3.Bucket("exampleBucket")
example_bucket_public_access_block = aws.s3.BucketPublicAccessBlock("exampleBucketPublicAccessBlock",
    bucket=example_bucket.id,
    block_public_acls=True,
    block_public_policy=True)
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const exampleBucket = new aws.s3.Bucket("exampleBucket", {});
const exampleBucketPublicAccessBlock = new aws.s3.BucketPublicAccessBlock("exampleBucketPublicAccessBlock", {
    bucket: exampleBucket.id,
    blockPublicAcls: true,
    blockPublicPolicy: true,
});

Create a BucketPublicAccessBlock Resource

new BucketPublicAccessBlock(name: string, args: BucketPublicAccessBlockArgs, opts?: CustomResourceOptions);
@overload
def BucketPublicAccessBlock(resource_name: str,
                            opts: Optional[ResourceOptions] = None,
                            block_public_acls: Optional[bool] = None,
                            block_public_policy: Optional[bool] = None,
                            bucket: Optional[str] = None,
                            ignore_public_acls: Optional[bool] = None,
                            restrict_public_buckets: Optional[bool] = None)
@overload
def BucketPublicAccessBlock(resource_name: str,
                            args: BucketPublicAccessBlockArgs,
                            opts: Optional[ResourceOptions] = None)
func NewBucketPublicAccessBlock(ctx *Context, name string, args BucketPublicAccessBlockArgs, opts ...ResourceOption) (*BucketPublicAccessBlock, error)
public BucketPublicAccessBlock(string name, BucketPublicAccessBlockArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args BucketPublicAccessBlockArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args BucketPublicAccessBlockArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args BucketPublicAccessBlockArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args BucketPublicAccessBlockArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

BucketPublicAccessBlock Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The BucketPublicAccessBlock resource accepts the following input properties:

Bucket string
S3 Bucket to which this Public Access Block configuration should be applied.
BlockPublicAcls bool

Whether Amazon S3 should block public ACLs for this bucket. Defaults to false. Enabling this setting does not affect existing policies or ACLs. When set 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.
BlockPublicPolicy bool

Whether Amazon S3 should block public bucket policies for this bucket. Defaults to false. Enabling this setting does not affect the existing bucket policy. When set to true causes Amazon S3 to:

  • Reject calls to PUT Bucket policy if the specified bucket policy allows public access.
IgnorePublicAcls bool

Whether Amazon S3 should ignore public ACLs for this bucket. Defaults to false. Enabling this setting does not affect the persistence of any existing ACLs and doesn’t prevent new public ACLs from being set. When set to true causes Amazon S3 to:

  • Ignore public ACLs on this bucket and any objects that it contains.
RestrictPublicBuckets bool

Whether Amazon S3 should restrict public bucket policies for this bucket. Defaults to false. Enabling this setting does not affect the previously stored bucket policy, except that public and cross-account access within the public bucket policy, including non-public delegation to specific accounts, is blocked. When set to true:

  • Only the bucket owner and AWS Services can access this buckets if it has a public policy.
Bucket string
S3 Bucket to which this Public Access Block configuration should be applied.
BlockPublicAcls bool

Whether Amazon S3 should block public ACLs for this bucket. Defaults to false. Enabling this setting does not affect existing policies or ACLs. When set 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.
BlockPublicPolicy bool

Whether Amazon S3 should block public bucket policies for this bucket. Defaults to false. Enabling this setting does not affect the existing bucket policy. When set to true causes Amazon S3 to:

  • Reject calls to PUT Bucket policy if the specified bucket policy allows public access.
IgnorePublicAcls bool

Whether Amazon S3 should ignore public ACLs for this bucket. Defaults to false. Enabling this setting does not affect the persistence of any existing ACLs and doesn’t prevent new public ACLs from being set. When set to true causes Amazon S3 to:

  • Ignore public ACLs on this bucket and any objects that it contains.
RestrictPublicBuckets bool

Whether Amazon S3 should restrict public bucket policies for this bucket. Defaults to false. Enabling this setting does not affect the previously stored bucket policy, except that public and cross-account access within the public bucket policy, including non-public delegation to specific accounts, is blocked. When set to true:

  • Only the bucket owner and AWS Services can access this buckets if it has a public policy.
bucket string
S3 Bucket to which this Public Access Block configuration should be applied.
blockPublicAcls boolean

Whether Amazon S3 should block public ACLs for this bucket. Defaults to false. Enabling this setting does not affect existing policies or ACLs. When set 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.
blockPublicPolicy boolean

Whether Amazon S3 should block public bucket policies for this bucket. Defaults to false. Enabling this setting does not affect the existing bucket policy. When set to true causes Amazon S3 to:

  • Reject calls to PUT Bucket policy if the specified bucket policy allows public access.
ignorePublicAcls boolean

Whether Amazon S3 should ignore public ACLs for this bucket. Defaults to false. Enabling this setting does not affect the persistence of any existing ACLs and doesn’t prevent new public ACLs from being set. When set to true causes Amazon S3 to:

  • Ignore public ACLs on this bucket and any objects that it contains.
restrictPublicBuckets boolean

Whether Amazon S3 should restrict public bucket policies for this bucket. Defaults to false. Enabling this setting does not affect the previously stored bucket policy, except that public and cross-account access within the public bucket policy, including non-public delegation to specific accounts, is blocked. When set to true:

  • Only the bucket owner and AWS Services can access this buckets if it has a public policy.
bucket str
S3 Bucket to which this Public Access Block configuration should be applied.
block_public_acls bool

Whether Amazon S3 should block public ACLs for this bucket. Defaults to false. Enabling this setting does not affect existing policies or ACLs. When set 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.
block_public_policy bool

Whether Amazon S3 should block public bucket policies for this bucket. Defaults to false. Enabling this setting does not affect the existing bucket policy. When set to true causes Amazon S3 to:

  • Reject calls to PUT Bucket policy if the specified bucket policy allows public access.
ignore_public_acls bool

Whether Amazon S3 should ignore public ACLs for this bucket. Defaults to false. Enabling this setting does not affect the persistence of any existing ACLs and doesn’t prevent new public ACLs from being set. When set to true causes Amazon S3 to:

  • Ignore public ACLs on this bucket and any objects that it contains.
restrict_public_buckets bool

Whether Amazon S3 should restrict public bucket policies for this bucket. Defaults to false. Enabling this setting does not affect the previously stored bucket policy, except that public and cross-account access within the public bucket policy, including non-public delegation to specific accounts, is blocked. When set to true:

  • Only the bucket owner and AWS Services can access this buckets if it has a public policy.

Outputs

All input properties are implicitly available as output properties. Additionally, the BucketPublicAccessBlock resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.

Look up an Existing BucketPublicAccessBlock Resource

Get an existing BucketPublicAccessBlock resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: BucketPublicAccessBlockState, opts?: CustomResourceOptions): BucketPublicAccessBlock
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        block_public_acls: Optional[bool] = None,
        block_public_policy: Optional[bool] = None,
        bucket: Optional[str] = None,
        ignore_public_acls: Optional[bool] = None,
        restrict_public_buckets: Optional[bool] = None) -> BucketPublicAccessBlock
func GetBucketPublicAccessBlock(ctx *Context, name string, id IDInput, state *BucketPublicAccessBlockState, opts ...ResourceOption) (*BucketPublicAccessBlock, error)
public static BucketPublicAccessBlock Get(string name, Input<string> id, BucketPublicAccessBlockState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

BlockPublicAcls bool

Whether Amazon S3 should block public ACLs for this bucket. Defaults to false. Enabling this setting does not affect existing policies or ACLs. When set 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.
BlockPublicPolicy bool

Whether Amazon S3 should block public bucket policies for this bucket. Defaults to false. Enabling this setting does not affect the existing bucket policy. When set to true causes Amazon S3 to:

  • Reject calls to PUT Bucket policy if the specified bucket policy allows public access.
Bucket string
S3 Bucket to which this Public Access Block configuration should be applied.
IgnorePublicAcls bool

Whether Amazon S3 should ignore public ACLs for this bucket. Defaults to false. Enabling this setting does not affect the persistence of any existing ACLs and doesn’t prevent new public ACLs from being set. When set to true causes Amazon S3 to:

  • Ignore public ACLs on this bucket and any objects that it contains.
RestrictPublicBuckets bool

Whether Amazon S3 should restrict public bucket policies for this bucket. Defaults to false. Enabling this setting does not affect the previously stored bucket policy, except that public and cross-account access within the public bucket policy, including non-public delegation to specific accounts, is blocked. When set to true:

  • Only the bucket owner and AWS Services can access this buckets if it has a public policy.
BlockPublicAcls bool

Whether Amazon S3 should block public ACLs for this bucket. Defaults to false. Enabling this setting does not affect existing policies or ACLs. When set 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.
BlockPublicPolicy bool

Whether Amazon S3 should block public bucket policies for this bucket. Defaults to false. Enabling this setting does not affect the existing bucket policy. When set to true causes Amazon S3 to:

  • Reject calls to PUT Bucket policy if the specified bucket policy allows public access.
Bucket string
S3 Bucket to which this Public Access Block configuration should be applied.
IgnorePublicAcls bool

Whether Amazon S3 should ignore public ACLs for this bucket. Defaults to false. Enabling this setting does not affect the persistence of any existing ACLs and doesn’t prevent new public ACLs from being set. When set to true causes Amazon S3 to:

  • Ignore public ACLs on this bucket and any objects that it contains.
RestrictPublicBuckets bool

Whether Amazon S3 should restrict public bucket policies for this bucket. Defaults to false. Enabling this setting does not affect the previously stored bucket policy, except that public and cross-account access within the public bucket policy, including non-public delegation to specific accounts, is blocked. When set to true:

  • Only the bucket owner and AWS Services can access this buckets if it has a public policy.
blockPublicAcls boolean

Whether Amazon S3 should block public ACLs for this bucket. Defaults to false. Enabling this setting does not affect existing policies or ACLs. When set 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.
blockPublicPolicy boolean

Whether Amazon S3 should block public bucket policies for this bucket. Defaults to false. Enabling this setting does not affect the existing bucket policy. When set to true causes Amazon S3 to:

  • Reject calls to PUT Bucket policy if the specified bucket policy allows public access.
bucket string
S3 Bucket to which this Public Access Block configuration should be applied.
ignorePublicAcls boolean

Whether Amazon S3 should ignore public ACLs for this bucket. Defaults to false. Enabling this setting does not affect the persistence of any existing ACLs and doesn’t prevent new public ACLs from being set. When set to true causes Amazon S3 to:

  • Ignore public ACLs on this bucket and any objects that it contains.
restrictPublicBuckets boolean

Whether Amazon S3 should restrict public bucket policies for this bucket. Defaults to false. Enabling this setting does not affect the previously stored bucket policy, except that public and cross-account access within the public bucket policy, including non-public delegation to specific accounts, is blocked. When set to true:

  • Only the bucket owner and AWS Services can access this buckets if it has a public policy.
block_public_acls bool

Whether Amazon S3 should block public ACLs for this bucket. Defaults to false. Enabling this setting does not affect existing policies or ACLs. When set 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.
block_public_policy bool

Whether Amazon S3 should block public bucket policies for this bucket. Defaults to false. Enabling this setting does not affect the existing bucket policy. When set to true causes Amazon S3 to:

  • Reject calls to PUT Bucket policy if the specified bucket policy allows public access.
bucket str
S3 Bucket to which this Public Access Block configuration should be applied.
ignore_public_acls bool

Whether Amazon S3 should ignore public ACLs for this bucket. Defaults to false. Enabling this setting does not affect the persistence of any existing ACLs and doesn’t prevent new public ACLs from being set. When set to true causes Amazon S3 to:

  • Ignore public ACLs on this bucket and any objects that it contains.
restrict_public_buckets bool

Whether Amazon S3 should restrict public bucket policies for this bucket. Defaults to false. Enabling this setting does not affect the previously stored bucket policy, except that public and cross-account access within the public bucket policy, including non-public delegation to specific accounts, is blocked. When set to true:

  • Only the bucket owner and AWS Services can access this buckets if it has a public policy.

Import

aws_s3_bucket_public_access_block can be imported by using the bucket name, e.g.

 $ pulumi import aws:s3/bucketPublicAccessBlock:BucketPublicAccessBlock example my-bucket

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.