Skip to content

API Gateway triggered Lambda generated from horothesun/api-gateway-lambda-template.g8.

License

Notifications You must be signed in to change notification settings

horothesun/demo-api-gateway-lambda

Repository files navigation

Demo API Gateway triggered Lambda

CI ECR cleanup Manual API call Renovate enabled Mergify enabled Scala CE3

Based on API Gateway's

  • HTTP API (not REST API) and
  • payload format version 2.0.

The Lambda function has less than 30 seconds to complete because of the HTTP API's maximum integration timeout on synchronous requests.

CI

Secrets

  • AWS_ACCOUNT_ID
  • AWS_REGION
  • ECR_REPO_NAME
  • LAMBDA_NAME
  • PROD_CI_ROLE_ARN

ECR cleanup

Delete all untagged ECR images except the most recent one.

Secrets

  • AWS_REGION
  • ECR_REPO_NAME
  • PROD_CI_ROLE_ARN

Manual API call

Secrets

  • PROD_BASE_URL

Docker

Build an image with

docker build --tag "<REPOSITORY:TAG>" \
  --build-arg "JAVA_VERSION=..." \
  --build-arg "SBT_VERSION=..." \
  --file "./Dockerfile" "."

(default JAVA_VERSION and SBT_VERSION values in Dockerfile).

Run the image with

docker run --rm --publish "9000:8080" "<REPOSITORY:TAG>"

and test it with

curl --silent \
  --request "POST" "http://localhost:9000/2015-03-31/functions/function/invocations" \
  --data '{"body":"hello world!","isBase64Encoded":false}' | \
  jq --raw-output '.' | jq '.'

About

API Gateway triggered Lambda generated from horothesun/api-gateway-lambda-template.g8.

Resources

License

Stars

Watchers

Forks