Sam Hulick
12/06/2021, 10:15 PMBucket
class from an IBucket
? e.g. I want to use s3.Bucket.fromBucketName()
and pass that to an SST function’s permissionsSahan Amadoruge
12/07/2021, 4:52 AMconst s3Bucket = new S3Bucket(app, "Bucket", {
dbEnvs: database.dbEnvs,
});
const apiStack = new ApiStack(app, "Api", {
...connProps,
auth: authStack.auth,
bucketName: s3Bucket.fileBucket.bucketName,
});
Sahan Amadoruge
12/07/2021, 4:55 AMexport default class S3Bucket extends sst.Stack {
readonly fileBucket: s3.Bucket;
constructor(scope: <http://sst.App|sst.App>, id: string, props: BucketProps) {
super(scope, id, props);
const bucket = new sst.Bucket(this, "Buckets");
this.fileBucket = bucket.s3Bucket;
// Show the endpoint in the output
this.addOutputs({
BucketName: this.fileBucket.bucketName,
});
}
}
Frank
IBucket
to the attachPermissions()
methodFrank
Sahan Amadoruge
12/07/2021, 5:41 AMFrank
Frank
Sam Hulick
12/07/2021, 7:57 PM