Spring Boot REST API with On-Demand AWS Infrastructure
Checking application status...
The Music Library API is a comprehensive backend application developed as a bootcamp final project and expanded into a 400+ hour deep dive into deployment options, AWS cloud infrastructure, and cost optimization. This RESTful API provides complete CRUD operations for managing a music catalog including artists, albums, and genres.
Built with Spring Boot following best practices for layered architecture. Features a library of 50 artists and 100+ albums. Deployed on AWS with production-grade reliability and professional UX.
Live API address after propagation: http://project.jcarl.net/api
Validation Testing: 182 API requests, 600 tests, 100% pass rate
This project demonstrates real-world cost optimization β the same strategies used by companies to reduce cloud spend. By redesigning from always-on to on-demand architecture, monthly costs dropped from ~$55 to ~$1.
S3 static site + CloudFront CDN + Lambda functions + API Gateway. Always available for a user to launch the app.
RDS MySQL + ECS Fargate only run when launched. Auto-shutdown after 30 minutes of inactivity.
Lambda monitors CloudWatch CPU metrics. When idle (CPU < 2% for 30 min), it stops ECS and RDS automatically.
Complete CRUD operations for Artists, Albums, and Genres with proper HTTP status codes and standardized error responses.
One-to-Many (Artist-Album) and Many-to-Many (Album-Genre) JPA relationships with bidirectional synchronization.
All list endpoints support page, size, and sort parameters for efficient data retrieval.
Bean Validation (JSR-380) with detailed field-level error messages for data integrity.
Swagger UI (OpenAPI 3.0) for exploring and testing endpoints directly in the browser.
Unit tests with Mockito, integration tests with Spring Boot Test, 600 automated tests passing.
Lambda-orchestrated startup, auto-shutdown after inactivity, 98% cost reduction vs always-on.
Live infrastructure status API showing database and application state with progress tracking.
50 artists and 100+ albums with cover images, loaded via Postman collection for demonstrations.
For more information please see the detailed GitHub README.
All endpoints prefixed with /api. Full documentation available in the GitHub README.
/api/artists - Get paginated artists
/api/artists - Create artist
/api/artists/{id} - Get artist by ID
/api/artists/{id} - Update artist
/api/artists/{id} - Delete artist
/api/artists/{id}/albums - Get albums by artist
/api/albums - Get paginated albums
/api/albums/search?q={query} - Search by title or artist
/api/albums - Create album
/api/albums/{id} - Get album by ID
/api/albums/{id} - Update album
/api/albums/{id} - Delete album
/api/genres - Get paginated genres
/api/genres - Create genre
/api/genres/{id} - Get genre by ID
/api/genres/{id} - Update genre
/api/genres/{id} - Delete genre
/api/genres/{id}/albums - Get albums by genre
The application uses a serverless-first architecture that scales to zero when not in use. This is the same pattern used by companies to optimize cloud costs for low-traffic applications.
S3 Static Site hosts this launcher page at projectlauncher.jcarl.net
CloudFront + ACM provides HTTPS and CDN caching
API Gateway + Lambda handles status checks and startup requests
EventBridge triggers auto-shutdown Lambda every 5 minutes
RDS MySQL starts when user clicks "Launch" (~2-3 min startup)
ECS Fargate deploys container once database is available (~2-3 min)
Namesilo DNS automatically updated with new public IP
Spring Boot App serves API at project.jcarl.net
EventBridge triggers Lambda every 5 minutes
CloudWatch Metrics analyzed for ECS CPU utilization (30-min average)
Threshold: CPU < 2% indicates true idle (no requests)
Shutdown Action stops ECS service and RDS instance automatically
Queries ECS and RDS state. Returns database status, app status, and public IP. Powers the real-time progress UI.
Orchestrates startup sequence: starts RDS, waits for availability, then starts ECS service. Handles email notifications via SES.
Monitors CloudWatch CPU metrics. Stops ECS and RDS when idle for 30 minutes. Prevents cost accumulation.
This project evolved through multiple iterations, technology pivots, and 400+ hours of hands-on learning. What started as a bootcamp final project became a comprehensive study in AWS infrastructure and cost optimization.
Iterative development through AWS CloudShell and CodeBuild, refining container configuration and startup scripts.
Continuous optimization of container settings, environment variables, and resource allocation.
From bootcamp project to production-ready, cost-optimized cloud infrastructure.
Route 53 DNS scripts failed due to ash vs bash differences. Pivoted to Namesilo API with simple curl commands that work in Alpine's ash shell.
Tasks repeatedly rolled back due to health check failures during DNS script execution. Simplified startup sequence and increased health check grace period.
Local system incompatible with Docker Desktop. Pivoted to AWS CloudShell as primary build environment β cloud-based development solved local limitations.
Learned distinction between task execution role vs task role. Configured proper cross-service permissions for Lambda to access ECS, RDS, and CloudWatch.
Route 53 API too complex for container scripts. Migrated to Namesilo's simpler HTTP API. Sometimes the best solution is the simplest one.
Spring Boot update disabled default static resources on AWS. Fixed with environment variable: SPRING_WEB_RESOURCES_STATIC_LOCATIONS.
Swagger UI injected invalid sort parameters causing 500 errors. Migrated to explicit @RequestParam declarations for consistent behavior.
Redesigned entire infrastructure: eliminated ALB ($16/mo), implemented Lambda orchestration, built auto-shutdown system with CloudWatch metrics.
Initial 35% CPU threshold was too aggressive β shut down active app. Production testing revealed Spring Boot idles at 10-12%. Calibrated to 2% for true idle detection.
Built Lambda to extract public IP from ECS task ENI attachments. Required EC2 network interface permissions and handling of various RDS states.
Configured domain verification with DKIM, obtained production access, implemented async Lambda pattern for delayed notifications.
Upgraded MySQL 8.0β8.4 LTS, migrated to Graviton2 (db.t4g), actively testing instance sizes to balance cold-start time vs running cost.
This project demonstrates proficiency across backend development, cloud infrastructure, and DevOps practices:
Spring Boot 3.x, REST API design, JPA/Hibernate, Bean Validation, DTO patterns, global exception handling, comprehensive testing.
ECS Fargate, RDS MySQL, ECR, S3, CloudFront. Hands-on deployment, configuration, and troubleshooting.
Lambda functions (Python/boto3), API Gateway, EventBridge scheduling, CloudWatch metrics analysis.
On-demand architecture, auto-shutdown systems, ALB elimination, resource right-sizing.
Docker multi-stage builds, CI/CD with CodeBuild, DNS automation, infrastructure monitoring, production debugging.
400+ hours of iteration. Pivoted strategies when approaches failed. Made data-driven decisions based on production metrics.
Click "Launch Music Library" at the top of this page. The app takes ~5-7 minutes to start, then auto-shuts down after 30 minutes of inactivity.
git clone https://github.com/jc-gh25/MusicLibrary.git
cd music-library && mvn spring-boot:run
Requires Java 17+, Maven 3.6+, and MySQL 8.0+. See GitHub README for full setup instructions.
mvn test
Runs unit and integration tests using H2 in-memory database. 600 automated tests, 100% pass rate.