This repo is a mashup of the titiler-pgstac and the titiler-lambda-layer repos. The intention is to deploy an instance of titiler-pgstac as a lambda function similar to the methods Development Seed uses in its AWS Serverless Application (SAM)
To get started with this repo, clone the repository and create a Python environment.
# clone the repo
git clone https://github.com/ianhorn/serverless-titiler-pgstac.git
cd serverless-titiler-pgstac
# Create a python environment
python -m venv venv
python -m pip install -r requirements_local.txt
# activate environment
source venv/bin/activteI tried building a docker-compose.yml file that would build the lambda layer and store it locally. But this build script will work too.
./build.shYou should now have a package.zip file. Deploy that to AWS as a Lambda Layer
# deploy lambda layer
./titiler-pgstac-lambda-layer/scripts/deploy.pyOptional - list your layers
# run list script
./titiler-pgstac-lambda-layer/list.py | jqYou should get a response like this.
[
{
"region": "us-west-2",
"layers": [
{
"name": "titiler-pgstac",
"arn": "arn:aws:lambda:<region}:<account>:layer:titiler-pgstac:<version>",
"version": <version>
}
]
}
]In the same region you created the Lambda layer, use the AWS Console to navigate to CloudFormation.
- Create a stack - with new resources
- Specify the template
- provide a url to a template saved in a bucket or upload the sam.yml file.
- Give your stack a name
- Update the parameters for your pgstac instance*
- Add any tags or other optional items
- Check the acknowledgement boxes
- Review the stack and hit submit.
*Be sure to update any other variable settings. You'll need to enable stac and mosaic if you want to use those, obviously.