AWS CLI 2 cheatsheet

AWS CLI 2: Containers and secrets

4 common AWS CLI 2 tasks.

Log Docker in to ECR

Authenticate Docker to a private registry. Use your own account ID and region.

aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 123456789012.dkr.ecr.us-east-1.amazonaws.com

Connect kubectl to EKS

Add the cluster to your kubeconfig.

aws eks update-kubeconfig --name my-cluster --region us-east-1

Read a parameter

Read a Systems Manager parameter and decrypt it if it is a SecureString.

aws ssm get-parameter --name /app/db-url --with-decryption --query Parameter.Value --output text

Caution: This prints the secret in your terminal.

Read a secret

Read a Secrets Manager secret value.

aws secretsmanager get-secret-value --secret-id prod/db --query SecretString --output text

Caution: This prints the secret in your terminal.

Was this page helpful?