buildspec.yml to push to ECR is throwing this error "Command did not exit successfully $(aws ecr get-login --no-include-email --region us-east-1)"

Solution 1:

As of the CLI documentation get-login is deprecated in version 2.x of the CLI. It does not exist in the most recent versions.

Use get-login-password instead.

Here's an example from the CodeBuild documentation: aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com