trevorblackman.dev

Documentation

AWS CLI Command Cheat Sheet

A list of common and useful AWS CLI commands, organized by service.

AWS CLI Commands

Source: https://awscli.amazonaws.com/v2/documentation/api/latest/reference/index.html

ECR

aws ecr describe-images [OPTIONS]

Lists metadata for the images in a repository. The example below sorts images newest-first by push date, then projects each image’s tag, digest, and push date into a readable table.

aws ecr describe-images \
  --registry-id 123456 \
  --region us-east-1 \
  --repository-name namespace/repo \
  --query 'sort_by(imageDetails, &imagePushedAt)[::-1].{Tag:imageTags[0], Digest:imageDigest, Pushed:imagePushedAt}' \
  --output table
  • --registry-id <id>: The AWS account ID that owns the registry (defaults to the caller’s default registry).
  • --region <region>: The AWS region the repository lives in.
  • --repository-name <name>: The repository whose images to describe.
  • --query <expression>: A JMESPath expression to filter and reshape the output — here, sort_by(imageDetails, &imagePushedAt)[::-1] orders images by push date descending (newest first), then projects each image’s first tag, digest, and push timestamp.
  • --output <format>: The output format — table, json, text, or yaml.