AWS CLI创建ec2实例UnicodeEncodeError

时间:2017-07-10 16:06:52

标签: amazon-web-services aws-cli

我正在尝试使用此命令使用AWS控制台工具创建新的EC2实例:

aws ec2 run-instances --image-id ami-9abea4fb --count 1 –-instance-type t2.micro --key-name my_key_name --security-group-ids my_rule --region us-west-2

但我一直收到这个错误。

Traceback (most recent call last):
  File "/usr/local/bin/aws", line 27, in <module>
    sys.exit(main())
  File "/usr/local/bin/aws", line 23, in main
    return awscli.clidriver.main()
  File "/Users/davesmith/Library/Python/2.7/lib/python/site-packages/awscli/clidriver.py", line 56, in main
    return driver.main()
  File "/Users/davesmith/Library/Python/2.7/lib/python/site-packages/awscli/clidriver.py", line 203, in main
    sys.stderr.write(str(e))
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2013' in position 27: ordinal not in range(128)

1 个答案:

答案 0 :(得分:2)

-参数中的第一个--instance-type是某种unicode破折号。字体可以掩盖这一点,但是当我手动将其编辑为减号时,它会起作用。