This repository provides a minimal serverless architecture as a case study using Terraform on AWS. It simulates order processing with AWS Lambda Function URLs for handling API requests and DynamoDB for data storage.
- Infrastructure as Code (IaC): Uses Terraform to provision and manage AWS resources.
 - Serverless API: Implements AWS Lambda Function URLs for 
GETandPOSToperations. - DynamoDB Integration: Stores order data in a fully managed NoSQL database.
 - IAM Policies: Secures Lambda functions with the least privilege principle.
 - CloudWatch Logging: Enables logging for monitoring and debugging.
 - Modular Design: Organizes Terraform into reusable modules.
 
(Client) → [Lambda Function URL] → [AWS Lambda] → [DynamoDB]
- POST /orders: Submits a new order.
 - GET /orders?id=xyz: Retrieves an order by ID.
 
aws-terraform-serverless-api-starter-kit/
│── examples/                     # Example request payloads
│── src/
│   ├── infra/                     # Terraform infrastructure code
│   │   ├── variables/              # Environment-specific variables
│   │   ├── main_cloudwatch.tf      # CloudWatch logging configuration
│   │   ├── main_dynamodb.tf        # DynamoDB table definition
│   │   ├── main_iam_role_policy.tf # IAM roles and policies
│   │   ├── main_lambda_function_url.tf # Lambda Function URLs
│   │   ├── main_lambda.tf          # Lambda functions
│   │   ├── provider.tf             # AWS provider configuration
│   │   ├── variables.tf            # Terraform variable definitions
│   │
│   ├── infra-modules/              # Reusable Terraform modules
│   │   ├── cloudwatch_log_group
│   │   ├── dynamodb_table
│   │   ├── iam_role_policy
│   │   ├── lambda_function
│   │   ├── lambda_function_url
│   │
│   ├── lambda-function-python/     # Python Lambda source code
│   │   ├── get_order_lambda.py     # GET order Lambda function
│   │   ├── post_order_lambda.py    # POST order Lambda function
│   │
│   ├── lambda-function-python-zip/ # Packaged Lambda functions
│   │   ├── get_order_lambda.zip
│   │   ├── post_order_lambda.zip
│
│── .gitignore
│── LICENSE (MIT)
│── README.md
- Install Terraform
 - Configure AWS CLI (
aws configure) 
- 
Clone the repository:
git clone https://github.com/your-repo/aws-terraform-serverless-api-starter-kit.git cd aws-terraform-serverless-api-starter-kit/src/infra - 
Initialize Terraform:
terraform init
 - 
Plan the infrastructure:
terraform plan -var-file=variables/dev.tfvars
 - 
Apply changes:
terraform apply -var-file=variables/dev.tfvars
 
Submit an order:
curl -X POST "https://your-lambda-url/orders" \
     -H "Content-Type: application/json" \
     -d '{ "CustomerId": "CUST-5678", "products": [{"quantity": 1, "single_price": 99.9}] }'Retrieve an order:
curl -X GET "https://your-lambda-url/orders?id=xyz"Stay tuned! This project will be extended with new features and improvements, making it an even more complete serverless case study. 🚀
This project is licensed under the MIT License. Use at your own risk. If something breaks, it's your problem! 😆
🚀 Happy Coding!