server-side-website with additional S3 Origin behaviour#325
server-side-website with additional S3 Origin behaviour#325aran112000 wants to merge 12 commits intogetlift:masterfrom
Conversation
mnapoli
left a comment
There was a problem hiding this comment.
Awesome, that looks like a great idea that will benefit many! (the "/uploads/" example is very common)
I added some suggestions inline. Could you also add some tests? This is a large feature so we want to make sure it is covered.
|
Hi, just bumping here regarding my last comment: I think the only thing missing here for a merge are tests? Especially since you discovered plenty of edge cases, maintaining this feature sounds like it will be quite some effort, so the tests will help minimize the effort 😅 |
Sure thing, @robchett just added these now :) |
|
@mnapoli Just wondering if there is a plan in mind for the next release and will it include this PR? If there's anything we can help with, let us know. Thanks. |
|
Hey @fredericbarthelet, @mnapoli Any chance this could be reviewed / merged if you're happy with the change & tests added here please? |
Co-authored-by: Matthieu Napoli <matthieu@mnapoli.fr>
the same bucket twice to different paths
14993f6 to
fba77bd
Compare
|
Hope that this will be finally merged. |
|
Aran Reeks (@aran112000) while It is not being approved, how can we use this? will uploaded files to the bucket be removed on the next deployment? |
Feel free to use my fork of Lift, we use this on production on a number of sites successfully. It doesn't clear any assets from other buckets on deployment. They're just added as origins to your Cloudfront distributions. @mnapoli - is it possible to complete the review and get this merged, please? |
|
This is just what I need! 🚀 I was adding an additional Origin+Behavior to the distribution manually. Any updates on this? We'll really love this to be merged. |
can you share any of your serverless.yml as an example? I am looking for best example for my laravel application. |
Hey @vikivyas, here is mine from a currently live production application: serverless.yml I have two buckets, one is created for the frontend assets, and another is private for customer's uploads. There are some uploads that should be able to be publicly accessible (like profile pics, personalized banners, etc), those files are uploaded to a folder called constructs:
assets:
type: server-side-website
domain: ${param:domain}
certificate: ${param:certificateArn}
assets:
'/build/*': public/build
'/robots.txt': public/robots.txt
'/c/*': 's3://${param:UUID}-${aws:region}-storage'
extensions:
bucket:
Properties:
BucketName: '${param:UUID}-${aws:region}-assets'
storage:
type: storage
extensions:
bucket:
DeletionPolicy: Retain
Properties:
BucketName: '${param:UUID}-${aws:region}-storage'
AccessControl: PrivateLet me know if it helps you |
This adds support to create additional CloudFront Origins & Behaviours so you can map additional paths to alternative, existing S3 buckets.
Includes updated documentation to show how this can be used.