Managing environments and approved versions

Automating Deployments on AWS

Dunieski Otano

Amazon Web Services Solutions Architect

Same code, three environments

same-code

  • Promote a Lambda version from staging to prod
  • Same artifact, no rebuild
  • One API call updates the prod alias; the code never changes
  • That's "build once, deploy many"
Automating Deployments on AWS

Approved versions, per service

versions

  • Lambda: aliases point to function versions
  • ECR + ECS: image tags + task-definition revisions
  • API Gateway: stages with deployments
  • S3: object versions in versioning-enabled buckets
Automating Deployments on AWS

How Lambda aliases work

3-versions

  • A version is an immutable snapshot of the function
  • An alias is a named pointer to a version
  • Update the alias to promote a version
  • Aliases support weighted routing for canary releases
Automating Deployments on AWS

ECR tags and ECS task definitions

  • ECR images are immutable per digest
  • A tag is a moveable label on a digest
  • ECS task definitions reference an image:tag or @digest
  • For production, pin by digest to lock the exact bits

ecr

Automating Deployments on AWS

API Gateway stages, briefly

  • A stage is a deployment of the API
  • Each stage has its own URL and deployment history
  • Promote by deploying the API to the next stage
  • Stage variables hold per-environment runtime values

api-2

Automating Deployments on AWS

Promoting a version

  • Build the artifact once
  • Validate it in dev, then staging
  • Update the prod alias or tag, no rebuild
  • The same artifact runs in every environment

promotion

Automating Deployments on AWS

Keeping configuration separate

separate

  • Code stays the same across environments
  • Configuration holds the dev-vs-prod differences
  • Stage variables, env vars, Parameter Store, Secrets Manager
  • Never hardcode environment values in the artifact
Automating Deployments on AWS

Let's practice!

Automating Deployments on AWS

Preparing Video For Download...