or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

access-control-security.mdbucket-configuration.mdbucket-operations.mdclient-configuration.mdindex.mdlisting-pagination.mdmultipart-upload.mdobject-operations.mdwaiters-utilities.md
tile.json

bucket-configuration.mddocs/

Bucket Configuration

Advanced bucket features including versioning, lifecycle management, encryption, CORS, website hosting, and notification settings for comprehensive S3 bucket management.

Capabilities

Versioning Configuration

Enable and manage object versioning for buckets.

/**
 * Get bucket versioning configuration
 */
class GetBucketVersioningCommand {
  constructor(input: GetBucketVersioningCommandInput);
}

interface GetBucketVersioningCommandInput {
  /** Bucket name */
  Bucket: string;
  
  /** Expected bucket owner account ID */
  ExpectedBucketOwner?: string;
}

interface GetBucketVersioningCommandOutput {
  /** Versioning status */
  Status?: BucketVersioningStatus;
  
  /** MFA delete status */
  MfaDelete?: MfaDeleteStatus;
}

/**
 * Set bucket versioning configuration
 */
class PutBucketVersioningCommand {
  constructor(input: PutBucketVersioningCommandInput);
}

interface PutBucketVersioningCommandInput {
  /** Bucket name */
  Bucket: string;
  
  /** Versioning configuration */
  VersioningConfiguration: VersioningConfiguration;
  
  /** MFA token for MFA delete */
  MFA?: string;
  
  /** Checksum algorithm */
  ChecksumAlgorithm?: ChecksumAlgorithm;
  
  /** Expected bucket owner account ID */
  ExpectedBucketOwner?: string;
}

interface VersioningConfiguration {
  /** MFA delete setting */
  MfaDelete?: MfaDelete;
  
  /** Versioning status */
  Status?: BucketVersioningStatus;
}

Usage Example:

import { S3Client, PutBucketVersioningCommand } from "@aws-sdk/client-s3";

const client = new S3Client({ region: "us-east-1" });

// Enable versioning
const enableVersioning = new PutBucketVersioningCommand({
  Bucket: "versioned-bucket",
  VersioningConfiguration: {
    Status: "Enabled"
  }
});
await client.send(enableVersioning);

Lifecycle Configuration

Manage object lifecycle rules for automatic transitions and deletion.

/**
 * Get bucket lifecycle configuration
 */
class GetBucketLifecycleConfigurationCommand {
  constructor(input: GetBucketLifecycleConfigurationCommandInput);
}

interface GetBucketLifecycleConfigurationCommandInput {
  /** Bucket name */
  Bucket: string;
  
  /** Expected bucket owner account ID */
  ExpectedBucketOwner?: string;
}

interface GetBucketLifecycleConfigurationCommandOutput {
  /** Lifecycle rules */
  Rules?: LifecycleRule[];
}

/**
 * Set bucket lifecycle configuration
 */
class PutBucketLifecycleConfigurationCommand {
  constructor(input: PutBucketLifecycleConfigurationCommandInput);
}

interface PutBucketLifecycleConfigurationCommandInput {
  /** Bucket name */
  Bucket: string;
  
  /** Lifecycle configuration */
  LifecycleConfiguration?: BucketLifecycleConfiguration;
  
  /** Checksum algorithm */
  ChecksumAlgorithm?: ChecksumAlgorithm;
  
  /** Expected bucket owner account ID */
  ExpectedBucketOwner?: string;
}

interface BucketLifecycleConfiguration {
  /** List of lifecycle rules */
  Rules: LifecycleRule[];
}

interface LifecycleRule {
  /** Rule expiration settings */
  Expiration?: LifecycleExpiration;
  
  /** Rule ID */
  ID?: string;
  
  /** Object key prefix filter */
  Prefix?: string;
  
  /** Rule filter */
  Filter?: LifecycleRuleFilter;
  
  /** Rule status */
  Status: ExpirationStatus;
  
  /** Storage class transitions */
  Transitions?: Transition[];
  
  /** Non-current version expiration */
  NoncurrentVersionExpiration?: NoncurrentVersionExpiration;
  
  /** Non-current version transitions */
  NoncurrentVersionTransitions?: NoncurrentVersionTransition[];
  
  /** Abort incomplete multipart uploads */
  AbortIncompleteMultipartUpload?: AbortIncompleteMultipartUpload;
}

interface LifecycleExpiration {
  /** Expiration date */
  Date?: Date;
  
  /** Days after object creation */
  Days?: number;
  
  /** Delete expired object delete markers */
  ExpiredObjectDeleteMarker?: boolean;
}

interface Transition {
  /** Transition date */
  Date?: Date;
  
  /** Days after creation */
  Days?: number;
  
  /** Target storage class */
  StorageClass?: TransitionStorageClass;
}

