Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save eugenestarchenko/faa6eeb12c905270040e1f6f8d2f7d45 to your computer and use it in GitHub Desktop.

Select an option

Save eugenestarchenko/faa6eeb12c905270040e1f6f8d2f7d45 to your computer and use it in GitHub Desktop.
Authenticate into AWS ECR. Useful in a CI environment (to push images) ... and so on. If you're unhappy evaluating unvalidated commands ... this adds a regex that checks the output from get-login.
# See https://forums.aws.amazon.com/thread.jspa?threadID=222215
aws_login=$(aws ecr get-login --region us-east-1);
if echo "$aws_login" | grep -q -E '^docker login -u AWS -p \S{1092} -e none https://[0-9]{12}.dkr.ecr.\S+.amazonaws.com$'; then $aws_login; fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment