Skip to content

Latest commit

 

History

History
44 lines (33 loc) · 2.54 KB

README.md

File metadata and controls

44 lines (33 loc) · 2.54 KB

Build Status

PostgreSQL AWS Lambda Layer

AWS Lambda Layer with PostgreSQL client with SSL built-in.

Description

AWS Lambda runtimes do not include the PostgreSQL client library, libpq, and creates a challenge when a Lambda function requires a connection to a PostgreSQL database. DrLuke solves the problem to a good degree with his instructions on how to build a libpq Lambda Layer (which I found via Maciej Winnicki's awesome-layers list). This repo productionizes DrLuke's work by:

  1. Creating a set of AWS Lambda Layers with libpq (currently from PostgreSQL 11.5) in all regions that support Lambda; and
  2. Adds SSL support to libpq so that one can connect with an encrypted connection;
  3. Provide clear provenance for the layer by completely building and publishing them via Travis CI.

Usage

The following are the ARNs of the latest layer on AWS that you can add to your Lambda functions.

arn:aws:lambda:ap-northeast-1:032012114076:layer:postgresql-libpq-ssl:1
arn:aws:lambda:ap-northeast-2:032012114076:layer:postgresql-libpq-ssl:1
arn:aws:lambda:ap-south-1:032012114076:layer:postgresql-libpq-ssl:1
arn:aws:lambda:ap-southeast-1:032012114076:layer:postgresql-libpq-ssl:1
arn:aws:lambda:ap-southeast-2:032012114076:layer:postgresql-libpq-ssl:1
arn:aws:lambda:ca-central-1:032012114076:layer:postgresql-libpq-ssl:1
arn:aws:lambda:eu-central-1:032012114076:layer:postgresql-libpq-ssl:1
arn:aws:lambda:eu-north-1:032012114076:layer:postgresql-libpq-ssl:1
arn:aws:lambda:eu-west-1:032012114076:layer:postgresql-libpq-ssl:1
arn:aws:lambda:eu-west-2:032012114076:layer:postgresql-libpq-ssl:1
arn:aws:lambda:eu-west-3:032012114076:layer:postgresql-libpq-ssl:1
arn:aws:lambda:sa-east-1:032012114076:layer:postgresql-libpq-ssl:1
arn:aws:lambda:us-east-1:032012114076:layer:postgresql-libpq-ssl:1
arn:aws:lambda:us-east-2:032012114076:layer:postgresql-libpq-ssl:1
arn:aws:lambda:us-west-1:032012114076:layer:postgresql-libpq-ssl:1
arn:aws:lambda:us-west-2:032012114076:layer:postgresql-libpq-ssl:1

References

  1. https://github.com/DrLuke/postgres-libpq-aws-lambda-layer
  2. https://github.com/jetbridge/psycopg2-lambda-layer
  3. https://github.com/jkehler/awslambda-psycopg2
  4. https://github.com/lambci/docker-lambda