Usage Example:

import { S3Client, PutBucketLifecycleConfigurationCommand } from "@aws-sdk/client-s3";

const client = new S3Client({ region: "us-east-1" });

// Set lifecycle rules
const lifecycleConfig = new PutBucketLifecycleConfigurationCommand({
  Bucket: "my-bucket",
  LifecycleConfiguration: {
    Rules: [
      {
        ID: "ArchiveOldObjects",
        Status: "Enabled",
        Filter: {
          Prefix: "logs/"
        },
        Transitions: [
          {
            Days: 30,
            StorageClass: "STANDARD_IA"
          },
          {
            Days: 90,
            StorageClass: "GLACIER"
          }
        ],
        Expiration: {
          Days: 365
        }
      }
    ]
  }
});
await client.send(lifecycleConfig);

Encryption Configuration

Configure default server-side encryption for bucket objects.

/**
 * Get bucket encryption configuration
 */
class GetBucketEncryptionCommand {
  constructor(input: GetBucketEncryptionCommandInput);
}

interface GetBucketEncryptionCommandInput {
  /** Bucket name */
  Bucket: string;
  
  /** Expected bucket owner account ID */
  ExpectedBucketOwner?: string;
}

interface GetBucketEncryptionCommandOutput {
  /** Server-side encryption configuration */
  ServerSideEncryptionConfiguration?: ServerSideEncryptionConfiguration;
}

/**
 * Set bucket encryption configuration
 */
class PutBucketEncryptionCommand {
  constructor(input: PutBucketEncryptionCommandInput);
}

interface PutBucketEncryptionCommandInput {
  /** Bucket name */
  Bucket: string;
  
  /** Server-side encryption configuration */
  ServerSideEncryptionConfiguration: ServerSideEncryptionConfiguration;
  
  /** Content MD5 */
  ContentMD5?: string;
  
  /** Checksum algorithm */
  ChecksumAlgorithm?: ChecksumAlgorithm;
  
  /** Expected bucket owner account ID */
  ExpectedBucketOwner?: string;
}

interface ServerSideEncryptionConfiguration {
  /** List of encryption rules */
  Rules: ServerSideEncryptionRule[];
}

interface ServerSideEncryptionRule {
  /** Default encryption settings */
  ApplyServerSideEncryptionByDefault?: ServerSideEncryptionByDefault;
  
  /** Bucket key enabled */
  BucketKeyEnabled?: boolean;
}

interface ServerSideEncryptionByDefault {
  /** Encryption algorithm */
  SSEAlgorithm: ServerSideEncryption;
  
  /** KMS key ID */
  KMSMasterKeyID?: string;
}

Usage Example:

import { S3Client, PutBucketEncryptionCommand } from "@aws-sdk/client-s3";

const client = new S3Client({ region: "us-east-1" });

// Enable KMS encryption by default
const encryptionConfig = new PutBucketEncryptionCommand({
  Bucket: "encrypted-bucket",
  ServerSideEncryptionConfiguration: {
    Rules: [
      {
        ApplyServerSideEncryptionByDefault: {
          SSEAlgorithm: "aws:kms",
          KMSMasterKeyID: "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012"
        },
        BucketKeyEnabled: true
      }
    ]
  }
});
await client.send(encryptionConfig);

CORS Configuration

Configure Cross-Origin Resource Sharing (CORS) rules for browser access.

/**
 * Get bucket CORS configuration
 */
class GetBucketCorsCommand {
  constructor(input: GetBucketCorsCommandInput);
}

interface GetBucketCorsCommandInput {
  /** Bucket name */
  Bucket: string;
  
  /** Expected bucket owner account ID */
  ExpectedBucketOwner?: string;
}

interface GetBucketCorsCommandOutput {
  /** CORS rules */
  CORSRules?: CORSRule[];
}

/**
 * Set bucket CORS configuration
 */
class PutBucketCorsCommand {
  constructor(input: PutBucketCorsCommandInput);
}

interface PutBucketCorsCommandInput {
  /** Bucket name */
  Bucket: string;
  
  /** CORS configuration */
  CORSConfiguration: CORSConfiguration;
  
  /** Content MD5 */
  ContentMD5?: string;
  
  /** Checksum algorithm */
  ChecksumAlgorithm?: ChecksumAlgorithm;
  
  /** Expected bucket owner account ID */
  ExpectedBucketOwner?: string;
}

interface CORSConfiguration {
  /** List of CORS rules */
  CORSRules: CORSRule[];
}

interface CORSRule {
  /** Rule ID */
  ID?: string;
  
  /** Allowed HTTP headers */
  AllowedHeaders?: string[];
  
  /** Allowed HTTP methods */
  AllowedMethods: string[];
  
