aws logo
AWS Classic v5.32.0, Mar 17 23

aws.s3.BucketOwnershipControls

Provides a resource to manage S3 Bucket Ownership Controls. For more information, see the S3 Developer Guide.

Example Usage

using System.Collections.Generic;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var exampleBucketV2 = new Aws.S3.BucketV2("exampleBucketV2");

    var exampleBucketOwnershipControls = new Aws.S3.BucketOwnershipControls("exampleBucketOwnershipControls", new()
    {
        Bucket = exampleBucketV2.Id,
        Rule = new Aws.S3.Inputs.BucketOwnershipControlsRuleArgs
        {
            ObjectOwnership = "BucketOwnerPreferred",
        },
    });

});
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		exampleBucketV2, err := s3.NewBucketV2(ctx, "exampleBucketV2", nil)
		if err != nil {
			return err
		}
		_, err = s3.NewBucketOwnershipControls(ctx, "exampleBucketOwnershipControls", &s3.BucketOwnershipControlsArgs{
			Bucket: exampleBucketV2.ID(),
			Rule: &s3.BucketOwnershipControlsRuleArgs{
				ObjectOwnership: pulumi.String("BucketOwnerPreferred"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
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.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 exampleBucketV2 = new BucketV2("exampleBucketV2");

        var exampleBucketOwnershipControls = new BucketOwnershipControls("exampleBucketOwnershipControls", BucketOwnershipControlsArgs.builder()        
            .bucket(exampleBucketV2.id())
            .rule(BucketOwnershipControlsRuleArgs.builder()
                .objectOwnership("BucketOwnerPreferred")
                .build())
            .build());

    }
}
import pulumi
import pulumi_aws as aws

example_bucket_v2 = aws.s3.BucketV2("exampleBucketV2")
example_bucket_ownership_controls = aws.s3.BucketOwnershipControls("exampleBucketOwnershipControls",
    bucket=example_bucket_v2.id,
    rule=aws.s3.BucketOwnershipControlsRuleArgs(
        object_ownership="BucketOwnerPreferred",
    ))
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const exampleBucketV2 = new aws.s3.BucketV2("exampleBucketV2", {});
const exampleBucketOwnershipControls = new aws.s3.BucketOwnershipControls("exampleBucketOwnershipControls", {
    bucket: exampleBucketV2.id,
    rule: {
        objectOwnership: "BucketOwnerPreferred",
    },
});
resources:
  exampleBucketV2:
    type: aws:s3:BucketV2
  exampleBucketOwnershipControls:
    type: aws:s3:BucketOwnershipControls
    properties:
      bucket: ${exampleBucketV2.id}
      rule:
        objectOwnership: BucketOwnerPreferred

Create BucketOwnershipControls Resource

new BucketOwnershipControls(name: string, args: BucketOwnershipControlsArgs, opts?: CustomResourceOptions);
@overload
def BucketOwnershipControls(resource_name: str,
                            opts: Optional[ResourceOptions] = None,
                            bucket: Optional[str] = None,
                            rule: Optional[BucketOwnershipControlsRuleArgs] = None)
@overload
def BucketOwnershipControls(resource_name: str,
                            args: BucketOwnershipControlsArgs,
                            opts: Optional[ResourceOptions] = 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.

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.

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 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 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 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 BucketOwnershipControlsRuleArgs

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 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 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 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 BucketOwnershipControlsRuleArgs

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

ObjectOwnership string

Object ownership. Valid values: BucketOwnerPreferred, ObjectWriter or BucketOwnerEnforced

ObjectOwnership string

Object ownership. Valid values: BucketOwnerPreferred, ObjectWriter or BucketOwnerEnforced

objectOwnership String

Object ownership. Valid values: BucketOwnerPreferred, ObjectWriter or BucketOwnerEnforced

objectOwnership string

Object ownership. Valid values: BucketOwnerPreferred, ObjectWriter or BucketOwnerEnforced

object_ownership str

Object ownership. Valid values: BucketOwnerPreferred, ObjectWriter or BucketOwnerEnforced

objectOwnership String

Object ownership. Valid values: BucketOwnerPreferred, ObjectWriter or BucketOwnerEnforced

Import

S3 Bucket Ownership Controls can be imported using S3 Bucket name, e.g.,

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

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.