Skip to content

Instantly share code, notes, and snippets.

@viviandarkbloom
Created February 21, 2012 06:01
Show Gist options
  • Save viviandarkbloom/1874110 to your computer and use it in GitHub Desktop.
Save viviandarkbloom/1874110 to your computer and use it in GitHub Desktop.
Get data about AWS instances
require 'rubygems'
require 'yaml'
require 'right_aws'
connect = File.open('./cred.yml')
creds = YAML.load(connect)
aws_access_key_id = creds["Credentials"]["aws_access_key_id"]
aws_secret_access_key = creds["Credentials"]["aws_secret_access_key"]
@ec2 = RightAws::Ec2.new(aws_access_key_id, aws_secret_access_key)
servers = @ec2.describe_instances.to_yaml
File.open('./servers.yml','w') do |file|
file.write (servers)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment