Loading repository data…
Loading repository data…
drewbai / repository
A clean, reproducible AWS DevOps demonstration showcasing how to deploy a serverless application using Terraform. This project provisions an end‑to‑end architecture—including IAM, Lambda, and API Gateway—entirely through Infrastructure as Code. It’s designed as a practical, interview‑ready example of cloud automation, least‑privilege IAM design,
Minimal, production-ready example for interview discussion:
Architecture: HTTP API → Lambda (Python 3.12) → CloudWatch Logs.
service, level, message, plus request context.$default stage writes access logs to CloudWatch.AWSLambdaBasicExecutionRole policy.lambda_function.py – Handler with structured logging, JSON response.main.tf – Terraform for IAM role, Lambda, HTTP API, integration, route, stage, and Lambda permission.aws configure). The identity must have permissions to create IAM roles/policies, Lambda, API Gateway, and CloudWatch log groups.From the repository folder aws_devops_demo:
$ErrorActionPreference = "Stop"
# 1) Package the Lambda
New-Item -ItemType Directory -Force .\build | Out-Null
Compress-Archive -Path .\lambda_function.py -DestinationPath .\build\lambda.zip -Force
# 2) Deploy with Terraform (change region if desired)
terraform init
terraform apply -auto-approve -var "region=us-east-1"
# 3) Test the endpoint
$endpoint = terraform output -raw api_endpoint
curl.exe -sS "$endpoint/hello"
Expected JSON response:
{
"service": "aws-devops-demo",
"message": "Hello from Lambda",
"requestId": "..."
}
Optional: include a correlation ID header to see it in logs
curl.exe -sS -H "x-correlation-id: demo-123" "$endpoint/hello"
/aws/lambda/aws-devops-demo-hello)./aws/apigw/aws-devops-demo-http-api.AWSLambdaBasicExecutionRole for logs.aws_lambda_permission restricts API Gateway invocation to the GET /hello route for this API.aws-devops-demo for clear scoping.var.project default in main.tf, or pass -var "project=your-prefix" during terraform apply.-var "region=your-aws-region".aws_lambda_function if needed.Destroy all resources to avoid charges:
terraform destroy -auto-approve -var "region=us-east-1"
AWS_PROXY and payload format 2.0.$default stage simplifies base URL (no stage path).source_code_hash ensure Terraform deploys new zip builds.