1

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?

Gui Ambros
  • 1,339
  • 2
  • 13
  • 17
  • 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 03:24

2 Answers2

2

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.

Gui Ambros
  • 1,339
  • 2
  • 13
  • 17
1

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

EEAA
  • 109,363
  • 18
  • 175
  • 245