Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid syntax error on running AWS command

I am getting the below exception while trying to run any AWS command on my MacBook, for example:

Command

aws s3api create-bucket --bucket my_backup  --region us-west-2 --create- 
bucket-configuration LocationConstraint=us-west-1

Exception

Traceback (most recent call last):
File "/Users/avinash/.local/share/virtualenvs/pipend_shell_3- 
x8skfE25/bin/aws", line 7, in <module>
from aws.main import main
File "/Users/avinash/.local/share/virtualenvs/pipend_shell_3- 
x8skfE25/lib/python3.6/site-packages/aws/main.py", line 23
print '%(name)s: %(endpoint)s' % {
                             ^
SyntaxError: invalid syntax

I am using Python 3.6.5 and have installed aws:

pip install aws
like image 423
avinash Avatar asked Jul 10 '18 07:07

avinash


People also ask

Why my AWS CLI is not working?

If the aws command cannot be found after first installing or updating the AWS CLI, you might need to restart your terminal for it to recognize any PATH updates. If the aws command cannot be found after first installing or updating the AWS CLI, it might not have been fully installed.

Does AWS CLI v2 require Python?

AWS CLI v2 provides pre-built binaries for Windows, Linux, and macOS. You no longer need to have Python installed in order to use the AWS CLI. You don't have to worry about compatible Python versions, virtual environments, or conflicting python packages.

How do you check if AWS CLI is configured?

Use the describe-configuration-recorder-status command to check that the AWS Config has started recording the configurations of the supported AWS resources existing in your account. The recorded configurations are delivered to the specified delivery channel.


Video Answer


1 Answers

I figured out the issue. I did pip install aws instead of pip install awscli.

We need to use the below command to install AWS CLI:

pip install awscli
like image 126
avinash Avatar answered Dec 02 '22 01:12

avinash