A Lambda@Edge function to be used with AWS Cloudfront to serve the index.html file of a subdirectory in an S3 bucket.
This service is inspired by this guide from AWS.
TODO explain the use of each function
sls deploy --stage prod
- Go to Lamda in AWS Console, select the latest version for both functions.
- Create trigger for Cloudfront and select to deploy to
Lambda@Edge
. - If you created this trigger before, you can just select to use existing trigger.
- Change the
Cache behavior
according to your needs. These are the behaviours setup in Cloudfront. - Select
Origin request
for theCloudfront event
option. - Click
Deploy
and wait for the changes to propagate to all of the Cloudfront distribution. - You may need to invalidate your caches in Cloudfront.
- The logs will be appear in an edge location near your location. Be sure to change the region if the you do not see the logs in your current selcted region in the AWS console.