import { S3 } from "https://deno.land/x/s3@0.5.0/src/client.ts";
A S3 instance can be used to manage multiple buckets.
const s3 = new S3({
accessKeyID: "<AWS_ACCESS_KEY_ID>",
secretKey: "<AWS_SECRET_ACCESS_KEY>",
region: "eu-south-1",
});
const bucket1: S3Bucket = s3.getBucket("my-bucket");
const bucket2: S3Bucket = await s3.createBucket("my-second-bucket");
Constructors
new
S3(config: S3Config)Methods
createBucket(bucket: string, options?: CreateBucketOptions): Promise<S3Bucket>
Creates a new S3 bucket. By default, the bucket is created in the region
specified with the S3 options. If not specified the US East (N. Virginia)
region is used. Optionally, you can specify a Region with the
locationConstraint
option.
const bucket: S3Bucket = await s3.createBucket("my-bucket", {
locationConstraint: "EU",
});