-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Bucket deployments #936
Comments
|
@rix0rrr added |
In our copier - we have historically supported 2 modes In subfolder mode, each new copy job was a new S3 prefix (subfolder), and we used that ensure you'd only get the assets from the current copy. (without having to delete/cleanup) We made these modes because often, if you're serving a static website for example, you may not want to actually clean your old assets, and still allow them to be served. Most SPA frameworks do like We exposed these to the customer, to let them figure out what the right thing is for their usecase. |
@mindstorms6 how did you determine the prefix for the SUBFOLDER mode? Did you return the actual key as an attribute so it could then be used e.g. to tell CloudFront where to serve the new content? |
Exactly that - in subfolder mode, we'd either generate (or in some internal use cases, re-use) a UUID that was then returned as 'OriginPath' from the resource - then we'd update the CloudFront origin. |
There are use cases where it would be useful to be able to populate an S3 bucket with contents as part of a stack deployment. The most notable example is deploying the contents of a bucket for a static website.
The low-level building block to enable such use cases is a
BucketDeployment
construct which allows deploying a bucket from a .zip file stored in another bucket. Then, we could use aZipDirectoryAsset
to create the zip file in the assets bucket.The nice thing about this approach is that if the contents of the local directory changes, a new asset will be uploaded with a new S3 key, so the bucket deployment resource will be updated.
This construct will install a custom resource which will, upon create/update:
website.zip
from the source bucket.Upon delete:
Requirements
The text was updated successfully, but these errors were encountered: