From fa97e982e48222d60d2af211092d73f75e31489f Mon Sep 17 00:00:00 2001 From: Brandon Liu Date: Mon, 18 Jul 2022 23:06:30 +0800 Subject: [PATCH] Update README.md --- serverless/aws/README.md | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/serverless/aws/README.md b/serverless/aws/README.md index 7f44c5e..b7fda6d 100644 --- a/serverless/aws/README.md +++ b/serverless/aws/README.md @@ -1,21 +1,23 @@ +# PMTiles on Lambda + +Generates a Lambda function for deploying PMTiles on Lambda behind Lambda Function URLs or API Gateway. (CloudFront is recommended as a cache in front.) ## How To Use -`python create_lambda_function.py MY_REGION MY_BUCKET_NAME` +```sh +git clone https://github.com/protomaps/PMTiles +cd serverless/aws +python create_lambda_function.py +``` Upload the resulting `lambda_function.zip` using the Lambda console. - -## Configuration +Configure these Lambda environment variables: * `BUCKET`: the S3 bucket name. -* `PMTILES_PATH` -* `TILE_PATH` - -## AWS Notes - -1. API Gateway (Event format v2.0) -2. Lambda Function URLs are not recommended. +* `PMTILES_PATH`: optional, define how a tileset name is translated into an S3 key. Default `{name}.pmtiles` + * Example path setting for objects in a directory: `my_folder/{name}/file.pmtiles` +* `TILE_PATH`: optional, define the URL route of the tiles API. Default `/{name}/{z}/{x}/{y}.pbf` ## Test Event @@ -34,4 +36,4 @@ API Gateway V2 / Lambda Function URLs: ### Lambda@Edge -Lambda@Edge's multi-region features have little benefit when fetching data from S3 in a single region, and Lambda@Edge [doesn't support](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/edge-functions-restrictions.html) environment variables or responses over 1 MB. For globally distributed caching, use CloudFront in combination with Lambda Function URLs. \ No newline at end of file +Lambda@Edge's multi-region features have little benefit when fetching data from S3 in a single region, and Lambda@Edge [doesn't support](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/edge-functions-restrictions.html) environment variables or responses over 1 MB. For globally distributed caching, use CloudFront in combination with Lambda Function URLs.