Search code examples
pythonamazon-web-servicesamazon-ecsaws-cliamazon-ecr

Can't run 'aws' command


I have aws command installed via pip install aws.

Whenever I type in whatever related to aws (such as aws ecr get-login-password), I'm getting following error:

Traceback (most recent call last):
  File "/Users/Stan/.pyenv/versions/3.8.13/envs/rasa/bin/aws", line 5, in <module>
    from aws.main import main
  File "/Users/Stan/.pyenv/versions/3.8.13/envs/rasa/lib/python3.8/site-packages/aws/main.py", line 23
    print '%(name)s: %(endpoint)s' % {
          ^
SyntaxError: invalid syntax

Help would be appreciated.


Solution

  • Confusingly, the aws Python package is not the official one from Amazon, it's some third-party tool that doesn't work the same way. The real one is awscli.

    Uninstall the aws package and install awscli:

    pip uninstall aws
    pip install awscli
    

    And then your aws command should work.

    Edit:

    There is a new version called awscliv2 which is not installable via pip, and seems to be only installable via downloading a compressed archive. It supports newer AWS features and services that the version 1 tool does not.