Jump to Content

This API Documentation is now deprecated

We are excited to announce our new API Documentation.

Class DeleteBucketCommandProtected

Deletes the S3 bucket. All objects (including all object versions and delete markers) in the bucket must be deleted before the bucket itself can be deleted.

The following operations are related to DeleteBucket:

Example

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

import { S3Client, DeleteBucketCommand } from "@aws-sdk/client-s3"; // ES Modules import
// const { S3Client, DeleteBucketCommand } = require("@aws-sdk/client-s3"); // CommonJS import
const client = new S3Client(config);
const input = { // DeleteBucketRequest
Bucket: "STRING_VALUE", // required
ExpectedBucketOwner: "STRING_VALUE",
};
const command = new DeleteBucketCommand(input);
const response = await client.send(command);
// {};

Param

DeleteBucketCommandInput

Returns

DeleteBucketCommandOutput

See

Throws

S3ServiceException

Base exception class for all service exceptions from S3 service.

Example

To delete a bucket

// The following example deletes the specified bucket.
const input = {
"Bucket": "forrandall2"
};
const command = new DeleteBucketCommand(input);
await client.send(command);
// example id: to-delete-a-bucket-1473108514262

Hierarchy

Constructors

Properties

Methods

Constructors

Properties

Methods