A Spring Boot Web Application together with IaC (Infrastructure as Code) suitable for setting up cloud infrastructure and deploying the application to AWS (Amazon Web Services).
The IaC is modular and extensible, built with best practices in mind including:
- Security: WAF with OWASP rules, rate limiting, and bot control
- Monitoring: Optional Grafana Cloud integration for application metrics
- Deployment: Automated blue/green deployments with zero-downtime releases (to AWS Fargate/ECS)
- Scaling: Auto-scaling based on CPU utilization
The infrastructure code uses AWS CDK rather than cloud-agnostic tools like Terraform or Pulumi. CDK has some practical advantages:
-
No state files to manage - CDK uses CloudFormation under the hood, which manages state in AWS. With Terraform and Pulumi, you need both your code and separate state files to modify infrastructure. With CDK, you only need the code - CloudFormation tracks what's deployed, so you can run deployments from any machine with AWS credentials.
-
Always up-to-date - New AWS features are available immediately in CDK, with no waiting for third-party tool updates to catch up
This repository contains two main parts that work together:
├── cdk/ Infrastructure definitions (AWS resources)
├── spring/ The application (Kotlin Spring Boot)
└── README.md This file
Defines and creates the cloud resources the application needs to run such as:
- Compute environments to run the app (AWS Fargate/ECS)
- Storage and networking
- Security and access controls
Deployment follows best practices with separate dev and release environments. The release environment includes blue/green deployment for zero-downtime updates.See the dedicated readme.md in the cdk sub-directory for more details.
The actual application code that runs on the infrastructure:
- Built with Kotlin and Spring Boot
- Provides REST APIs (documented with Swagger UI)
- Can run locally or in the cloud
See the dedicated readme.md in the spring sub-directory for more details.
- Run and test the application locally either from source code or as a containerized image
- Deploy infrastructure when ready to deploy in the cloud
- One or both can also be performed as part of CI/CD pipeline