Bucket
The Bucket resource lets you manage AWS Lightsail Buckets for object storage in the cloud.
Minimal Example
Section titled “Minimal Example”Create a basic Lightsail bucket with the required properties.
import AWS from "alchemy/aws/control";
const myBucket = await AWS.Lightsail.Bucket("my-first-bucket", { BundleId: "small_1", BucketName: "my-unique-bucket-name", ObjectVersioning: true});
Advanced Configuration
Section titled “Advanced Configuration”Configure a Lightsail bucket with access rules and tags.
const advancedBucket = await AWS.Lightsail.Bucket("advanced-bucket", { BundleId: "medium_2", BucketName: "my-advanced-bucket", ObjectVersioning: false, AccessRules: { AllowPublicRead: true, AllowPublicWrite: false }, Tags: [ { Key: "Environment", Value: "Production" }, { Key: "Project", Value: "Website" } ]});
Read-Only Access for Specific Accounts
Section titled “Read-Only Access for Specific Accounts”Set up a bucket that allows read-only access for specific AWS accounts.
const readOnlyBucket = await AWS.Lightsail.Bucket("read-only-bucket", { BundleId: "micro_1", BucketName: "my-read-only-bucket", ReadOnlyAccessAccounts: ["123456789012", "987654321098"], ResourcesReceivingAccess: ["resource-1", "resource-2"]});
Tagging for Cost Management
Section titled “Tagging for Cost Management”Create a bucket with tags for better cost management.
const taggedBucket = await AWS.Lightsail.Bucket("tagged-bucket", { BundleId: "large_3", BucketName: "my-tagged-bucket", Tags: [ { Key: "Department", Value: "Finance" }, { Key: "CostCenter", Value: "12345" } ]});