Skip to content

Instantly share code, notes, and snippets.

@glarizza
Created January 15, 2012 02:43
Show Gist options
  • Save glarizza/1614020 to your computer and use it in GitHub Desktop.
Save glarizza/1614020 to your computer and use it in GitHub Desktop.
Launching an instance in EC2 with Cloud Provisioner
## Launching an instance in EC2
└(~)▷ irb
>> require 'puppet/face'
=> true
>> arguments = { 'image' => 'ami-1bd68a5e', 'keyname' => 'gary_test', 'type' => 't1.micro', 'region' => 'us-west-1' }
=> {"region"=>"us-west-1", "keyname"=>"gary_test", "type"=>"t1.micro", "image"=>"ami-1bd68a5e"}
>> ec2_ip = Puppet::Face[:node_aws, :current].create(arguments)
#######################
=> "ec2-184-72-21-49.us-west-1.compute.amazonaws.com"
## Want to install Puppet Enterprise?
>> install_args = { 'login' => 'ec2-user', 'keyfile' => '/path/to/gary_test.pem', 'install_script' => 'puppet-enterprise-http', 'installer_payload' => 'http://pm.puppetlabs.com/puppet-enterprise/2.0/puppet-enterprise-2.0-el-6-x86_64.tar.gz', 'installer_answers' => '/path/to/pe-answers-agent.txt' }
=> {"installer_payload"=>"http://pm.puppetlabs.com/puppet-enterprise/2.0/puppet-enterprise-2.0-el-6-x86_64.tar.gz", "keyfile"=>"/path/to/gary_test.pem", "install_script"=>"puppet-enterprise-http", "login"=>"ec2-user", "installer_answers"=>"/path/to/pe-answers-agent.txt"}
>> install_node = Puppet::Face[:node, :current].install(ec2_ip, install_args)
## SSH into the instance
└(~)▷ssh -i /path/to/gary_test.pem [email protected]
@jamtur01
Copy link

Nice :)

@glarizza
Copy link
Author

I'm kind-of blown away how easy this is. Really.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment