-
Notifications
You must be signed in to change notification settings - Fork 192
Expand file tree
/
Copy pathS3Stack.js
More file actions
29 lines (25 loc) · 754 Bytes
/
S3Stack.js
File metadata and controls
29 lines (25 loc) · 754 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import * as cdk from "@aws-cdk/core";
import * as s3 from "@aws-cdk/aws-s3";
import * as sst from "@serverless-stack/resources";
export default class S3Stack extends sst.Stack {
// Public reference to the S3 bucket
bucket;
constructor(scope, id, props) {
super(scope, id, props);
this.bucket = new s3.Bucket(this, "Uploads", {
// Allow client side access to the bucket from a different domain
cors: [
{
maxAge: 3000,
allowedOrigins: ["*"],
allowedHeaders: ["*"],
allowedMethods: ["GET", "PUT", "POST", "DELETE", "HEAD"],
},
],
});
// Export values
new cdk.CfnOutput(this, "AttachmentsBucketName", {
value: this.bucket.bucketName,
});
}
}