Files
pygeoapi/aws-lambda
Francesco Bartoli 72b9a647ff GDAL3 support (#359)
* Bump gdal to v3

* Fix query duplicates with bbox for PG

* Add backward compatibility for axis order

* Move travis to bionic dist


Fix gdal version 3 on travis by pinning latest ubuntu unstable release


Fix ubuntugis sources on travis


Remove pinned python gdal version


Add mongodb start


Enable mongod service


Fix package name


Install mongo from official community repos


Add mongo enable and start commands

* Fix wrong axis mapping strategy


Add author

* Move base image to bullseye for docker build

* Fix remaining unchanged places for #364

* Make image size smaller

* Add docker build and cite tests


Fix python version


Move steps after docker build elsewhere


Fix uppercase characters


Fix internal port


Daemonize the run process

* Check logs and run test command from the entrypoint

* Remove the execution of mongo tests for test command

Remove the execution of mongo tests for test command

Fix failed command

* Add delay and move build to install step

Remove grep command for now


Use single quote
2020-03-03 23:03:14 +01:00
..

Using pygeoapi on AWS Lambda Serverless

Overview

AWS Lambda Serverless is a service from Amazon that enables publishing code which is executed as on demand functions. The value is here is that the server is only working when requests are made, resulting in more efficient use of server resources as well as managing costs.

pygeoapi provides a couple of ways to publish to AWS Lambda depending on your environment: zappa and node/serverless.

zappa

zappa provides Python tooling to interact with AWS lambda. Ensure the environment variables AWS_ACCESS_KEY and AWS_SECRET_ACCESS_KEY are set and available.

# install zappa
pip install zappa

# set environment variables
export AWS_ACCESS_KEY_ID=foo
export AWS_SECRET_ACCESS_KEY=bar

# deploy pygeoapi to AWS Lambda
zappa deploy -s zappa_settings.json

# update
zappa update -s zappa_settings.json

# undeploy
zappa undeploy -s zappa_settings.json

node/serverless

The included serverless.yml and pygeoapi-serverless-config.yml can be used to deploy pygeoapi on AWS Lambda Serverless Environment.

This requires Amazon Credentials and the Serverless deployment tool.

AWS Credentials can be created following the instructions at https://serverless.com/framework/docs/providers/aws/guide/credentials/

To install the Serverless environment

npm install serverless

The following serverless plugins are also used

serverless plugin install -n serverless-python-requirements
serverless plugin install -n serverless-wsgi

To deploy to AWS Lambda:

serverless deploy

Once deployed, if you only need to update the code and not anything in the serverless configuration, you can update the function using:

serverless deploy --function app

When deployed, the output will show the URL the app has been deployed to.