Search code examples
amazon-web-servicesaws-powershell

'Get-ECRLoginCommand' is not recognized as the name of a cmdlet, function, script file, or operable program


I am trying to download a Docker image from AWS and following the instructions at AWS I'm running:

(Get-ECRLoginCommand).Password | docker login --username AWS --password-stdin aws_account_id.dkr.ecr.region.amazonaws.com

However, I'm getting the following error:

Get-ECRLoginCommand : The term 'Get-ECRLoginCommand' is not recognized as the name of a cmdlet, function, script file, or operable program.

How can I fix this error? I assume I need to install the module.


Solution

  • After some searching, I realised I had omitted installing ECR when installing AWSTools. I had used these 2 commands:

    Install-Module -Name AWS.Tools.Installer -Force
    Install-AWSToolsModule AWS.Tools.EC2,AWS.Tools.S3 -CleanUp
    

    So I installed it with:

    Install-AWSToolsModule AWS.Tools.ECR
    

    After that it worked.