amazon-ecsdocker-registryaws-ecr

Create AWS ECR repository if it doesn't exist


How can I create an AWS ECR repository if it doesn't already exist?


Solution

  • One liner to create a repo if it doesn't exist (or the describe command fails for any other reason):

    aws ecr describe-repositories --repository-names ${REPO_NAME} || aws ecr create-repository --repository-name ${REPO_NAME}