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

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.BucketOwnershipControls

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 a resource to manage S3 Bucket Ownership Controls. For more information, see the S3 Developer Guide.

    This resource cannot be used with S3 directory buckets.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.s3.BucketV2("example", {bucket: "example"});
    const exampleBucketOwnershipControls = new aws.s3.BucketOwnershipControls("example", {
        bucket: example.id,
        rule: {
            objectOwnership: "BucketOwnerPreferred",
        },
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.s3.BucketV2("example", bucket="example")
    example_bucket_ownership_controls = aws.s3.BucketOwnershipControls("example",
        bucket=example.id,
        rule={
            "objectOwnership": "BucketOwnerPreferred",
        })
    
    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("example"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = s3.NewBucketOwnershipControls(ctx, "example", &s3.BucketOwnershipControlsArgs{
    			Bucket: example.ID(),
    			Rule: &s3.BucketOwnershipControlsRuleArgs{
    				ObjectOwnership: pulumi.String("BucketOwnerPreferred"),
    			},
    		})
    		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 = "example",
        });
    
        var exampleBucketOwnershipControls = new Aws.S3.BucketOwnershipControls("example", new()
        {
            Bucket = example.Id,
            Rule = new Aws.S3.Inputs.BucketOwnershipControlsRuleArgs
            {
                ObjectOwnership = "BucketOwnerPreferred",
            },
        });
    
    });
    
    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 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("example")
                .build());
    
            var exampleBucketOwnershipControls = new BucketOwnershipControls("exampleBucketOwnershipControls", BucketOwnershipControlsArgs.builder()
                .bucket(example.id())
                .rule(BucketOwnershipControlsRuleArgs.builder()
                    .objectOwnership("BucketOwnerPreferred")
                    .build())
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:s3:BucketV2
        properties:
          bucket: example
      exampleBucketOwnershipControls:
        type: aws:s3:BucketOwnershipControls
        name: example
        properties:
          bucket: ${example.id}
          rule:
            objectOwnership: BucketOwnerPreferred
    

    Create BucketOwnershipControls Resource

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

    Constructor syntax

    new BucketOwnershipControls(name: string, args: BucketOwnershipControlsArgs, opts?: CustomResourceOptions);
    @overload
    def BucketOwnershipControls(resource_name: str,
                                args: BucketOwnershipControlsArgs,
                                opts: Optional[ResourceOptions] = None)
    
    @overload
    def BucketOwnershipControls(resource_name: str,
                                opts: Optional[ResourceOptions] = None,
                                bucket: Optional[str] = None,
                                rule: Optional[BucketOwnershipControlsRuleArgs] = None)
    func NewBucketOwnershipControls(ctx *Context, name string, args BucketOwnershipControlsArgs, opts ...ResourceOption) (*BucketOwnershipControls, error)
    public BucketOwnershipControls(string name, BucketOwnershipControlsArgs args, CustomResourceOptions? opts = null)
    public BucketOwnershipControls(String name, BucketOwnershipControlsArgs args)
    public BucketOwnershipControls(String name, BucketOwnershipControlsArgs args, CustomResourceOptions options)
    
    type: aws:s3:BucketOwnershipControls
    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 BucketOwnershipControlsArgs
    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 BucketOwnershipControlsArgs
    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 BucketOwnershipControlsArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args BucketOwnershipControlsArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args BucketOwnershipControlsArgs
    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 bucketOwnershipControlsResource = new Aws.S3.BucketOwnershipControls("bucketOwnershipControlsResource", new()
    {
        Bucket = "string",
        Rule = new Aws.S3.Inputs.BucketOwnershipControlsRuleArgs
        {
            ObjectOwnership = "string",
        },
    });
    
    example, err := s3.NewBucketOwnershipControls(ctx, "bucketOwnershipControlsResource", &s3.BucketOwnershipControlsArgs{
    	Bucket: pulumi.String("string"),
    	Rule: &s3.BucketOwnershipControlsRuleArgs{
    		ObjectOwnership: pulumi.String("string"),
    	},
    })
    
    var bucketOwnershipControlsResource = new BucketOwnershipControls("bucketOwnershipControlsResource", BucketOwnershipControlsArgs.builder()
        .bucket("string")
        .rule(BucketOwnershipControlsRuleArgs.builder()
            .objectOwnership("string")
            .build())
        .build());
    
    bucket_ownership_controls_resource = aws.s3.BucketOwnershipControls("bucketOwnershipControlsResource",
        bucket="string",
        rule={
            "objectOwnership": "string",
        })
    
    const bucketOwnershipControlsResource = new aws.s3.BucketOwnershipControls("bucketOwnershipControlsResource", {
        bucket: "string",
        rule: {
            objectOwnership: "string",
        },
    });
    
    type: aws:s3:BucketOwnershipControls
    properties:
        bucket: string
        rule:
            objectOwnership: string
    

    BucketOwnershipControls 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 BucketOwnershipControls resource accepts the following input properties:

    Bucket string
    Name of the bucket that you want to associate this access point with.
    Rule BucketOwnershipControlsRule
    Configuration block(s) with Ownership Controls rules. Detailed below.
    Bucket string
    Name of the bucket that you want to associate this access point with.
    Rule BucketOwnershipControlsRuleArgs
    Configuration block(s) with Ownership Controls rules. Detailed below.
    bucket String
    Name of the bucket that you want to associate this access point with.
    rule BucketOwnershipControlsRule
    Configuration block(s) with Ownership Controls rules. Detailed below.
    bucket string
    Name of the bucket that you want to associate this access point with.
    rule BucketOwnershipControlsRule
    Configuration block(s) with Ownership Controls rules. Detailed below.
    bucket str
    Name of the bucket that you want to associate this access point with.
    rule BucketOwnershipControlsRuleArgs
    Configuration block(s) with Ownership Controls rules. Detailed below.
    bucket String
    Name of the bucket that you want to associate this access point with.
    rule Property Map
    Configuration block(s) with Ownership Controls rules. Detailed below.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the BucketOwnershipControls 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 BucketOwnershipControls Resource

    Get an existing BucketOwnershipControls 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?: BucketOwnershipControlsState, opts?: CustomResourceOptions): BucketOwnershipControls
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            bucket: Optional[str] = None,
            rule: Optional[BucketOwnershipControlsRuleArgs] = None) -> BucketOwnershipControls
    func GetBucketOwnershipControls(ctx *Context, name string, id IDInput, state *BucketOwnershipControlsState, opts ...ResourceOption) (*BucketOwnershipControls, error)
    public static BucketOwnershipControls Get(string name, Input<string> id, BucketOwnershipControlsState? state, CustomResourceOptions? opts = null)
    public static BucketOwnershipControls get(String name, Output<String> id, BucketOwnershipControlsState 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:
    Bucket string
    Name of the bucket that you want to associate this access point with.
    Rule BucketOwnershipControlsRule
    Configuration block(s) with Ownership Controls rules. Detailed below.
    Bucket string
    Name of the bucket that you want to associate this access point with.
    Rule BucketOwnershipControlsRuleArgs
    Configuration block(s) with Ownership Controls rules. Detailed below.
    bucket String
    Name of the bucket that you want to associate this access point with.
    rule BucketOwnershipControlsRule
    Configuration block(s) with Ownership Controls rules. Detailed below.
    bucket string
    Name of the bucket that you want to associate this access point with.
    rule BucketOwnershipControlsRule
    Configuration block(s) with Ownership Controls rules. Detailed below.
    bucket str
    Name of the bucket that you want to associate this access point with.
    rule BucketOwnershipControlsRuleArgs
    Configuration block(s) with Ownership Controls rules. Detailed below.
    bucket String
    Name of the bucket that you want to associate this access point with.
    rule Property Map
    Configuration block(s) with Ownership Controls rules. Detailed below.

    Supporting Types

    BucketOwnershipControlsRule, BucketOwnershipControlsRuleArgs

    ObjectOwnership string
    Object ownership. Valid values: BucketOwnerPreferred, ObjectWriter or BucketOwnerEnforced

    • BucketOwnerPreferred - Objects uploaded to the bucket change ownership to the bucket owner if the objects are uploaded with the bucket-owner-full-control canned ACL.
    • ObjectWriter - Uploading account will own the object if the object is uploaded with the bucket-owner-full-control canned ACL.
    • BucketOwnerEnforced - Bucket owner automatically owns and has full control over every object in the bucket. ACLs no longer affect permissions to data in the S3 bucket.
    ObjectOwnership string
    Object ownership. Valid values: BucketOwnerPreferred, ObjectWriter or BucketOwnerEnforced

    • BucketOwnerPreferred - Objects uploaded to the bucket change ownership to the bucket owner if the objects are uploaded with the bucket-owner-full-control canned ACL.
    • ObjectWriter - Uploading account will own the object if the object is uploaded with the bucket-owner-full-control canned ACL.
    • BucketOwnerEnforced - Bucket owner automatically owns and has full control over every object in the bucket. ACLs no longer affect permissions to data in the S3 bucket.
    objectOwnership String
    Object ownership. Valid values: BucketOwnerPreferred, ObjectWriter or BucketOwnerEnforced

    • BucketOwnerPreferred - Objects uploaded to the bucket change ownership to the bucket owner if the objects are uploaded with the bucket-owner-full-control canned ACL.
    • ObjectWriter - Uploading account will own the object if the object is uploaded with the bucket-owner-full-control canned ACL.
    • BucketOwnerEnforced - Bucket owner automatically owns and has full control over every object in the bucket. ACLs no longer affect permissions to data in the S3 bucket.
    objectOwnership string
    Object ownership. Valid values: BucketOwnerPreferred, ObjectWriter or BucketOwnerEnforced

    • BucketOwnerPreferred - Objects uploaded to the bucket change ownership to the bucket owner if the objects are uploaded with the bucket-owner-full-control canned ACL.
    • ObjectWriter - Uploading account will own the object if the object is uploaded with the bucket-owner-full-control canned ACL.
    • BucketOwnerEnforced - Bucket owner automatically owns and has full control over every object in the bucket. ACLs no longer affect permissions to data in the S3 bucket.
    object_ownership str
    Object ownership. Valid values: BucketOwnerPreferred, ObjectWriter or BucketOwnerEnforced

    • BucketOwnerPreferred - Objects uploaded to the bucket change ownership to the bucket owner if the objects are uploaded with the bucket-owner-full-control canned ACL.
    • ObjectWriter - Uploading account will own the object if the object is uploaded with the bucket-owner-full-control canned ACL.
    • BucketOwnerEnforced - Bucket owner automatically owns and has full control over every object in the bucket. ACLs no longer affect permissions to data in the S3 bucket.
    objectOwnership String
    Object ownership. Valid values: BucketOwnerPreferred, ObjectWriter or BucketOwnerEnforced

    • BucketOwnerPreferred - Objects uploaded to the bucket change ownership to the bucket owner if the objects are uploaded with the bucket-owner-full-control canned ACL.
    • ObjectWriter - Uploading account will own the object if the object is uploaded with the bucket-owner-full-control canned ACL.
    • BucketOwnerEnforced - Bucket owner automatically owns and has full control over every object in the bucket. ACLs no longer affect permissions to data in the S3 bucket.

    Import

    Using pulumi import, import S3 Bucket Ownership Controls using S3 Bucket name. For example:

    $ pulumi import aws:s3/bucketOwnershipControls:BucketOwnershipControls example my-bucket
    

    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