Setting up knife ec2

I keep getting Fog::Compute::AWS::NotFound: The key pair ... does not exist error!

How to solve this problem isn’t explained well enough anywhere.

Install knife-ec2 first:

sudo gem install knife-ec2

Then I added this to my knife.rb:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# key name, as defined in EC2 Key Pairs,
# this value has to be exactly the same as the one in the management console:
knife[:aws_ssh_key_id]        = "my-ec2-key"

# AWS ID/SECRET:
knife[:aws_access_key_id]     = "..."
knife[:aws_secret_access_key] = "..."

# Some defaults
knife[:region]                = "eu-west-1"
knife[:availability_zone]     = "eu-west-1a"
knife[:ssh_user]              = "ubuntu"
knife[:flavor]                = "m1.medium"
# Ubuntu 12.04 LTS 64bit:
knife[:image]                 = "ami-f2191786"
knife[:use_sudo]              = "true"

As I was trying to create an instance with this command:

DevOps box

{% include collecttags.html %}

I was asked to build a box with all the monitoring tools required. Chef, Logstash, Ganglia and Monit were selected. Here’s a core dump.

In this post I’m going to describe how to setup a box containing following elements: