Spring Boot Tutorial 0/110 lessons ~6 min read Lesson 76

    Cloud Deployment

    Once TechLearningPRO Orders is containerized, cloud deployment is a platform choice: managed Kubernetes (EKS/GKE/AKS), serverless containers (ECS Fargate, Cloud Run), or develop…

    Course progress0%
    Focus
    12 guided sections
    Practice signal
    Examples included
    Career prep
    Interview Q&A included

    Introduction

    Once TechLearningPRO Orders is containerized, cloud deployment is a platform choice: managed Kubernetes (EKS/GKE/AKS), serverless containers (ECS Fargate, Cloud Run), or developer-friendly PaaS (Render, Railway, Fly.io).

    Match complexity to team capacity. A three-person startup drowning in node pools ships slower than one using a PaaS. An enterprise with multi-region compliance needs GitOps on Kubernetes.

    Boot 3 / Java 21 apps stay portable when you keep 12-factor config: env vars, health endpoints, and immutable images. The cloud should change ops — not your domain model.

    This lesson frames the decision tree before Docker fundamentals and deep platform labs.

    Purpose of this lesson

    Choose a cloud deployment path for Orders by team maturity while keeping Boot 3 12-factor portability.

    Understanding the topic

    Platform complexity must fit the people who operate it.

    • PaaS: Render / Railway / Fly — git push to URL; fastest path.
    • Serverless containers: Fargate / Cloud Run — containers without node babysitting.
    • Managed K8s: EKS/GKE/AKS + GitOps — full control, full cost.
    • Data plane: managed Postgres + Redis on day one.
    • Portability: OCI image + env config travels between platforms.

    Step-by-step explanation

    1. List constraints: compliance, regions, team size, budget, RTO/RPO.
    2. Pick PaaS, Fargate/Cloud Run, or managed K8s accordingly.
    3. Provision managed Postgres/Redis; point Orders at them via env.
    4. Wire CI to build an image and deploy with a manual prod gate.

    Informative example

    Decision sketch and portable Boot 3 config.

    yaml
    # Decision (Ops runbook)
    # Solo / small team -> Render / Railway / Fly.io
    # Mid-size containers -> AWS Fargate / GCP Cloud Run
    # Enterprise multi-region -> EKS/GKE/AKS + Argo CD / Flux
    # application-prod.yml (portable across clouds)
    spring:
    datasource:
    url: ${DB_URL}
    username: ${DB_USER}
    password: ${DB_PASSWORD}
    management:
    endpoint:
    health:
    probes:
    enabled: true
    health:
    livenessstate:
    enabled: true
    readinessstate:
    enabled: true
    # Deploy contract
    # 1) CI builds techlearningpro/orders:$GIT_SHA
    # 2) Platform pulls image + injects env
    # 3) Smoke /actuator/health then promote

    Real-world use

    TechLearningPRO early Orders lived on a single EC2 with docker-compose. Friday deploys meant SSH. Moving to Cloud Run for the API and managed SQL cut deploy time from forty minutes to five and removed 'which host has the new jar?' pages from the incident channel.

    Security implications

    Cloud accounts are production.

    • Least-privilege IAM/roles for deploy pipelines — prefer OIDC federation.
    • Private networking for databases; public only the Ingress/load balancer.
    • Store credentials in the platform secret store referenced as ${DB_PASSWORD}.

    Best practices

    • Start simpler; graduate platforms when pain is real.
    • Keep domain code cloud-agnostic; isolate cloud SDKs at adapters.
    • GitOps or at least audited pipelines for anything beyond a hobby PaaS.

    Common mistakes

    • Choosing EKS because it looks good on a résumé when the team cannot operate it.
    • Self-hosting Postgres on day one without backups.
    • Cloud-specific SDKs woven through domain code so migration hurts.

    Advanced interview questions

    Interview Prep

    Practice concise answers, then expand each card for the explanation.

    3 questions
    1BeginnerQuestionHow should a small team deploy Boot microservices first?+

    Answer

    Prefer a PaaS or serverless containers; adopt managed Kubernetes when operational need justifies the complexity.
    2IntermediateQuestionWhat keeps a Boot 3 app portable across clouds?+

    Answer

    OCI images, env-based config, health probes, and avoiding cloud SDKs in the domain core.
    3BeginnerQuestionWhy managed Postgres on day one?+

    Answer

    Backups, patching, and failover are hard; focus engineering on Orders features until scale demands otherwise.

    Hands-on exercise

    Lab. Write a one-page runbook: pick PaaS vs Fargate vs EKS for Orders given a 4-person team and one region. List required managed services and the exact env vars Orders needs to boot.

    Summary

    Cloud deployment choices set the ops ceiling for TechLearningPRO Orders. Next: master Docker fundamentals that every path still depends on.

    Ready to mark this lesson complete?Track your journey across the entire course.