ssh ubuntu@<IP Supplied by the Instructor> (password opstrain_0150)
mkdir -p ~/chef-repo/.chef
From your Client box copy your Key and config files
scp *.pem ubuntu@ec2-?????.com:~
scp .pem ubuntu@ec2-?????.com:~
| require 'net/ssh/multi' | |
| require 'fog' | |
| require 'yaml' | |
| require 'optparse' | |
| options = {} | |
| optparse = OptionParser.new do |opts| | |
| opts.banner = "Usage: audit.rb [options]" |
| source "http://rubygems.org" | |
| gem 'fog' |
| server_data = compute.create_server( | |
| 1, | |
| 49 | |
| ).body['server'] | |
| until compute.get_server_details( | |
| server_data['id'] | |
| ).body['server']['status'] == 'ACTIVE' | |
| end |
| #!/usr/bin/env ruby | |
| # Require gems with versions | |
| begin | |
| require 'logger' | |
| require 'rubygems' | |
| gem 'fog', '~> 0.6.0' | |
| gem 'trollop', '~> 1.16.2' | |
| require 'fog'; require 'trollop' |
| require 'fog' | |
| require 'chef/knife/ec2_server_create' | |
| connection = Fog::AWS::Compute.new( | |
| :aws_access_key_id => Chef::Config[:knife][:aws_access_key_id], | |
| :aws_secret_access_key => Chef::Config[:knife][:aws_secret_access_key], | |
| :region => Chef::Config[:knife][:region] | |
| ) | |
| server = connection.servers.create( |
| # -*- ruby -*- | |
| # Needs following parameters configured in rake.rb: | |
| # DNS_DOMAIN: domain for which to set entries, including trailing dot | |
| # (e.g. "example.com.") | |
| # DNS_ATTRIBUTE: attribute containing hostname to CNAME to, defaults | |
| # to 'fqdn'; for EC2, use "ec2.public_hostname" | |
| # DNS_ENTRIES: hash mapping hostname to node search query, | |
| # e.g. {'buildbot' => 'recipes:buildbot', 'monitoring' => | |
| # 'roles:monitoring'} |
| # references | |
| # http://wiki.opscode.com/display/chef/Chef+Repository | |
| # http://blog.ibd.com/howto/deploy-wordpress-to-amazon-ec2-micro-instance-with-opscode-chef/ | |
| # on laptop | |
| $ sudo gem install chef | |
| $ sudo gem install net-ssh net-ssh-multi highline fog | |
| $ mkdir ~/git | |
| $ cd ~/git |
| # First install tmux | |
| brew install tmux | |
| # For mouse support (for switching panes and windows) | |
| # Only needed if you are using Terminal.app (iTerm has mouse support) | |
| Install http://www.culater.net/software/SIMBL/SIMBL.php | |
| Then install https://bitheap.org/mouseterm/ | |
| # More on mouse support http://floriancrouzat.net/2010/07/run-tmux-with-mouse-support-in-mac-os-x-terminal-app/ |