Golang Gin Lambda Deployed using AWS CDK.
- AWS CLI Configuration
- AWS CDK
- GO
- Docker
In order to deploy the stack to AWS, use CDK CLI within cdk
folder.
cd cdk
cdk synth
cdk deploy --all
All the Go codes are located in services folder. Use GoServiceLambda
function to add another micro service within cdk/lib/api-gateway-stack.ts
file.
User Endpoint Example:
this.addService(api, "SERVICE_NAME");
Using thrid party IDP service for authoization. (e.g. Okta, Auth0)
cd cdk
cp .env.example .env
Edit .env
file according to your IDP setup.
# Okta example
IDENTITY_PROVIDER=okta
IDENTITY_ISSUER_URL=dev-1234.okta.com/oauth2/default
IDENTITY_AUDIENCE=["api://default"]
Protect specific endpoints using scopes in cdk/lib/api-gateway-stack.ts
by adding a environment variable. Scopes will default to empty array when no environment variable is provided.
# User Service Scopes
USERS_SCOPES=["user:write"]
# Organizations Service Scopes
ORGANIZATIONS_SCOPES=["org:admin"]