AWS Deployment
AWS hosts more Spring Boot production apps than any other cloud.
Introduction
AWS hosts more Spring Boot production apps than any other cloud. For TechLearningPRO Orders the practical menu is App Runner, ECS Fargate, EKS, and legacy Elastic Beanstalk.
Most teams should default to ECS Fargate: containers without managing nodes. Choose EKS when you already operate Kubernetes well. App Runner is fine for simple services; Beanstalk works but feels dated for new greenfield.
Pair compute with RDS Postgres, ElastiCache Redis, S3 for artifacts, and CloudWatch for logs/metrics. Define infrastructure with Terraform, CDK, or Pulumi — not click-ops for prod.
This lesson maps Orders onto AWS deployment options on Boot 3 / Java 21 images.
Purpose of this lesson
Select an AWS compute path for Orders and wire it to managed data and observability services.
Understanding the topic
Pick the smallest AWS surface that meets requirements.
- App Runner: image/git to URL — easiest, fewer knobs.
- ECS Fargate: serverless tasks/services — sweet spot for most.
- EKS: managed Kubernetes — max control, max ops.
- Beanstalk: classic PaaS — maintenance mode for many orgs.
- Companions: RDS, ElastiCache, S3, CloudWatch, ALB.
Step-by-step explanation
- Push Orders image to ECR.
- Create an ECS Fargate service behind an ALB with health checks on Actuator.
- Provision RDS Postgres and inject JDBC URL via task environment/secrets.
- Ship logs to CloudWatch; alert on 5xx and unhealthy tasks.
Informative example
ECS-oriented deploy contract for Orders (sketch).
# 1) Pushaws ecr get-login-password --region ${AWS_REGION} | \docker login --username AWS --password-stdin ${ACCOUNT}.dkr.ecr.${AWS_REGION}.amazonaws.comdocker tag techlearningpro/orders:1.0.0 ${ACCOUNT}.dkr.ecr.${AWS_REGION}.amazonaws.com/orders:1.0.0docker push ${ACCOUNT}.dkr.ecr.${AWS_REGION}.amazonaws.com/orders:1.0.0# 2) Task definition env (no plaintext secrets in git)# SPRING_PROFILES_ACTIVE=prod# DB_URL=jdbc:postgresql://orders.xxxxx.rds.amazonaws.com:5432/orders# DB_USER=orders# DB_PASSWORD from AWS Secrets Manager / SSM → task secretOptions# 3) Health# ALB target group: HTTP /actuator/health/readiness → 200# 4) Infra as code# terraform apply # ECR + ECS service + RDS + IAM roles via OIDC CI
Real-world use
TechLearningPRO moved Orders from a lone EC2 to ECS Fargate plus RDS. The first night a task failed health checks because the security group blocked Postgres. After fixing SG rules and readiness paths, deploys became blue/green-ish rolling updates with zero SSH.
Security implications
AWS identity and network boundaries protect Orders data.
- Task roles with least privilege to S3/Secrets Manager only as needed.
- Store DB passwords in Secrets Manager; inject at task start.
- Encrypt RDS and EBS; enforce TLS to the ALB.
Best practices
- Default to ECS Fargate unless Kubernetes is a hard requirement.
- Private subnets for tasks and databases; ALB in public subnets.
- Infrastructure as code + CloudWatch alarms before traffic spikes.
Common mistakes
- EKS by default when Fargate would suffice.
- Public RDS instances.
- Long-lived IAM users for CI instead of OIDC roles.
Advanced interview questions
Interview Prep
Practice concise answers, then expand each card for the explanation.
1IntermediateQuestionECS Fargate vs EKS for a Boot API?+
Answer
2BeginnerQuestionWhere do Spring datasource passwords live on AWS?+
Answer
3BeginnerQuestionWhat health path should an ALB use?+
Answer
Hands-on exercise
Lab. Sketch Terraform resources for ECR, ECS service, ALB, and RDS for Orders. List IAM permissions the GitHub OIDC role needs to deploy — without creating long-lived access keys.
Summary
AWS deployment gives TechLearningPRO Orders a production-scale home. Next: faster PaaS options with Railway and Render.