  /** Allowed origins */
  AllowedOrigins: string[];
  
  /** Headers exposed to browser */
  ExposeHeaders?: string[];
  
  /** Preflight cache duration */
  MaxAgeSeconds?: number;
}

Usage Example:

import { S3Client, PutBucketCorsCommand } from "@aws-sdk/client-s3";

const client = new S3Client({ region: "us-east-1" });

// Configure CORS for web access
const corsConfig = new PutBucketCorsCommand({
  Bucket: "web-assets-bucket",
  CORSConfiguration: {
    CORSRules: [
      {
        ID: "AllowWebAccess",
        AllowedHeaders: ["*"],
        AllowedMethods: ["GET", "PUT", "POST", "DELETE"],
        AllowedOrigins: ["https://mywebsite.com", "https://www.mywebsite.com"],
        ExposeHeaders: ["ETag"],
        MaxAgeSeconds: 3600
      }
    ]
  }
});
await client.send(corsConfig);

Website Configuration

Configure bucket for static website hosting.

/**
 * Get bucket website configuration
 */
class GetBucketWebsiteCommand {
  constructor(input: GetBucketWebsiteCommandInput);
}

interface GetBucketWebsiteCommandInput {
  /** Bucket name */
  Bucket: string;
  
  /** Expected bucket owner account ID */
  ExpectedBucketOwner?: string;
}

interface GetBucketWebsiteCommandOutput {
  /** Redirect all requests settings */
  RedirectAllRequestsTo?: RedirectAllRequestsTo;
  
  /** Index document settings */
  IndexDocument?: IndexDocument;
  
  /** Error document settings */
  ErrorDocument?: ErrorDocument;
  
  /** Routing rules */
  RoutingRules?: RoutingRule[];
}

/**
 * Set bucket website configuration
 */
class PutBucketWebsiteCommand {
  constructor(input: PutBucketWebsiteCommandInput);
}

interface PutBucketWebsiteCommandInput {
  /** Bucket name */
  Bucket: string;
  
  /** Website configuration */
  WebsiteConfiguration: WebsiteConfiguration;
  
  /** Content MD5 */
  ContentMD5?: string;
  
  /** Checksum algorithm */
  ChecksumAlgorithm?: ChecksumAlgorithm;
  
  /** Expected bucket owner account ID */
  ExpectedBucketOwner?: string;
}

interface WebsiteConfiguration {
  /** Error document */
  ErrorDocument?: ErrorDocument;
  
  /** Index document */
  IndexDocument?: IndexDocument;
  
  /** Redirect all requests */
  RedirectAllRequestsTo?: RedirectAllRequestsTo;
  
  /** Routing rules */
  RoutingRules?: RoutingRule[];
}

interface IndexDocument {
  /** Suffix for index document */
  Suffix: string;
}

interface ErrorDocument {
  /** Error document key */
  Key: string;
}

Usage Example:

import { S3Client, PutBucketWebsiteCommand } from "@aws-sdk/client-s3";

const client = new S3Client({ region: "us-east-1" });

// Configure static website hosting
const websiteConfig = new PutBucketWebsiteCommand({
  Bucket: "my-website-bucket",
  WebsiteConfiguration: {
    IndexDocument: {
      Suffix: "index.html"
    },
    ErrorDocument: {
      Key: "error.html"
    }
  }
});
await client.send(websiteConfig);

Notification Configuration

Configure event notifications for bucket operations.

/**
 * Get bucket notification configuration
 */
class GetBucketNotificationConfigurationCommand {
  constructor(input: GetBucketNotificationConfigurationCommandInput);
}

interface GetBucketNotificationConfigurationCommandInput {
  /** Bucket name */
  Bucket: string;
  
  /** Expected bucket owner account ID */
  ExpectedBucketOwner?: string;
}

interface GetBucketNotificationConfigurationCommandOutput {
  /** Topic configurations */
  TopicConfigurations?: TopicConfiguration[];
  
  /** Queue configurations */
  QueueConfigurations?: QueueConfiguration[];
  
  /** Lambda function configurations */
  LambdaConfigurations?: LambdaFunctionConfiguration[];
  
  /** EventBridge configuration */
  EventBridgeConfiguration?: EventBridgeConfiguration;
}

/**
 * Set bucket notification configuration
 */
class PutBucketNotificationConfigurationCommand {
  constructor(input: PutBucketNotificationConfigurationCommandInput);
}

interface PutBucketNotificationConfigurationCommandInput {
  /** Bucket name */
  Bucket: string;
  
  /** Notification configuration */
  NotificationConfiguration: NotificationConfiguration;
  
  /** Expected bucket owner account ID */
  ExpectedBucketOwner?: string;
  
  /** Skip destination validation */
  SkipDestinationValidation?: boolean;
}

