|
1 | | -# aws-terraform-static-hosting-cloudfront |
| 1 | +# Terraform AWS Serverless Project: S3 + CloudFront + Lambda + DynamoDB |
| 2 | + |
2 | 3 | Terraform project to provision static hosting on AWS S3 and deliver content securely via CloudFront CDN. |
| 4 | + |
| 5 | +## 📌 Infrastructure Overview |
| 6 | + |
| 7 | +This project provisions the following resources on AWS: |
| 8 | + |
| 9 | +- **S3 Bucket**: static website hosting |
| 10 | +- **CloudFront Distribution**: global CDN with HTTPS support |
| 11 | +- **DynamoDB Table**: to store product data |
| 12 | +- **Lambda Function**: `get_products`: read items from DynamoDB |
| 13 | +- **Lambda Function**: `post_products`: write items into DynamoDB |
| 14 | + |
| 15 | +### Architecture Diagram |
| 16 | + |
| 17 | + |
| 18 | +## Project structure: |
| 19 | + |
| 20 | +The project is under the src folder. |
| 21 | + |
| 22 | +- **infra**: contains all Terraform files; run `terraform` commands from here |
| 23 | +- **infra-modules**: reusable Terraform modules for resources |
| 24 | +- **lambda-function-python**: Python source code for Lambda functions |
| 25 | +- **lambda-function-python-zip**: folder used by Terraform to generate Lambda ZIPs |
| 26 | +- **web-template**: static web templates to be uploaded to S3 |
| 27 | + |
| 28 | +## 🚀 Commands |
| 29 | + |
| 30 | +Initialize, plan and apply: |
| 31 | + |
| 32 | +```bash |
| 33 | +terraform init |
| 34 | +terraform plan -var-file=variables/dev.tfvars |
| 35 | +terraform apply -var-file=variables/dev.tfvars |
| 36 | +``` |
| 37 | + |
| 38 | +Destroy infrastructure: |
| 39 | + |
| 40 | +```bash |
| 41 | +terraform destroy -var-file=variables/dev.tfvars |
| 42 | +``` |
| 43 | + |
| 44 | +## Future Enhancements |
| 45 | +Stay tuned! This project will be extended with new features and improvements, making it an even more complete serverless case study. 🚀 |
| 46 | + |
| 47 | +## License |
| 48 | +This project is licensed under the **MIT License**. Use at your own risk. If something breaks, **it's your problem!** 😆 |
| 49 | + |
| 50 | +--- |
| 51 | +🚀 Happy Coding! |
0 commit comments