Skip to content

Instantly share code, notes, and snippets.

@Tranquility2
Last active November 23, 2023 14:07
Show Gist options
  • Save Tranquility2/b6013ad323bcb6ef8f6781a7f7e9a307 to your computer and use it in GitHub Desktop.
Save Tranquility2/b6013ad323bcb6ef8f6781a7f7e9a307 to your computer and use it in GitHub Desktop.
Run and test aws container based lambdas
#!/bin/sh
BASE_IMAGE_NAME="new_lambda"
CONTAINER_NAME="${BASE_IMAGE_NAME}_container"
IMAGE_WITH_TAG="${BASE_IMAGE_NAME}:test"
docker build . -t ${IMAGE_WITH_TAG}
docker run -d -p 9000:8080 --name ${CONTAINER_NAME} ${IMAGE_WITH_TAG}
result=$(curl "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{}')
jq . <<< "$result"
docker stop ${CONTAINER_NAME}
docker rm ${CONTAINER_NAME}
docker rmi ${IMAGE_WITH_TAG}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment