AWS CLI returning “unknown option” on run-instances

Question:

Executing query:

aws ec2 run-instances --image-id ami-7a85a01a --security-group-ids sg-756ae512 --count 1 --instance-type t2.micro --tag-specifications ResourceType=instance,Tags=[{Key=webserver,Value=production}] --subnet-id subnet-cc0b0e8a

Its throwing an error saying:

Unknown options: --tag-specifications, ResourceType=instance,Tags=[{Key=webserver,Value=production}]

Does anybody know if this is depricated, or is the syntax different from expected? I’ve been running in circles with this.

Possible solution with new syntax:

The best I can come up with, seems to be working:

aws ec2 run-instances --image-id ami-7a85a01a --count 1 --instance-type t2.micro --key-name mykeypair --subnet-id sn-756ae512 --tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=production}]' --associate-public-ip-address --output=text

Answer:

I ran into this issue today and figured it out after an hour or so of struggling through the infamously horrendous AWS documentation.

The problem was that the installation instructions (pip install and using the bundled installer) are just wrong: though the commands were copied perfectly and the requirements (specifically the “Python 2 version 2.6.5+ or Python 3 version 3.3+”) were met, the aws-cli package would never install/update past 1.11.13.

The solution: use pip3 install instead of pip install. This updated it to 1.11.97, which enabled the --tag-specifications parameter. I don’t know if this will solve the problem for you, but I suspect many Ubuntu users will experience this, so I decided to post it anyway.

Leave a Reply