- with JWT/OAuth2 authorizer
- serverless
- docker
- docker-compose
- aws cli
aws ecr create-repository --repository-name kite-api --region eu-central-1
aws ecr get-login-password --region eu-central-1 | docker login --username AWS --password-stdin <ecr_url>
docker-compose up --build --detach
docker push <image>
IMAGE_FULL="<image_name>"; HASH=$(docker push $IMAGE_FULL | awk '/digest: / {print $3}'); IMAGE=$(echo "$IMAGE_FULL" | cut -d':' -f 1); sed -i "s|image.*|image: $IMAGE@$HASH|g" functions.yml
serverless deploy --stage prod
curl https://*.amazonaws.com/spots/1000
Output:
{"message":"Unauthorized"}
curl -H "Authorization: Bearer <your_oauth_token>" https://*.amazonaws.com/spots/1000
Output:
{"alternative_name":"","longitude":"-9.1796","id":1006,"name":"Lagoa de Albufeira","country":"Portugal","latitude":"38.5088"}