Open andreipopovici opened 8 years ago
This would be a very useful feature.
One thing to consider in the implementation is how to handle cache invalidation. Cloudfront offers 1000 individual invalidations per month free, and the cost could skyrocket for say, a static site with many pages.
However, changing the S3 origin path is free. Thus, uploading to a hashed folder name on S3 on each deploy, then changing the origin path to that folder is faster and cheaper.
Could use Lambda@Edge to dynamically define a versioned path for assets. http://docs.aws.amazon.com/lambda/latest/dg/lambda-edge.html
Hi there,
Back in the days of JAWS, there was an interesting plugin: https://github.com/boushley/awsm-cloudfront
Basically, it would set up a Cloudfront distribution with two origins, one for static client code on S3 and another with the serverless API Gateway endpoints (using a base-path, like
/api/
). It would then be trivial to redirect to the distribution URL via Route 53 or others.This might be a job for a separate plugin that has
serverless-client-s3
as a dependency and also sets up the serverless API part.I thought I'd bring it up here :)