An ECR Deployment Script

Below is a simple script to deploy a Docker image to ECR...

set -e

log () {
  local bold=$(tput bold)
  local normal=$(tput sgr0)
  echo "${bold}${1}${normal}" 1>&2;

if [ -z "${AWS_ACCOUNT}" ];
  log "Missing a valid AWS_ACCOUNT env variable";
  exit 1;
  log "Using AWS_ACCOUNT '${AWS_ACCOUNT}'";


log "🔑 Authenticating..."
aws ecr get-login-password \
  --region ${AWS_REGION} \
  | docker login \
    --username AWS \
    --password-stdin \

log "📦 Building image..."
docker build -t ${REPO_NAME} .

log "🏷️ Tagging image..."
docker tag \
  ${REPO_NAME}:latest \

log "🚀 Pushing to ECR repo..."
docker push \

log "💃 Deployment Successful. 🕺"

blog comments powered by Disqus

Discussion, links, and tweets

You can find me on Github under the username alukach, rarely tweeting as anthonylukach, lurking in the #cugos channel on IRC's Freenode network under the name anth0ny, or by old-fashioned email at