Skip to content

Instantly share code, notes, and snippets.

@Partyschaum
Created July 9, 2014 08:37
Show Gist options
  • Save Partyschaum/8638bc9b79cc3c7cd970 to your computer and use it in GitHub Desktop.
Save Partyschaum/8638bc9b79cc3c7cd970 to your computer and use it in GitHub Desktop.
AWS playground
require 'aws-sdk'
require 'awesome_print'
ACCESS_KEY_ID = 'xxx'
SECRET_ACCESS_KEY = 'xxx'
REGION = 'eu-west-1'
ENVIRONMENT_NAME = 'xxx'
# configure access
AWS.config access_key_id: ACCESS_KEY_ID, secret_access_key: SECRET_ACCESS_KEY, region: REGION
#ec2 = AWS.ec2
#ec2.regions.map(&:name).each { |name| puts name }
beanstalk = AWS.elastic_beanstalk
eb_client = beanstalk.client
eb_client.request_environment_info info_type: 'tail', environment_name: ENVIRONMENT_NAME
result = eb_client.retrieve_environment_info info_type: 'tail', environment_name: ENVIRONMENT_NAME
result.environment_info.each do |info|
puts "info type: #{info.info_type}"
puts "ec2 instance id: #{info.ec2_instance_id}"
puts "sample timestamp: #{info.sample_timestamp}"
puts "name: #{info.name}"
puts "batch id: #{info.batch_id}"
puts "message: #{info.message}"
puts "##########################################################"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment