Skip to content

Instantly share code, notes, and snippets.

@mgjam
Created October 22, 2019 11:07
Show Gist options
  • Save mgjam/27b7459680ea47dbb255efd477ec1b4c to your computer and use it in GitHub Desktop.
Save mgjam/27b7459680ea47dbb255efd477ec1b4c to your computer and use it in GitHub Desktop.
private static createS3Bucket(scope: cdk.Construct, user: iam.User): s3.Bucket {
const name = 'bucket';
const bucket = new s3.Bucket(scope, name, {
bucketName: name,
accessControl: s3.BucketAccessControl.PUBLIC_READ,
cors: [{
allowedOrigins: [ '*' ],
allowedMethods: [ s3.HttpMethods.GET ],
allowedHeaders: [ '*' ]
}]
});
bucket.grantWrite(user);
return bucket;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment