Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS CLI returning "unknown option" on run-instances

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:

aws ec2 run-instances --image-id ami-xxxxxxxxxx  --security-group-ids sg-ef95c791 --count 1 --instance-type m4.2xlarge --key-name mypemkey --query Reservations[*].Instances[*].[PublicIpAddress,InstanceId]

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

like image 499
Mattehicks Avatar asked May 17 '17 21:05

Mattehicks


People also ask

Why am I getting command not found when I run AWS?

I get the error "command not found" when I run aws. Possible cause: The operating system "path" was not updated during installation. This error means that the operating system can't find the AWS CLI program.

How do I debug an AWS CLI error?

One of the first things you should do when the AWS CLI reports an error that you don't immediately understand, or produces results that you don't expect, is get more detail about the error. You can do this by running the command again and including the --debug option at the end of the command line.

What is instance market options in AWS?

--instance-market-options (structure) The market (purchasing) option for the instances. For RunInstances , persistent Spot Instance requests are only supported when InstanceInterruptionBehavior is set to either hibernate or stop .

Why am I getting'no Windows Console found'when using aws cli?

When you use a AWS CLI command, you receive a "No Windows console found. Are you running cmd.exe?" error message. This is usually due to the Python prompt_toolkit you have installed being outdated.


1 Answers

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.

like image 153
Jonathan Voss Avatar answered Oct 01 '22 07:10

Jonathan Voss