Jump to Content

New API Documentation - Developer Preview Available

We are excited to announce the developer preview of our new API documentation for AWS SDK for JavaScript v3. Please follow instructions on the landing page to leave us your feedback.

Class PutBucketOwnershipControlsCommandProtected

Creates or modifies OwnershipControls for an Amazon S3 bucket. To use this operation, you must have the s3:PutBucketOwnershipControls permission. For more information about Amazon S3 permissions, see Specifying permissions in a policy.

For information about Amazon S3 Object Ownership, see Using object ownership.

The following operations are related to PutBucketOwnershipControls:

Example

Use a bare-bones client and the command you need to make an API call.

import { S3Client, PutBucketOwnershipControlsCommand } from "@aws-sdk/client-s3"; // ES Modules import
// const { S3Client, PutBucketOwnershipControlsCommand } = require("@aws-sdk/client-s3"); // CommonJS import
const client = new S3Client(config);
const input = { // PutBucketOwnershipControlsRequest
Bucket: "STRING_VALUE", // required
ContentMD5: "STRING_VALUE",
ExpectedBucketOwner: "STRING_VALUE",
OwnershipControls: { // OwnershipControls
Rules: [ // OwnershipControlsRules // required
{ // OwnershipControlsRule
ObjectOwnership: "BucketOwnerPreferred" || "ObjectWriter" || "BucketOwnerEnforced", // required
},
],
},
};
const command = new PutBucketOwnershipControlsCommand(input);
const response = await client.send(command);
// {};

Param

PutBucketOwnershipControlsCommandInput

Returns

PutBucketOwnershipControlsCommandOutput

See

Throws

S3ServiceException

Base exception class for all service exceptions from S3 service.

Hierarchy

Constructors

Properties

Methods