aws-actions/amazon-ecr-login@v2

Logs in the local Docker client to one or more Amazon ECR Private registries or an Amazon ECR Public registry

At a glance

Latest major
v2
Repository
aws-actions/amazon-ecr-login
Inputs
5 (0 required)
Outputs
1
Runs using
node24
License
MIT
Last checked

Inputs and outputs come straight from the action's official action.yml. See our editorial standards.

Usage

- uses: aws-actions/amazon-ecr-login@v2

Inputs

NameRequiredDefaultDescription
http-proxyNononeProxy to use for the AWS SDK agent.
mask-passwordNotrueMask the docker password to prevent it being printed to action logs if debug logging is enabled. NOTE: This will prevent the Docker password output from being shared between separate jobs. Options: ['true', 'false']
registriesNononeA comma-delimited list of AWS account IDs that are associated with the ECR Private registries. If you do not specify a registry, the default ECR Private registry is assumed. If 'public' is given as input to 'registry-type', this input is ignored.
registry-typeNoprivateWhich ECR registry type to log into. Options: [private, public]
skip-logoutNofalseWhether to skip explicit logout of the registries during post-job cleanup. Exists for backward compatibility on self-hosted runners. Not recommended. Options: ['true', 'false']

Outputs

NameDescription
registryThe URI of the ECR Private or ECR Public registry. If logging into multiple registries on ECR Private, this output will not be set.

Read an output with ${{ steps.<step-id>.outputs.<name> }}; the step needs an id.

Examples

Log in to Amazon ECR

Get a registry login after configuring AWS credentials; the output is the registry host.

name: Example
on:
  push:
    branches: [main]

permissions:
  id-token: write
  contents: read

jobs:
  example:
    runs-on: ubuntu-latest
    steps:
      - uses: aws-actions/configure-aws-credentials@v6
        with:
          role-to-assume: arn:aws:iam::123456789012:role/github-deploy
          aws-region: us-east-1
      - name: "Amazon ECR \"Login\" Action for GitHub Actions"
        id: ecr
        uses: aws-actions/amazon-ecr-login@v2
      - name: Use the output
        run: echo "registry = ${{ steps.ecr.outputs.registry }}"

Each example passed actionlint (syntax, expressions and the inputs it knows for this action). They were not run in a live repository, so replace placeholder values such as names, ARNs and paths with your own.

Something out of date or wrong? Report it on our Contact page. This page is rebuilt from the action's repository roughly once a week.