A terraform repository that allows for self-service via code for developers to create a serverless AWS API that uses a single API gateway with lambda functions at various endpoints. It supports authorization via cognito user pools and by default supports python3.10 endpoints.
Follow along here: https://dev.to/s3an_0vert0n/a-practical-introduction-to-gitops-2eao
- 
Clone git clone https://github.com/SeanOverton/example-platform-eng-serverless-infra.git
- 
Create an AWS user. Create an Access Key credentials for this user. Add AWS secrets to environment variables. 
AWS_ACCESS_KEY
AWS_SECRET_ACCESS_KEY
- 
Create S3 bucket and configure tfstate bucket in ./main.tf
- 
Configure AWS CLI credentials locally and run terraform initto initialise terraform backend state file in the S3 bucket.
- Infra code: Add endpoints to ./config.tfvarslike so:
lambda_functions = {
  + helloworld = {
    + function_name   = "helloworld"
    + auth_required   = false
    + endpoint_method = "GET"
  + },
}
cognito_user_arns = []
stage_name = "default"
- Application code: Add new folder and file for application code in ./lambas/<function_name>/lambda_function.py
Example helloworld python3.10 lambda:
import json
def respond(err, res=None):
    return {
        'statusCode': '400' if err else '200',
        'body': err.message if err else json.dumps(res),
        'headers': {
            'Content-Type': 'application/json',
            'Access-Control-Allow-Origin' : '*',
        },
    }
def lambda_handler(event, context):
    return respond(None, "Helloworld")
