A simple API Gateway Lambda authorizer written in Go.
To build the Lambda functions, you can run the Python script:
python3 scripts/build.pyTo deploy all the tofu resources, you can use the build command first, and then run the tofu apply command.
This step does require an S3 bucket as the tofu backend, so make sure to change the value in infrastructure/main.tf and manually create the bucket in your account.
python3 scripts/build.py
tofu -chdir=infrastructure apply -auto-approveOR you can use the just command:
just deployThe project contains a login route (which is public), and a protected route (only accessible with an authorization header).
curl -X POST https://<api-id>.execute-api.<region>.amazonaws.com/login -d '{"username": "user1"}' | jq .tokenUse the token returned by /login to access the protected route:
curl -X GET https://<api-id>.execute-api.<region>.amazonaws.com/data -H "Authorization:<token>"