Skip to content

Instantly share code, notes, and snippets.

@pete911
Last active January 4, 2016 19:09
Show Gist options
  • Save pete911/8665037 to your computer and use it in GitHub Desktop.
Save pete911/8665037 to your computer and use it in GitHub Desktop.
chef - knife-ec2 setup
--- install rvm ---
# get and execute rvm and source it
curl -sSL https://get.rvm.io | bash -s stable
source .rvm/scripts/rvm
# install ruby 2.1.0 and use it
rvm install ruby-2.1.0
rvm use 2.1.0
--- install chef and knife-ec2 ---
# install chef and ec2 knife
gem install chef
gem install knife-ec2
# add aws access key and secret key to your .profile
<~/.profile>
...
export AWS_ACCESS_KEY_ID="..."
export AWS_SECRET_ACCESS_KEY="..."
...
source ~/.profile
# create knife config and add aws credentials
mkdir ~/.chef
touch ~/.chef/knife.rb
<~/.chef/knife.rb>
knife[:aws_access_key_id] = ENV['AWS_ACCESS_KEY_ID']
knife[:aws_secret_access_key] = ENV['AWS_SECRET_ACCESS_KEY']
--- using knife ec2 ---
'knife ec2 server list -A <access-key-id> -K <secret-access-key> --region <region>'
Where access key id and secret access key can be found in aws console. Region is the availability zone where the instance(s) is running. Ex: us-west-2
(https://github.com/opscode/knife-ec2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment