1. Packages
  2. AWS Classic
  3. API Docs
  4. s3
  5. BucketAclV2

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi

aws.s3.BucketAclV2

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi

    Provides an S3 bucket ACL resource.

    Note: destroy does not delete the S3 Bucket ACL but does remove the resource from state.

    This resource cannot be used with S3 directory buckets.

    Example Usage

    With private ACL

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.s3.BucketV2("example", {bucket: "my-tf-example-bucket"});
    const exampleBucketOwnershipControls = new aws.s3.BucketOwnershipControls("example", {
        bucket: example.id,
        rule: {
            objectOwnership: "BucketOwnerPreferred",
        },
    });
    const exampleBucketAclV2 = new aws.s3.BucketAclV2("example", {
        bucket: example.id,
        acl: "private",
    }, {
        dependsOn: [exampleBucketOwnershipControls],
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.s3.BucketV2("example", bucket="my-tf-example-bucket")
    example_bucket_ownership_controls = aws.s3.BucketOwnershipControls("example",
        bucket=example.id,
        rule={
            "objectOwnership": "BucketOwnerPreferred",
        })
    example_bucket_acl_v2 = aws.s3.BucketAclV2("example",
        bucket=example.id,
        acl="private",
        opts = pulumi.ResourceOptions(depends_on=[example_bucket_ownership_controls]))
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/s3"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := s3.NewBucketV2(ctx, "example", &s3.BucketV2Args{
    			Bucket: pulumi.String("my-tf-example-bucket"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleBucketOwnershipControls, err := s3.NewBucketOwnershipControls(ctx, "example", &s3.BucketOwnershipControlsArgs{
    			Bucket: example.ID(),
    			Rule: &s3.BucketOwnershipControlsRuleArgs{
    				ObjectOwnership: pulumi.String("BucketOwnerPreferred"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = s3.NewBucketAclV2(ctx, "example", &s3.BucketAclV2Args{
    			Bucket: example.ID(),
    			Acl:    pulumi.String("private"),
    		}, pulumi.DependsOn([]pulumi.Resource{
    			exampleBucketOwnershipControls,
    		}))
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Aws.S3.BucketV2("example", new()
        {
            Bucket = "my-tf-example-bucket",
        });
    
        var exampleBucketOwnershipControls = new Aws.S3.BucketOwnershipControls("example", new()
        {
            Bucket = example.Id,
            Rule = new Aws.S3.Inputs.BucketOwnershipControlsRuleArgs
            {
                ObjectOwnership = "BucketOwnerPreferred",
            },
        });
    
        var exampleBucketAclV2 = new Aws.S3.BucketAclV2("example", new()
        {
            Bucket = example.Id,
            Acl = "private",
        }, new CustomResourceOptions
        {
            DependsOn =
            {
                exampleBucketOwnershipControls,
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.s3.BucketV2;
    import com.pulumi.aws.s3.BucketV2Args;
    import com.pulumi.aws.s3.BucketOwnershipControls;
    import com.pulumi.aws.s3.BucketOwnershipControlsArgs;
    import com.pulumi.aws.s3.inputs.BucketOwnershipControlsRuleArgs;
    import com.pulumi.aws.s3.BucketAclV2;
    import com.pulumi.aws.s3.BucketAclV2Args;
    import com.pulumi.resources.CustomResourceOptions;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var example = new BucketV2("example", BucketV2Args.builder()
                .bucket("my-tf-example-bucket")
                .build());
    
            var exampleBucketOwnershipControls = new BucketOwnershipControls("exampleBucketOwnershipControls", BucketOwnershipControlsArgs.builder()
                .bucket(example.id())
                .rule(BucketOwnershipControlsRuleArgs.builder()
                    .objectOwnership("BucketOwnerPreferred")
                    .build())
                .build());
    
            var exampleBucketAclV2 = new BucketAclV2("exampleBucketAclV2", BucketAclV2Args.builder()
                .bucket(example.id())
                .acl("private")
                .build(), CustomResourceOptions.builder()
                    .dependsOn(exampleBucketOwnershipControls)
                    .build());
    
        }
    }
    
    resources:
      example:
        type: aws:s3:BucketV2
        properties:
          bucket: my-tf-example-bucket
      exampleBucketOwnershipControls:
        type: aws:s3:BucketOwnershipControls
        name: example
        properties:
          bucket: ${example.id}
          rule:
            objectOwnership: BucketOwnerPreferred
      exampleBucketAclV2:
        type: aws:s3:BucketAclV2
        name: example
        properties:
          bucket: ${example.id}
          acl: private
        options:
          dependson:
            - ${exampleBucketOwnershipControls}
    

    With public-read ACL

    This example explicitly disables the default S3 bucket security settings. This should be done with caution, as all bucket objects become publicly exposed.

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.s3.BucketV2("example", {bucket: "my-tf-example-bucket"});
    const exampleBucketOwnershipControls = new aws.s3.BucketOwnershipControls("example", {
        bucket: example.id,
        rule: {
            objectOwnership: "BucketOwnerPreferred",
        },
    });
    const exampleBucketPublicAccessBlock = new aws.s3.BucketPublicAccessBlock("example", {
        bucket: example.id,
        blockPublicAcls: false,
        blockPublicPolicy: false,
        ignorePublicAcls: false,
        restrictPublicBuckets: false,
    });
    const exampleBucketAclV2 = new aws.s3.BucketAclV2("example", {
        bucket: example.id,
        acl: "public-read",
    }, {
        dependsOn: [
            exampleBucketOwnershipControls,
            exampleBucketPublicAccessBlock,
        ],
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.s3.BucketV2("example", bucket="my-tf-example-bucket")
    example_bucket_ownership_controls = aws.s3.BucketOwnershipControls("example",
        bucket=example.id,
        rule={
            "objectOwnership": "BucketOwnerPreferred",
        })
    example_bucket_public_access_block = aws.s3.BucketPublicAccessBlock("example",
        bucket=example.id,
        block_public_acls=False,
        block_public_policy=False,
        ignore_public_acls=False,
        restrict_public_buckets=False)
    example_bucket_acl_v2 = aws.s3.BucketAclV2("example",
        bucket=example.id,
        acl="public-read",
        opts = pulumi.ResourceOptions(depends_on=[
                example_bucket_ownership_controls,
                example_bucket_public_access_block,
            ]))
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/s3"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := s3.NewBucketV2(ctx, "example", &s3.BucketV2Args{
    			Bucket: pulumi.String("my-tf-example-bucket"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleBucketOwnershipControls, err := s3.NewBucketOwnershipControls(ctx, "example", &s3.BucketOwnershipControlsArgs{
    			Bucket: example.ID(),
    			Rule: &s3.BucketOwnershipControlsRuleArgs{
    				ObjectOwnership: pulumi.String("BucketOwnerPreferred"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		exampleBucketPublicAccessBlock, err := s3.NewBucketPublicAccessBlock(ctx, "example", &s3.BucketPublicAccessBlockArgs{
    			Bucket:                example.ID(),
    			BlockPublicAcls:       pulumi.Bool(false),
    			BlockPublicPolicy:     pulumi.Bool(false),
    			IgnorePublicAcls:      pulumi.Bool(false),
    			RestrictPublicBuckets: pulumi.Bool(false),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = s3.NewBucketAclV2(ctx, "example", &s3.BucketAclV2Args{
    			Bucket: example.ID(),
    			Acl:    pulumi.String("public-read"),
    		}, pulumi.DependsOn([]pulumi.Resource{
    			exampleBucketOwnershipControls,
    			exampleBucketPublicAccessBlock,
    		}))
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Aws.S3.BucketV2("example", new()
        {
            Bucket = "my-tf-example-bucket",
        });
    
        var exampleBucketOwnershipControls = new Aws.S3.BucketOwnershipControls("example", new()
        {
            Bucket = example.Id,
            Rule = new Aws.S3.Inputs.BucketOwnershipControlsRuleArgs
            {
                ObjectOwnership = "BucketOwnerPreferred",
            },
        });
    
        var exampleBucketPublicAccessBlock = new Aws.S3.BucketPublicAccessBlock("example", new()
        {
            Bucket = example.Id,
            BlockPublicAcls = false,
            BlockPublicPolicy = false,
            IgnorePublicAcls = false,
            RestrictPublicBuckets = false,
        });
    
        var exampleBucketAclV2 = new Aws.S3.BucketAclV2("example", new()
        {
            Bucket = example.Id,
            Acl = "public-read",
        }, new CustomResourceOptions
        {
            DependsOn =
            {
                exampleBucketOwnershipControls,
                exampleBucketPublicAccessBlock,
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.s3.BucketV2;
    import com.pulumi.aws.s3.BucketV2Args;
    import com.pulumi.aws.s3.BucketOwnershipControls;
    import com.pulumi.aws.s3.BucketOwnershipControlsArgs;
    import com.pulumi.aws.s3.inputs.BucketOwnershipControlsRuleArgs;
    import com.pulumi.aws.s3.BucketPublicAccessBlock;
    import com.pulumi.aws.s3.BucketPublicAccessBlockArgs;
    import com.pulumi.aws.s3.BucketAclV2;
    import com.pulumi.aws.s3.BucketAclV2Args;
    import com.pulumi.resources.CustomResourceOptions;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var example = new BucketV2("example", BucketV2Args.builder()
                .bucket("my-tf-example-bucket")
                .build());
    
            var exampleBucketOwnershipControls = new BucketOwnershipControls("exampleBucketOwnershipControls", BucketOwnershipControlsArgs.builder()
                .bucket(example.id())
                .rule(BucketOwnershipControlsRuleArgs.builder()
                    .objectOwnership("BucketOwnerPreferred")
                    .build())
                .build());
    
            var exampleBucketPublicAccessBlock = new BucketPublicAccessBlock("exampleBucketPublicAccessBlock", BucketPublicAccessBlockArgs.builder()
                .bucket(example.id())
                .blockPublicAcls(false)
                .blockPublicPolicy(false)
                .ignorePublicAcls(false)
                .restrictPublicBuckets(false)
                .build());
    
            var exampleBucketAclV2 = new BucketAclV2("exampleBucketAclV2", BucketAclV2Args.builder()
                .bucket(example.id())
                .acl("public-read")
                .build(), CustomResourceOptions.builder()
                    .dependsOn(                
                        exampleBucketOwnershipControls,
                        exampleBucketPublicAccessBlock)
                    .build());
    
        }
    }
    
    resources:
      example:
        type: aws:s3:BucketV2
        properties:
          bucket: my-tf-example-bucket
      exampleBucketOwnershipControls:
        type: aws:s3:BucketOwnershipControls
        name: example
        properties:
          bucket: ${example.id}
          rule:
            objectOwnership: BucketOwnerPreferred
      exampleBucketPublicAccessBlock:
        type: aws:s3:BucketPublicAccessBlock
        name: example
        properties:
          bucket: ${example.id}
          blockPublicAcls: false
          blockPublicPolicy: false
          ignorePublicAcls: false
          restrictPublicBuckets: false
      exampleBucketAclV2:
        type: aws:s3:BucketAclV2
        name: example
        properties:
          bucket: ${example.id}
          acl: public-read
        options:
          dependson:
            - ${exampleBucketOwnershipControls}
            - ${exampleBucketPublicAccessBlock}
    

    With Grants

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const current = aws.s3.getCanonicalUserId({});
    const example = new aws.s3.BucketV2("example", {bucket: "my-tf-example-bucket"});
    const exampleBucketOwnershipControls = new aws.s3.BucketOwnershipControls("example", {
        bucket: example.id,
        rule: {
            objectOwnership: "BucketOwnerPreferred",
        },
    });
    const exampleBucketAclV2 = new aws.s3.BucketAclV2("example", {
        bucket: example.id,
        accessControlPolicy: {
            grants: [
                {
                    grantee: {
                        id: current.then(current => current.id),
                        type: "CanonicalUser",
                    },
                    permission: "READ",
                },
                {
                    grantee: {
                        type: "Group",
                        uri: "http://acs.amazonaws.com/groups/s3/LogDelivery",
                    },
                    permission: "READ_ACP",
                },
            ],
            owner: {
                id: current.then(current => current.id),
            },
        },
    }, {
        dependsOn: [exampleBucketOwnershipControls],
    });
    
    import pulumi
    import pulumi_aws as aws
    
    current = aws.s3.get_canonical_user_id()
    example = aws.s3.BucketV2("example", bucket="my-tf-example-bucket")
    example_bucket_ownership_controls = aws.s3.BucketOwnershipControls("example",
        bucket=example.id,
        rule={
            "objectOwnership": "BucketOwnerPreferred",
        })
    example_bucket_acl_v2 = aws.s3.BucketAclV2("example",
        bucket=example.id,
        access_control_policy={
            "grants": [
                {
                    "grantee": {
                        "id": current.id,
                        "type": "CanonicalUser",
                    },
                    "permission": "READ",
                },
                {
                    "grantee": {
                        "type": "Group",
                        "uri": "http://acs.amazonaws.com/groups/s3/LogDelivery",
                    },
                    "permission": "READ_ACP",
                },
            ],
            "owner": {
                "id": current.id,
            },
        },
        opts = pulumi.ResourceOptions(depends_on=[example_bucket_ownership_controls]))
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/s3"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		current, err := s3.GetCanonicalUserId(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		example, err := s3.NewBucketV2(ctx, "example", &s3.BucketV2Args{
    			Bucket: pulumi.String("my-tf-example-bucket"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleBucketOwnershipControls, err := s3.NewBucketOwnershipControls(ctx, "example", &s3.BucketOwnershipControlsArgs{
    			Bucket: example.ID(),
    			Rule: &s3.BucketOwnershipControlsRuleArgs{
    				ObjectOwnership: pulumi.String("BucketOwnerPreferred"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = s3.NewBucketAclV2(ctx, "example", &s3.BucketAclV2Args{
    			Bucket: example.ID(),
    			AccessControlPolicy: &s3.BucketAclV2AccessControlPolicyArgs{
    				Grants: s3.BucketAclV2AccessControlPolicyGrantArray{
    					&s3.BucketAclV2AccessControlPolicyGrantArgs{
    						Grantee: &s3.BucketAclV2AccessControlPolicyGrantGranteeArgs{
    							Id:   pulumi.String(current.Id),
    							Type: pulumi.String("CanonicalUser"),
    						},
    						Permission: pulumi.String("READ"),
    					},
    					&s3.BucketAclV2AccessControlPolicyGrantArgs{
    						Grantee: &s3.BucketAclV2AccessControlPolicyGrantGranteeArgs{
    							Type: pulumi.String("Group"),
    							Uri:  pulumi.String("http://acs.amazonaws.com/groups/s3/LogDelivery"),
    						},
    						Permission: pulumi.String("READ_ACP"),
    					},
    				},
    				Owner: &s3.BucketAclV2AccessControlPolicyOwnerArgs{
    					Id: pulumi.String(current.Id),
    				},
    			},
    		}, pulumi.DependsOn([]pulumi.Resource{
    			exampleBucketOwnershipControls,
    		}))
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var current = Aws.S3.GetCanonicalUserId.Invoke();
    
        var example = new Aws.S3.BucketV2("example", new()
        {
            Bucket = "my-tf-example-bucket",
        });
    
        var exampleBucketOwnershipControls = new Aws.S3.BucketOwnershipControls("example", new()
        {
            Bucket = example.Id,
            Rule = new Aws.S3.Inputs.BucketOwnershipControlsRuleArgs
            {
                ObjectOwnership = "BucketOwnerPreferred",
            },
        });
    
        var exampleBucketAclV2 = new Aws.S3.BucketAclV2("example", new()
        {
            Bucket = example.Id,
            AccessControlPolicy = new Aws.S3.Inputs.BucketAclV2AccessControlPolicyArgs
            {
                Grants = new[]
                {
                    new Aws.S3.Inputs.BucketAclV2AccessControlPolicyGrantArgs
                    {
                        Grantee = new Aws.S3.Inputs.BucketAclV2AccessControlPolicyGrantGranteeArgs
                        {
                            Id = current.Apply(getCanonicalUserIdResult => getCanonicalUserIdResult.Id),
                            Type = "CanonicalUser",
                        },
                        Permission = "READ",
                    },
                    new Aws.S3.Inputs.BucketAclV2AccessControlPolicyGrantArgs
                    {
                        Grantee = new Aws.S3.Inputs.BucketAclV2AccessControlPolicyGrantGranteeArgs
                        {
                            Type = "Group",
                            Uri = "http://acs.amazonaws.com/groups/s3/LogDelivery",
                        },
                        Permission = "READ_ACP",
                    },
                },
                Owner = new Aws.S3.Inputs.BucketAclV2AccessControlPolicyOwnerArgs
                {
                    Id = current.Apply(getCanonicalUserIdResult => getCanonicalUserIdResult.Id),
                },
            },
        }, new CustomResourceOptions
        {
            DependsOn =
            {
                exampleBucketOwnershipControls,
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.s3.S3Functions;
    import com.pulumi.aws.s3.BucketV2;
    import com.pulumi.aws.s3.BucketV2Args;
    import com.pulumi.aws.s3.BucketOwnershipControls;
    import com.pulumi.aws.s3.BucketOwnershipControlsArgs;
    import com.pulumi.aws.s3.inputs.BucketOwnershipControlsRuleArgs;
    import com.pulumi.aws.s3.BucketAclV2;
    import com.pulumi.aws.s3.BucketAclV2Args;
    import com.pulumi.aws.s3.inputs.BucketAclV2AccessControlPolicyArgs;
    import com.pulumi.aws.s3.inputs.BucketAclV2AccessControlPolicyOwnerArgs;
    import com.pulumi.resources.CustomResourceOptions;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var current = S3Functions.getCanonicalUserId();
    
            var example = new BucketV2("example", BucketV2Args.builder()
                .bucket("my-tf-example-bucket")
                .build());
    
            var exampleBucketOwnershipControls = new BucketOwnershipControls("exampleBucketOwnershipControls", BucketOwnershipControlsArgs.builder()
                .bucket(example.id())
                .rule(BucketOwnershipControlsRuleArgs.builder()
                    .objectOwnership("BucketOwnerPreferred")
                    .build())
                .build());
    
            var exampleBucketAclV2 = new BucketAclV2("exampleBucketAclV2", BucketAclV2Args.builder()
                .bucket(example.id())
                .accessControlPolicy(BucketAclV2AccessControlPolicyArgs.builder()
                    .grants(                
                        BucketAclV2AccessControlPolicyGrantArgs.builder()
                            .grantee(BucketAclV2AccessControlPolicyGrantGranteeArgs.builder()
                                .id(current.applyValue(getCanonicalUserIdResult -> getCanonicalUserIdResult.id()))
                                .type("CanonicalUser")
                                .build())
                            .permission("READ")
                            .build(),
                        BucketAclV2AccessControlPolicyGrantArgs.builder()
                            .grantee(BucketAclV2AccessControlPolicyGrantGranteeArgs.builder()
                                .type("Group")
                                .uri("http://acs.amazonaws.com/groups/s3/LogDelivery")
                                .build())
                            .permission("READ_ACP")
                            .build())
                    .owner(BucketAclV2AccessControlPolicyOwnerArgs.builder()
                        .id(current.applyValue(getCanonicalUserIdResult -> getCanonicalUserIdResult.id()))
                        .build())
                    .build())
                .build(), CustomResourceOptions.builder()
                    .dependsOn(exampleBucketOwnershipControls)
                    .build());
    
        }
    }
    
    resources:
      example:
        type: aws:s3:BucketV2
        properties:
          bucket: my-tf-example-bucket
      exampleBucketOwnershipControls:
        type: aws:s3:BucketOwnershipControls
        name: example
        properties:
          bucket: ${example.id}
          rule:
            objectOwnership: BucketOwnerPreferred
      exampleBucketAclV2:
        type: aws:s3:BucketAclV2
        name: example
        properties:
          bucket: ${example.id}
          accessControlPolicy:
            grants:
              - grantee:
                  id: ${current.id}
                  type: CanonicalUser
                permission: READ
              - grantee:
                  type: Group
                  uri: http://acs.amazonaws.com/groups/s3/LogDelivery
                permission: READ_ACP
            owner:
              id: ${current.id}
        options:
          dependson:
            - ${exampleBucketOwnershipControls}
    variables:
      current:
        fn::invoke:
          Function: aws:s3:getCanonicalUserId
          Arguments: {}
    

    Create BucketAclV2 Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new BucketAclV2(name: string, args: BucketAclV2Args, opts?: CustomResourceOptions);
    @overload
    def BucketAclV2(resource_name: str,
                    args: BucketAclV2Args,
                    opts: Optional[ResourceOptions] = None)
    
    @overload
    def BucketAclV2(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    bucket: Optional[str] = None,
                    access_control_policy: Optional[BucketAclV2AccessControlPolicyArgs] = None,
                    acl: Optional[str] = None,
                    expected_bucket_owner: Optional[str] = None)
    func NewBucketAclV2(ctx *Context, name string, args BucketAclV2Args, opts ...ResourceOption) (*BucketAclV2, error)
    public BucketAclV2(string name, BucketAclV2Args args, CustomResourceOptions? opts = null)
    public BucketAclV2(String name, BucketAclV2Args args)
    public BucketAclV2(String name, BucketAclV2Args args, CustomResourceOptions options)
    
    type: aws:s3:BucketAclV2
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args BucketAclV2Args
    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 BucketAclV2Args
    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 BucketAclV2Args
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args BucketAclV2Args
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args BucketAclV2Args
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var bucketAclV2Resource = new Aws.S3.BucketAclV2("bucketAclV2Resource", new()
    {
        Bucket = "string",
        AccessControlPolicy = new Aws.S3.Inputs.BucketAclV2AccessControlPolicyArgs
        {
            Owner = new Aws.S3.Inputs.BucketAclV2AccessControlPolicyOwnerArgs
            {
                Id = "string",
                DisplayName = "string",
            },
            Grants = new[]
            {
                new Aws.S3.Inputs.BucketAclV2AccessControlPolicyGrantArgs
                {
                    Permission = "string",
                    Grantee = new Aws.S3.Inputs.BucketAclV2AccessControlPolicyGrantGranteeArgs
                    {
                        Type = "string",
                        DisplayName = "string",
                        EmailAddress = "string",
                        Id = "string",
                        Uri = "string",
                    },
                },
            },
        },
        Acl = "string",
        ExpectedBucketOwner = "string",
    });
    
    example, err := s3.NewBucketAclV2(ctx, "bucketAclV2Resource", &s3.BucketAclV2Args{
    	Bucket: pulumi.String("string"),
    	AccessControlPolicy: &s3.BucketAclV2AccessControlPolicyArgs{
    		Owner: &s3.BucketAclV2AccessControlPolicyOwnerArgs{
    			Id:          pulumi.String("string"),
    			DisplayName: pulumi.String("string"),
    		},
    		Grants: s3.BucketAclV2AccessControlPolicyGrantArray{
    			&s3.BucketAclV2AccessControlPolicyGrantArgs{
    				Permission: pulumi.String("string"),
    				Grantee: &s3.BucketAclV2AccessControlPolicyGrantGranteeArgs{
    					Type:         pulumi.String("string"),
    					DisplayName:  pulumi.String("string"),
    					EmailAddress: pulumi.String("string"),
    					Id:           pulumi.String("string"),
    					Uri:          pulumi.String("string"),
    				},
    			},
    		},
    	},
    	Acl:                 pulumi.String("string"),
    	ExpectedBucketOwner: pulumi.String("string"),
    })
    
    var bucketAclV2Resource = new BucketAclV2("bucketAclV2Resource", BucketAclV2Args.builder()
        .bucket("string")
        .accessControlPolicy(BucketAclV2AccessControlPolicyArgs.builder()
            .owner(BucketAclV2AccessControlPolicyOwnerArgs.builder()
                .id("string")
                .displayName("string")
                .build())
            .grants(BucketAclV2AccessControlPolicyGrantArgs.builder()
                .permission("string")
                .grantee(BucketAclV2AccessControlPolicyGrantGranteeArgs.builder()
                    .type("string")
                    .displayName("string")
                    .emailAddress("string")
                    .id("string")
                    .uri("string")
                    .build())
                .build())
            .build())
        .acl("string")
        .expectedBucketOwner("string")
        .build());
    
    bucket_acl_v2_resource = aws.s3.BucketAclV2("bucketAclV2Resource",
        bucket="string",
        access_control_policy={
            "owner": {
                "id": "string",
                "displayName": "string",
            },
            "grants": [{
                "permission": "string",
                "grantee": {
                    "type": "string",
                    "displayName": "string",
                    "emailAddress": "string",
                    "id": "string",
                    "uri": "string",
                },
            }],
        },
        acl="string",
        expected_bucket_owner="string")
    
    const bucketAclV2Resource = new aws.s3.BucketAclV2("bucketAclV2Resource", {
        bucket: "string",
        accessControlPolicy: {
            owner: {
                id: "string",
                displayName: "string",
            },
            grants: [{
                permission: "string",
                grantee: {
                    type: "string",
                    displayName: "string",
                    emailAddress: "string",
                    id: "string",
                    uri: "string",
                },
            }],
        },
        acl: "string",
        expectedBucketOwner: "string",
    });
    
    type: aws:s3:BucketAclV2
    properties:
        accessControlPolicy:
            grants:
                - grantee:
                    displayName: string
                    emailAddress: string
                    id: string
                    type: string
                    uri: string
                  permission: string
            owner:
                displayName: string
                id: string
        acl: string
        bucket: string
        expectedBucketOwner: string
    

    BucketAclV2 Resource Properties

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

    Inputs

    The BucketAclV2 resource accepts the following input properties:

    Bucket string
    Bucket to which to apply the ACL.
    AccessControlPolicy BucketAclV2AccessControlPolicy
    Configuration block that sets the ACL permissions for an object per grantee. See below.
    Acl string
    Canned ACL to apply to the bucket.
    ExpectedBucketOwner string
    Account ID of the expected bucket owner.
    Bucket string
    Bucket to which to apply the ACL.
    AccessControlPolicy BucketAclV2AccessControlPolicyArgs
    Configuration block that sets the ACL permissions for an object per grantee. See below.
    Acl string
    Canned ACL to apply to the bucket.
    ExpectedBucketOwner string
    Account ID of the expected bucket owner.
    bucket String
    Bucket to which to apply the ACL.
    accessControlPolicy BucketAclV2AccessControlPolicy
    Configuration block that sets the ACL permissions for an object per grantee. See below.
    acl String
    Canned ACL to apply to the bucket.
    expectedBucketOwner String
    Account ID of the expected bucket owner.
    bucket string
    Bucket to which to apply the ACL.
    accessControlPolicy BucketAclV2AccessControlPolicy
    Configuration block that sets the ACL permissions for an object per grantee. See below.
    acl string
    Canned ACL to apply to the bucket.
    expectedBucketOwner string
    Account ID of the expected bucket owner.
    bucket str
    Bucket to which to apply the ACL.
    access_control_policy BucketAclV2AccessControlPolicyArgs
    Configuration block that sets the ACL permissions for an object per grantee. See below.
    acl str
    Canned ACL to apply to the bucket.
    expected_bucket_owner str
    Account ID of the expected bucket owner.
    bucket String
    Bucket to which to apply the ACL.
    accessControlPolicy Property Map
    Configuration block that sets the ACL permissions for an object per grantee. See below.
    acl String
    Canned ACL to apply to the bucket.
    expectedBucketOwner String
    Account ID of the expected bucket owner.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the BucketAclV2 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 string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing BucketAclV2 Resource

    Get an existing BucketAclV2 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?: BucketAclV2State, opts?: CustomResourceOptions): BucketAclV2
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            access_control_policy: Optional[BucketAclV2AccessControlPolicyArgs] = None,
            acl: Optional[str] = None,
            bucket: Optional[str] = None,
            expected_bucket_owner: Optional[str] = None) -> BucketAclV2
    func GetBucketAclV2(ctx *Context, name string, id IDInput, state *BucketAclV2State, opts ...ResourceOption) (*BucketAclV2, error)
    public static BucketAclV2 Get(string name, Input<string> id, BucketAclV2State? state, CustomResourceOptions? opts = null)
    public static BucketAclV2 get(String name, Output<String> id, BucketAclV2State state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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.
    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:
    AccessControlPolicy BucketAclV2AccessControlPolicy
    Configuration block that sets the ACL permissions for an object per grantee. See below.
    Acl string
    Canned ACL to apply to the bucket.
    Bucket string
    Bucket to which to apply the ACL.
    ExpectedBucketOwner string
    Account ID of the expected bucket owner.
    AccessControlPolicy BucketAclV2AccessControlPolicyArgs
    Configuration block that sets the ACL permissions for an object per grantee. See below.
    Acl string
    Canned ACL to apply to the bucket.
    Bucket string
    Bucket to which to apply the ACL.
    ExpectedBucketOwner string
    Account ID of the expected bucket owner.
    accessControlPolicy BucketAclV2AccessControlPolicy
    Configuration block that sets the ACL permissions for an object per grantee. See below.
    acl String
    Canned ACL to apply to the bucket.
    bucket String
    Bucket to which to apply the ACL.
    expectedBucketOwner String
    Account ID of the expected bucket owner.
    accessControlPolicy BucketAclV2AccessControlPolicy
    Configuration block that sets the ACL permissions for an object per grantee. See below.
    acl string
    Canned ACL to apply to the bucket.
    bucket string
    Bucket to which to apply the ACL.
    expectedBucketOwner string
    Account ID of the expected bucket owner.
    access_control_policy BucketAclV2AccessControlPolicyArgs
    Configuration block that sets the ACL permissions for an object per grantee. See below.
    acl str
    Canned ACL to apply to the bucket.
    bucket str
    Bucket to which to apply the ACL.
    expected_bucket_owner str
    Account ID of the expected bucket owner.
    accessControlPolicy Property Map
    Configuration block that sets the ACL permissions for an object per grantee. See below.
    acl String
    Canned ACL to apply to the bucket.
    bucket String
    Bucket to which to apply the ACL.
    expectedBucketOwner String
    Account ID of the expected bucket owner.

    Supporting Types

    BucketAclV2AccessControlPolicy, BucketAclV2AccessControlPolicyArgs

    Owner BucketAclV2AccessControlPolicyOwner
    Configuration block for the bucket owner's display name and ID. See below.
    Grants List<BucketAclV2AccessControlPolicyGrant>
    Set of grant configuration blocks. See below.
    Owner BucketAclV2AccessControlPolicyOwner
    Configuration block for the bucket owner's display name and ID. See below.
    Grants []BucketAclV2AccessControlPolicyGrant
    Set of grant configuration blocks. See below.
    owner BucketAclV2AccessControlPolicyOwner
    Configuration block for the bucket owner's display name and ID. See below.
    grants List<BucketAclV2AccessControlPolicyGrant>
    Set of grant configuration blocks. See below.
    owner BucketAclV2AccessControlPolicyOwner
    Configuration block for the bucket owner's display name and ID. See below.
    grants BucketAclV2AccessControlPolicyGrant[]
    Set of grant configuration blocks. See below.
    owner BucketAclV2AccessControlPolicyOwner
    Configuration block for the bucket owner's display name and ID. See below.
    grants Sequence[BucketAclV2AccessControlPolicyGrant]
    Set of grant configuration blocks. See below.
    owner Property Map
    Configuration block for the bucket owner's display name and ID. See below.
    grants List<Property Map>
    Set of grant configuration blocks. See below.

    BucketAclV2AccessControlPolicyGrant, BucketAclV2AccessControlPolicyGrantArgs

    Permission string
    Logging permissions assigned to the grantee for the bucket. Valid values: FULL_CONTROL, WRITE, WRITE_ACP, READ, READ_ACP. See What permissions can I grant? for more details about what each permission means in the context of buckets.
    Grantee BucketAclV2AccessControlPolicyGrantGrantee
    Configuration block for the person being granted permissions. See below.
    Permission string
    Logging permissions assigned to the grantee for the bucket. Valid values: FULL_CONTROL, WRITE, WRITE_ACP, READ, READ_ACP. See What permissions can I grant? for more details about what each permission means in the context of buckets.
    Grantee BucketAclV2AccessControlPolicyGrantGrantee
    Configuration block for the person being granted permissions. See below.
    permission String
    Logging permissions assigned to the grantee for the bucket. Valid values: FULL_CONTROL, WRITE, WRITE_ACP, READ, READ_ACP. See What permissions can I grant? for more details about what each permission means in the context of buckets.
    grantee BucketAclV2AccessControlPolicyGrantGrantee
    Configuration block for the person being granted permissions. See below.
    permission string
    Logging permissions assigned to the grantee for the bucket. Valid values: FULL_CONTROL, WRITE, WRITE_ACP, READ, READ_ACP. See What permissions can I grant? for more details about what each permission means in the context of buckets.
    grantee BucketAclV2AccessControlPolicyGrantGrantee
    Configuration block for the person being granted permissions. See below.
    permission str
    Logging permissions assigned to the grantee for the bucket. Valid values: FULL_CONTROL, WRITE, WRITE_ACP, READ, READ_ACP. See What permissions can I grant? for more details about what each permission means in the context of buckets.
    grantee BucketAclV2AccessControlPolicyGrantGrantee
    Configuration block for the person being granted permissions. See below.
    permission String
    Logging permissions assigned to the grantee for the bucket. Valid values: FULL_CONTROL, WRITE, WRITE_ACP, READ, READ_ACP. See What permissions can I grant? for more details about what each permission means in the context of buckets.
    grantee Property Map
    Configuration block for the person being granted permissions. See below.

    BucketAclV2AccessControlPolicyGrantGrantee, BucketAclV2AccessControlPolicyGrantGranteeArgs

    Type string
    Type of grantee. Valid values: CanonicalUser, AmazonCustomerByEmail, Group.
    DisplayName string
    EmailAddress string
    Email address of the grantee. See Regions and Endpoints for supported AWS regions where this argument can be specified.
    Id string
    Canonical user ID of the grantee.
    Uri string
    URI of the grantee group.
    Type string
    Type of grantee. Valid values: CanonicalUser, AmazonCustomerByEmail, Group.
    DisplayName string
    EmailAddress string
    Email address of the grantee. See Regions and Endpoints for supported AWS regions where this argument can be specified.
    Id string
    Canonical user ID of the grantee.
    Uri string
    URI of the grantee group.
    type String
    Type of grantee. Valid values: CanonicalUser, AmazonCustomerByEmail, Group.
    displayName String
    emailAddress String
    Email address of the grantee. See Regions and Endpoints for supported AWS regions where this argument can be specified.
    id String
    Canonical user ID of the grantee.
    uri String
    URI of the grantee group.
    type string
    Type of grantee. Valid values: CanonicalUser, AmazonCustomerByEmail, Group.
    displayName string
    emailAddress string
    Email address of the grantee. See Regions and Endpoints for supported AWS regions where this argument can be specified.
    id string
    Canonical user ID of the grantee.
    uri string
    URI of the grantee group.
    type str
    Type of grantee. Valid values: CanonicalUser, AmazonCustomerByEmail, Group.
    display_name str
    email_address str
    Email address of the grantee. See Regions and Endpoints for supported AWS regions where this argument can be specified.
    id str
    Canonical user ID of the grantee.
    uri str
    URI of the grantee group.
    type String
    Type of grantee. Valid values: CanonicalUser, AmazonCustomerByEmail, Group.
    displayName String
    emailAddress String
    Email address of the grantee. See Regions and Endpoints for supported AWS regions where this argument can be specified.
    id String
    Canonical user ID of the grantee.
    uri String
    URI of the grantee group.

    BucketAclV2AccessControlPolicyOwner, BucketAclV2AccessControlPolicyOwnerArgs

    Id string
    ID of the owner.
    DisplayName string
    Display name of the owner.
    Id string
    ID of the owner.
    DisplayName string
    Display name of the owner.
    id String
    ID of the owner.
    displayName String
    Display name of the owner.
    id string
    ID of the owner.
    displayName string
    Display name of the owner.
    id str
    ID of the owner.
    display_name str
    Display name of the owner.
    id String
    ID of the owner.
    displayName String
    Display name of the owner.

    Import

    If the owner (account ID) of the source bucket is the same account used to configure the AWS Provider, and the source bucket is configured with a canned ACL (i.e. predefined grant), import using the bucket and acl separated by a comma (,):

    If the owner (account ID) of the source bucket differs from the account used to configure the AWS Provider, and the source bucket is not configured with a canned ACL (i.e. predefined grant), imported using the bucket and expected_bucket_owner separated by a comma (,):

    If the owner (account ID) of the source bucket differs from the account used to configure the AWS Provider, and the source bucket is configured with a canned ACL (i.e. predefined grant), imported using the bucket, expected_bucket_owner, and acl separated by commas (,):

    Using pulumi import to import using bucket, expected_bucket_owner, and/or acl, depending on your situation. For example:

    If the owner (account ID) of the source bucket is the same account used to configure the AWS Provider, and the source bucket is not configured with a canned ACL (i.e. predefined grant), import using the bucket:

    $ pulumi import aws:s3/bucketAclV2:BucketAclV2 example bucket-name
    

    If the owner (account ID) of the source bucket is the same account used to configure the AWS Provider, and the source bucket is configured with a canned ACL (i.e. predefined grant), import using the bucket and acl separated by a comma (,):

    $ pulumi import aws:s3/bucketAclV2:BucketAclV2 example bucket-name,private
    

    If the owner (account ID) of the source bucket differs from the account used to configure the AWS Provider, and the source bucket is not configured with a canned ACL (i.e. predefined grant), imported using the bucket and expected_bucket_owner separated by a comma (,):

    $ pulumi import aws:s3/bucketAclV2:BucketAclV2 example bucket-name,123456789012
    

    If the owner (account ID) of the source bucket differs from the account used to configure the AWS Provider, and the source bucket is configured with a canned ACL (i.e. predefined grant), imported using the bucket, expected_bucket_owner, and acl separated by commas (,):

    $ pulumi import aws:s3/bucketAclV2:BucketAclV2 example bucket-name,123456789012,private
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi