Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to use knife ec2 server create to automatically launch ec2 instances for the first time, but I'm getting "ERROR: Excon::Errors::BadRequest: Expected(200) <=> Actual(400 Bad Request)".

When using knife ec2 server list the list of existing servers is returned, which means the AWS IDs in .chef/knife.rb are correct.

I checked AMI ID using Ubuntu's AMI Finder, and tried different combinations of all other parameters, so can't figure out what's wrong.

I'm using is:

knife ec2 server create \
    -r "role[memcached]" -I ami-d0f89fb9 -f m1.small \
    -i mysshkey.pem --ssh-user newuser \
    --region us-east-1b -Z us-east-1b

(there is a Chef role called memcached, there's a file in the local directory called mysshkey.pem)

Environment: Win7, Git 1.8.1.msysgit.1, Chef/Knife 11.4.4. I will try later doing the same from a Linux workstation, so I can isolate if the problem is the environment, or paramenters, or AWS credentials.

Any idea how to troubleshoot knife ec2 scripts?

share|improve this question
    
Just as a random aside, you will also see that same error if you hit your EC2 instance cap like I just did. –  MattC Jul 11 '13 at 3:24

2 Answers 2

up vote 2 down vote accepted

I finally found the problem.

The parameter -i <AWS_SSH_ID> is not used to specify the SSH key itself, but the security name of the SSH Pair Key used when you created your credentials within AWS.

After adjusting this, knife ec2 create started to work properly.

share|improve this answer

us-east-1b is not a valid EC2 region. Try us-east-1.

share|improve this answer
    
Same thing. Also tried using Knife under ubuntu 13.04, and exact same error. –  Gui Ambros May 23 '13 at 4:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.