Interview Prep/AWS/Rapid-Fire AWS CLI

How do you read a secret and use it without leaking it to shell history or logs?

IntermediateProductionRapid-Fire AWS CLI
Answer
PGPASSWORD=$(aws secretsmanager get-secret-value --secret-id prod/orders/db \
  --query SecretString --output text | jq -r .password) \
  psql -h orders.cluster-xyz.eu-west-1.rds.amazonaws.com -U app orders
aws secretsmanager rotate-secret --secret-id prod/orders/db      # trigger rotation now

Avoid set -x in CI around these lines, and never echo the value.

aws All AWS questions

More on Rapid-Fire AWS CLI