interface NotificationConfiguration {
  /** Topic configurations */
  TopicConfigurations?: TopicConfiguration[];
  
  /** Queue configurations */
  QueueConfigurations?: QueueConfiguration[];
  
  /** Lambda function configurations */
  LambdaConfigurations?: LambdaFunctionConfiguration[];
  
  /** EventBridge configuration */
  EventBridgeConfiguration?: EventBridgeConfiguration;
}

interface LambdaFunctionConfiguration {
  /** Configuration ID */
  Id?: string;
  
  /** Lambda function ARN */
  LambdaFunctionArn: string;
  
  /** Events to trigger on */
  Events: Event[];
  
  /** Object key filter */
  Filter?: NotificationConfigurationFilter;
}

Usage Example:

import { S3Client, PutBucketNotificationConfigurationCommand } from "@aws-sdk/client-s3";

const client = new S3Client({ region: "us-east-1" });

// Configure Lambda notification for object creation
const notificationConfig = new PutBucketNotificationConfigurationCommand({
  Bucket: "monitored-bucket",
  NotificationConfiguration: {
    LambdaConfigurations: [
      {
        Id: "ProcessUploads",
        LambdaFunctionArn: "arn:aws:lambda:us-east-1:123456789012:function:ProcessS3Upload",
        Events: ["s3:ObjectCreated:*"],
        Filter: {
          Key: {
            FilterRules: [
              {
                Name: "prefix",
                Value: "uploads/"
              },
              {
                Name: "suffix", 
                Value: ".jpg"
              }
            ]
          }
        }
      }
    ]
  }
});
await client.send(notificationConfig);

Logging Configuration

Configure access logging for bucket requests.

/**
 * Get bucket logging configuration
 */
class GetBucketLoggingCommand {
  constructor(input: GetBucketLoggingCommandInput);
}

interface GetBucketLoggingCommandInput {
  /** Bucket name */
  Bucket: string;
  
  /** Expected bucket owner account ID */
  ExpectedBucketOwner?: string;
}

interface GetBucketLoggingCommandOutput {
  /** Logging enabled settings */
  LoggingEnabled?: LoggingEnabled;
}

/**
 * Set bucket logging configuration
 */
class PutBucketLoggingCommand {
  constructor(input: PutBucketLoggingCommandInput);
}

interface PutBucketLoggingCommandInput {
  /** Bucket name */
  Bucket: string;
  
  /** Bucket logging status */
  BucketLoggingStatus: BucketLoggingStatus;
  
  /** Content MD5 */
  ContentMD5?: string;
  
  /** Checksum algorithm */
  ChecksumAlgorithm?: ChecksumAlgorithm;
  
  /** Expected bucket owner account ID */
  ExpectedBucketOwner?: string;
}

interface BucketLoggingStatus {
  /** Logging enabled configuration */
  LoggingEnabled?: LoggingEnabled;
}

interface LoggingEnabled {
  /** Target bucket for logs */
  TargetBucket: string;
  
  /** Target prefix for log objects */
  TargetPrefix?: string;
  
  /** Target grants for log delivery */
  TargetGrants?: TargetGrant[];
  
  /** Target object key format */
  TargetObjectKeyFormat?: TargetObjectKeyFormat;
}

Common Types

// Versioning status
type BucketVersioningStatus = "Enabled" | "Suspended";
type MfaDeleteStatus = "Enabled" | "Disabled";
type MfaDelete = "Enabled" | "Disabled";

// Lifecycle rule status
type ExpirationStatus = "Enabled" | "Disabled";

// Storage classes for transitions
type TransitionStorageClass = 
  | "GLACIER"
  | "STANDARD_IA"
  | "ONEZONE_IA"
  | "INTELLIGENT_TIERING"
  | "DEEP_ARCHIVE"
  | "GLACIER_IR";

// Server-side encryption algorithms
type ServerSideEncryption = "AES256" | "aws:kms" | "aws:kms:dsse";

// S3 event types
type Event = 
  | "s3:ObjectCreated:*"
  | "s3:ObjectCreated:Put"
  | "s3:ObjectCreated:Post"
  | "s3:ObjectCreated:Copy"
  | "s3:ObjectCreated:CompleteMultipartUpload"
  | "s3:ObjectRemoved:*"
  | "s3:ObjectRemoved:Delete"
  | "s3:ObjectRemoved:DeleteMarkerCreated"
  | "s3:ObjectRestore:*"
  | "s3:ObjectRestore:Post"
  | "s3:ObjectRestore:Completed"
  | "s3:Replication:*"
  | "s3:Replication:OperationFailedReplication"
  | "s3:Replication:OperationNotTracked"
  | "s3:Replication:OperationMissedThreshold"
  | "s3:Replication:OperationReplicatedAfterThreshold";