Last active
April 10, 2019 09:35
-
-
Save fmasuhr/b8d561a61411ab80a0ad to your computer and use it in GitHub Desktop.
Get configuration for all "rails-app" OpsWorks Layer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'aws-sdk-opsworks' | |
client = Aws::OpsWorks::Client.new(region: 'us-east-1') | |
stacks = client.describe_stacks.stacks | |
layers = stacks.map { |stack| client.describe_layers(stack_id: stack.stack_id).layers }.compact | |
rails_app_layers = layers.detect { |layer| layer.shortname == 'rails-app' } | |
rails_app_layers.each do |layer| | |
stack = stacks.detect { |stack| stack.stack_id == layer.stack_id } | |
puts <<-END_OF_STRING | |
#{stack.name} | |
https://console.aws.amazon.com/opsworks/home#/stack/#{layer.stack_id}/layers/#{layer.layer_id}/general | |
Ruby version: #{layer.attributes['RubyVersion']} | |
Passenger version: #{layer.attributes['PassengerVersion']} | |
RubyGems version: #{layer.attributes['RubygemsVersion']} | |
Bundler version: #{layer.attributes['BundlerVersion']} | |
END_OF_STRING | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment