Router and bucket
Creates a router that serves static files from the public folder of a given bucket.
// Create a bucket that CloudFront can accessconst bucket = new sst.aws.Bucket("MyBucket", { access: "cloudfront",});
// Upload the image to the `public` foldernew aws.s3.BucketObjectv2("MyImage", { bucket: bucket.name, key: "public/spongebob.svg", contentType: "image/svg+xml", source: $asset("spongebob.svg"),});
const router = new sst.aws.Router("MyRouter", { routes: { "/*": { bucket, rewrite: { regex: "^/(.*)$", to: "/public/$1" }, }, },});View the full example.