The problem we're solving
Picture a typical internal estate. A TeamCity or Jenkins server builds an ASP.NET app. Someone copies the output to a Windows VM over RDP and edits web.config by hand on the server. There's a Python reporting service whose database password sits in a settings.ini next to the code. Each app works, but each one is tied to the machine it runs on. To move it you rebuild it.
Moving to the cloud doesn't fix this on its own. If you rewrite that app against one provider's own services (its own config store, log format and deployment tooling), you've traded one box you can't leave for another. This course aims for something better and more practical:
For each app: one container image and one config contract. The same image deploys unchanged to Google Cloud Run, Azure Container Apps and Amazon ECS Express Mode.
If you can do that, the organisation can change clouds because the price changed, because a region failed and you need to recover elsewhere, or because leadership simply prefers another vendor. And the move is a deployment, not a rewrite.
What "one image" means
A container image is your app plus everything it needs to run (runtime, libraries, OS packages), built once and identified by a digest (a sha256: hash of its contents). Think of it as the compiled artefact your build server already produces, except it also carries its runtime with it.
# Build once, in CI, from the app's Dockerfile
docker build -t invoices-api:1.4.0 .
# The digest is the image's identity. This is what you promote, not a rebuild.
docker inspect --format='{{index .RepoDigests 0}}' registry.example.com/invoices-api:1.4.0
# registry.example.com/invoices-api@sha256:9f2c...e41a
The rule: you never rebuild per cloud or per environment. You copy the image unchanged into each cloud's registry (Artifact Registry, Azure Container Registry, Amazon ECR) and the digest stays the same. If the bytes differ between clouds, you can no longer be sure that what you tested is what's running.
What "one config contract" means
The image is the same everywhere, so everything that does differ (database host, feature flags, log level, secrets) has to come in from outside, through a small, written-down interface. That interface is the config contract. In practice it's a list of environment variables plus a few runtime promises:
# config-contract.yaml (lives in the app repo and is reviewed like code)
app: invoices-api
listen:
port_env: PORT # the app reads PORT; Cloud Run injects it, and we set it explicitly elsewhere
default_port: 8080
bind: 0.0.0.0 # not localhost, or the platform can't reach it
health:
path: /healthz # each platform's health check calls this
shutdown:
signal: SIGTERM # finish in-flight requests, then exit
env:
- name: DATABASE_URL # required, secret
- name: LOG_LEVEL # optional, default "info"
- name: REPORTS_BUCKET_URL # required
logs: stdout, JSON lines # never to a local file
We'll refactor apps to honour contracts like this in later levels. For now, notice that nothing in it names a cloud.
The three default targets
All three run a container from an image, give it an HTTPS endpoint and scale it for you, so you don't manage servers:
| Target | What it is | Note |
|---|---|---|
| Google Cloud Run | Serverless containers | Injects PORT (default 8080), sends SIGTERM before shutting an instance down |
| Azure Container Apps | Serverless containers | You set the ingress target port. Can scale to zero when minReplicas is 0 |
| Amazon ECS Express Mode | A simplified front end to ECS on Fargate | One call takes an image plus two IAM roles and provisions the service, Application Load Balancer, auto scaling, networking and a URL. No extra charge beyond those resources |
Why not AWS App Runner? App Runner closed to new customers on 30 April 2026. Existing customers can still use it, and even create new services, but AWS plans no new features and recommends ECS Express Mode instead. So in this course ECS Express Mode is the default AWS target. App Runner comes up only for teams already on it, usually as something to migrate away from.
Walkthrough: the same image, three deploys
Here's the payoff in its simplest form. Look at what stays identical: the image digest, the port and the environment variable names.
IMG_DIGEST=sha256:9f2c...e41a # the same everywhere
# Google Cloud Run
gcloud run deploy invoices-api \
--image=europe-west2-docker.pkg.dev/acme/apps/invoices-api@$IMG_DIGEST \
--port=8080 --set-env-vars=LOG_LEVEL=info
# Azure Container Apps
az containerapp create -n invoices-api -g rg-apps --environment cae-prod \
--image acme.azurecr.io/invoices-api@$IMG_DIGEST \
--ingress external --target-port 8080 --env-vars LOG_LEVEL=info
# Amazon ECS Express Mode
aws ecs create-express-gateway-service \
--service-name invoices-api \
--execution-role-arn arn:aws:iam::123456789012:role/ecsTaskExecutionRole \
--infrastructure-role-arn arn:aws:iam::123456789012:role/ecsInfrastructureRoleForExpressServices \
--primary-container '{"image":"123456789012.dkr.ecr.eu-west-2.amazonaws.com/invoices-api@'$IMG_DIGEST'",
"containerPort":8080,
"environment":[{"name":"LOG_LEVEL","value":"info"}]}' \
--health-check-path /healthz
Gotcha: these hand-typed commands are only here to show the idea. Later you'll wrap each cloud in a Terraform/OpenTofu module behind one shared interface, so nobody types these in production.
What may differ, and what must not
This is the line you'll defend throughout the course:
Must NOT differ per cloud
- The container image (same digest)
- The config contract: variable names, port, health path, shutdown behaviour, log format
Allowed to differ per cloud
- Infrastructure code: one module per cloud (
gcp/,azure/,aws/), all with the same inputs - Identity: a Google service account, an Azure managed identity, AWS IAM roles (the two Express Mode roles above, for example)
- Networking: VPCs and VNets, private endpoints, the links back to your data centre
- Where secret values are stored. The variable names the app reads stay the same
Trade-off, honestly: portability has a cost. You give up some convenient provider-only features, or you hide them behind your own interface. The rule we'll use: managed services are fine, as long as the app only ever sees them through the contract (a connection string in
DATABASE_URL, not a provider SDK baked into business logic).
Best practice: if a change needs an
if cloud == "azure"inside application code, it belongs in the infrastructure layer instead.
Key takeaways
- The target is one image and one config contract per app, deployed unchanged to Cloud Run, Azure Container Apps and ECS Express Mode.
- Promote the image by digest. Never rebuild it per cloud or environment.
- The config contract (env vars, port, health path, SIGTERM handling, stdout logs) is cloud-neutral and versioned with the code.
- ECS Express Mode is the default AWS target. App Runner closed to new customers on 30 April 2026 and gets no new features.
- Infrastructure code, identity and networking may differ per cloud. The image and the contract must not.