teluzia.Cloud Engineer · Day 157
CHAPTER 23 · FLAGSHIP CAPSTONE

Container/ECS-or-EKS deployment

4–5 hours including independent practice3 topics
LET’S MAKE THIS SIMPLE

What you’re learning today

Container image is today's starting point. A Dockerfile declares a predictable dependency install and a nonroot application user. Pin the resulting image digest for release; rebuilding the same source can differ if dependencies float. You will connect this with ecs or eks choice and deployment health. The lesson's artifact brings these decisions together: Write one deployment specification for ECS or EKS and a container contract; test its request/health expectations using a review checklist and mock responses.

Think of it this way

A container image is a packed delivery unit; the orchestrator places it, and health checks verify the delivered service actually works.

TOPIC 01 / 03Step by step

Container image

Build a minimal application image with a reproducible dependency definition and nonroot execution where practical. A tag is convenient, while a digest identifies an exact image. A Dockerfile declares a predictable dependency install and a nonroot application user. Pin the resulting image digest for release; rebuilding the same source can differ if dependencies float.

WORKED EXAMPLE
A Dockerfile declares a predictable dependency install and a nonroot application user. Pin the resulting image digest for release; rebuilding the same source can differ if dependencies float.

An image layer contributes filesystem content; an entrypoint starts the process; a digest identifies the built content. Imagine a dependency is installed without a fixed version during build. The same commit can produce a different image later, so release evidence needs the actual digest and dependency definition. Verify the runtime user, listening port, health path and writable directories as a container contract. A minimal image reduces unnecessary packages but may omit debugging tools; collect logs and expose useful health behavior instead of assuming a shell is available. Do not place build credentials into a retained layer. Connect the image to the infrastructure's port mapping and pipeline artifact record so deployment uses the tested bytes rather than whichever image a mutable name currently selects.

Why this matters

Pin the resulting image digest for release; rebuilding the same source can differ if dependencies float.

A common trap

A mutable tag uniquely identifies the exact image forever.

Read all topics in this lesson

A complete reference to revisit alongside the guided steps above.

Container image

Build a minimal application image with a reproducible dependency definition and nonroot execution where practical. A tag is convenient, while a digest identifies an exact image. A Dockerfile declares a predictable dependency install and a nonroot application user. Pin the resulting image digest for release; rebuilding the same source can differ if dependencies float.

WORKED EXAMPLE
A Dockerfile declares a predictable dependency install and a nonroot application user. Pin the resulting image digest for release; rebuilding the same source can differ if dependencies float.

An image layer contributes filesystem content; an entrypoint starts the process; a digest identifies the built content. Imagine a dependency is installed without a fixed version during build. The same commit can produce a different image later, so release evidence needs the actual digest and dependency definition. Verify the runtime user, listening port, health path and writable directories as a container contract. A minimal image reduces unnecessary packages but may omit debugging tools; collect logs and expose useful health behavior instead of assuming a shell is available. Do not place build credentials into a retained layer. Connect the image to the infrastructure's port mapping and pipeline artifact record so deployment uses the tested bytes rather than whichever image a mutable name currently selects.

Why this matters

Pin the resulting image digest for release; rebuilding the same source can differ if dependencies float.

A common trap

A mutable tag uniquely identifies the exact image forever.

ECS or EKS choice

ECS provides AWS container orchestration; EKS provides managed Kubernetes control-plane functionality. Choose one based on requirements and operational capacity; document why the other adds unnecessary work. For a small AWS-only task API, ECS may reduce Kubernetes-specific operations. EKS can fit existing Kubernetes requirements, but adds concepts such as pods, cluster access and resource management.

WORKED EXAMPLE
For a small AWS-only task API, ECS may reduce Kubernetes-specific operations. EKS can fit existing Kubernetes requirements, but adds concepts such as pods, cluster access and resource management.

An orchestration service schedules containers; a control plane manages desired state; operational capacity is the team's ability to understand and maintain the chosen platform. Imagine the capstone requires only one small API and no Kubernetes-specific integration. ECS can meet that need with fewer cluster concepts; EKS may be justified when portability or an existing Kubernetes ecosystem is part of the requirement. Compare identity, networking, rollout and diagnostics for the selected route, not only the service names. Managed control planes do not remove application, permission or workload responsibilities. More flexible orchestration can improve extensibility while increasing the learning and maintenance surface. Pick one coherent path, document the rejected option and ensure Terraform outputs, image deployment and health validation all use the same chosen platform.

Why this matters

EKS can fit existing Kubernetes requirements, but adds concepts such as pods, cluster access and resource management.

A common trap

EKS is mandatory for any professional container project.

Deployment health

Define service ports, resource limits, health checks and rollback image. Running tasks or pods are not enough; verify the external request path and dependency access. The container listens on 8080 while the service forwards 80 to 8080. A /health check must reach the actual port/path; a running task with the wrong mapping still fails requests.

WORKED EXAMPLE
The container listens on 8080 while the service forwards 80 to 8080. A /health check must reach the actual port/path; a running task with the wrong mapping still fails requests.

A desired count specifies intended replicas; a health check tests a defined endpoint; a rollout replaces versions while preserving the required service behavior. Imagine the container starts on port 3000 but the target registration expects 8080. Scheduling success cannot overcome the contract mismatch. Trace client port, load-balancer target, service mapping and actual listener, then verify a representative request and the health endpoint. Configure resource bounds using application observations, and establish a known-good image for rollback. A fast rollout reduces release time but may replace too much healthy capacity before the new version is proven. Verify readiness and dependency access at each stage, and connect health evidence to the image digest so a passing old replica is not mistaken for validation of the new release.

Why this matters

A /health check must reach the actual port/path; a running task with the wrong mapping still fails requests.

A common trap

Running containers guarantee the full external request path works.

KEEP THESE WITH YOU

Today’s takeaways

Container image: Build a minimal application image with a reproducible dependency definition and nonroot execution where practical.

ECS or EKS choice: ECS provides AWS container orchestration; EKS provides managed Kubernetes control-plane functionality.

Deployment health: Define service ports, resource limits, health checks and rollback image.

CLOSE THE LOOP

Ready to complete this day?

Verify the practical steps and pass the knowledge check (at least two thirds correct).

Lab steps verifiedKnowledge check passed