-
Notifications
You must be signed in to change notification settings - Fork 7
feat: static s3 website construct proposal #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: static s3 website construct proposal #19
Conversation
flaviostutz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me the component interface is nice. What do you think @erik-am @sergioflores-j?
docs/static-s3-website.md
Outdated
| @@ -0,0 +1,78 @@ | |||
| ## Construct StaticS3Website | |||
|
|
|||
| This construct creates an S3 bucket and upload any content into it. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Todo: change to "This construct creates a S3 bucket and uploads the contents of a local folder to it"
docs/static-s3-website.md
Outdated
| - [AWS S3 Bucket lib](https://github.com/aws/aws-cdk/tree/main/packages/aws-cdk-lib/aws-s3) | ||
| - [AWS S3 Bucket deployment lib](https://github.com/aws/aws-cdk/tree/main/packages/aws-cdk-lib/aws-s3-deployment) | ||
|
|
||
| Why to use it over the CDK constructs? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
discussion: I would remove this paragraph as there isn't another construct with a similar behavior, so this is not "better", it's simply a new composition.
| deployments: [ | ||
| { | ||
| sources: [Source.asset('./dist', { exclude: ['*.html'] })], | ||
| cacheControl: [CacheControl.fromString('public,max-age=31536000,immutable')], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: this will make the GET of the files on S3 to have response header "cache-control" set? If so, pls add this comment to the example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will add the cache control metadata to the objects that will be uploaded by the sources selection.
In short, yes, it will add the cache-control headers to the files
|
|
||
| // Attaches the policy to the deployment bucket | ||
| staticWebsite.bucket.addToResourcePolicy(ipLimitPolicy) | ||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Praise: The "complex" example is very nice!
| ```ts | ||
| // This will create the bucket `my-website-bucket` and upload the files in your local `dist` folder into it | ||
| new StaticS3Website(stack, 'my-website', { | ||
| bucketName: 'my-website-bucket', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do the bucket name defaults to the id of the construct or it's a required prop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather have it as a required prop, so it be more explicit when building/reading the construct.
But having it as default is indeed an option.
Summary
Proposal usage for #17