---
title: "Bucket | Grafana k6 documentation"
description: "Bucket is returned by the S3Client.* methods who query S3 buckets."
---

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

# Bucket

Bucket is returned by the S3Client.* methods that query S3 buckets. Namely, `listBuckets()` returns an array of Bucket objects. The Bucket object describes an Amazon S3 bucket.

Expand table

| Name                  | Type   | Description                  |
|-----------------------|--------|------------------------------|
| `Bucket.name`         | string | The S3 bucket’s name         |
| `Bucket.creationDate` | Date   | The S3 bucket’s creationDate |

### Example

JavaScript ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```javascript
import {
  AWSConfig,
  S3Client,
} from 'https://jslib.k6.io/aws/0.14.0/s3.js';

const awsConfig = new AWSConfig({
  region: __ENV.AWS_REGION,
  accessKeyId: __ENV.AWS_ACCESS_KEY_ID,
  secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY,
});

const s3 = new S3Client(awsConfig);

export default async function () {
  // List the buckets the AWS authentication configuration
  // gives us access to.
  const buckets = await s3.listBuckets();
  console.log(JSON.stringify(buckets));
}
```

*A k6 script that will query the user’s S3 buckets and print all of their metadata*
