AWS DevOps

The native AWS CI/CD services, the four ways to run containers on AWS, and the IAM patterns that mean you never store an access key in a pipeline.

01The native AWS DevOps stack

AWS offers a "Code-something" service for every step of CI/CD. You don’t have to use them — many teams use GitHub Actions or Jenkins instead — but you should know what they are.

CodeCommit
Hosted Git (legacy)
CodeBuild
Run build commands
CodeArtifact
Private package registry
CodePipeline
Stage orchestrator
CodeDeploy
Blue/Green & canary
CloudFormation / CDK
AWS-native IaC

You join a fast-growing startup on AWS. The CTO shows you the cloud account. There are 60 IAM users, half of them belong to people who left. There’s a master_access_key in three different GitHub repository secrets. The CI pipeline runs as the root account because "that was easiest at the time."

A penetration tester gets hold of any one of those keys. They have the kingdom.

AWS in 2026 has the tools to make this impossible. OIDC federation for pipelines. IRSA / Pod Identity for Kubernetes. IAM Roles Anywhere for on-prem. Once you adopt them, no long-lived AWS key ever has to leave the cloud again.

02Why people choose AWS-native services

You can run a complete DevOps stack on AWS using only third-party tools (GitHub Actions + Terraform + Docker Hub). So why use CodePipeline, CodeBuild, CodeDeploy at all?

Reason 01

Single bill, single support contract

For enterprises with a master AWS agreement, adding more AWS services is a paperwork-free decision. Procurement loves it.

Reason 02

Native IAM, native KMS, native VPC

Code* services are inside your AWS account. They use your IAM roles, your KMS keys, your VPC endpoints. No third-party trust to manage, no data leaving AWS.

Reason 03

Tight integration with deploy targets

CodeDeploy has first-class support for ECS, EC2 and Lambda with blue/green and canary baked in. You don’t build the rollout state machine — AWS does.

Reason 04

Honest reasons to not

UI is dated. The Code* services have less momentum than GitHub Actions in 2026. Many teams use GitHub or GitLab for CI and just hand the artifact to AWS to deploy. That’s a perfectly valid pattern.

03Where will the code actually run?

AWS gives you four very different shapes of compute. Picking the right one before you start saves months of rewriting. Walk down this list and stop at the first match.

Tiny event handler or scheduled job?
⇒ Lambda. Pay per millisecond. Cold-start concerns are real but small for most languages.
A stateless web app in a container, low maintenance?
⇒ App Runner or ECS on Fargate. Push the image; AWS gives you a URL. No servers to manage.
Many services, ingress, service mesh, your own operators?
⇒ EKS. Real Kubernetes with AWS managing the control plane. Bring a platform team.
GPU-heavy, long-running, or legacy that needs full VM access?
⇒ EC2 + Auto Scaling Group + CodeDeploy. Old-school, still alive, sometimes the right answer.

04How CI authenticates to AWS

Almost every AWS security incident starts with a leaked long-lived key. In 2026 there is a "right way" to authenticate from every common source. Use it.

Long-lived access keys
Stored in CI secrets, rotated quarterly by a forgotten cron. The traditional way; the single largest source of cloud breaches. Migrate away.
OIDC federation
GitHub / GitLab / Jenkins mints a JWT for each run. An AWS IAM role’s trust policy verifies the claims and returns short-lived credentials. Default for pipelines in 2026.
IRSA / EKS Pod Identity
A pod assumes an IAM role via its Kubernetes service account. No keys in the image; credentials rotate automatically.
IAM Roles Anywhere
On-prem servers present X.509 certificates and get temporary AWS credentials. Bridges the on-prem world without the access-key footgun.

05A CodeBuild buildspec in real life

Read this top to bottom. It builds an image, scans it with Trivy, pushes to ECR, and writes an imagedefinitions.json that CodePipeline hands to CodeDeploy / ECS.

buildspec.ymlYAML
version: 0.2

env:
  variables:
    IMAGE:  "course/api"
    REGION: "eu-west-1"

phases:
  install:
    runtime-versions: { nodejs: 20 }

  pre_build:
    commands:
      - aws ecr get-login-password --region $REGION |
          docker login --username AWS --password-stdin
          $ACCOUNT_ID.dkr.ecr.$REGION.amazonaws.com
      - export TAG=$CODEBUILD_RESOLVED_SOURCE_VERSION

  build:
    commands:
      - npm ci
      - npm test
      - docker build -t $IMAGE:$TAG .
      - trivy image --severity HIGH,CRITICAL --exit-code 1 $IMAGE:$TAG

  post_build:
    commands:
      - docker tag $IMAGE:$TAG \
          $ACCOUNT_ID.dkr.ecr.$REGION.amazonaws.com/$IMAGE:$TAG
      - docker push \
          $ACCOUNT_ID.dkr.ecr.$REGION.amazonaws.com/$IMAGE:$TAG

artifacts:
  files: [imagedefinitions.json]

06Habits that keep the AWS bill honest

AWS is a metered service. Every habit on this list saves money and reduces risk — and they compound as you grow.

Anti-pattern
Long-lived aws_access_key_id in CI secrets. Replace with OIDC federation. Everything else on this list is detail compared to that one fix.
Anti-pattern
Untagged resources. No owner, env, service or cost-center. The bill becomes a mystery. No tag, no resource.
Anti-pattern
ECR & S3 with no lifecycle. Old container images and forgotten artifacts cost real money. Set lifecycle rules to delete untagged images after 14 days.
Anti-pattern
No budget alerts. Surprise bills are an operational failure, not a finance failure. Weekly anomaly alerts in Slack; monthly budget caps per account.
Healthy
Spot instances where it’s safe. Karpenter (on EKS) picks Spot for stateless workloads automatically. Easily 60-80% cheaper than On-Demand.

07Putting it together

Take-aways

1. AWS has a Code* service for every CI/CD stage. Use them when AWS-native integration matters; use GitHub Actions if it doesn’t.

2. Pick a runtime by the shape of the workload: Lambda for events, App Runner / ECS for web, EKS for platforms, EC2 for legacy or GPU.

3. Replace long-lived keys with OIDC, IRSA, Pod Identity, IAM Roles Anywhere. There is no excuse for a static key in 2026.

4. Tag everything. Lifecycle everything. Budget-alert everything. Spot where safe.

Next chapter: the same story for the other major cloud — Azure DevOps.