Skip to content

Instantly share code, notes, and snippets.

@mryoshio
Created January 30, 2015 09:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mryoshio/a242ff9852922b0f016c to your computer and use it in GitHub Desktop.
Save mryoshio/a242ff9852922b0f016c to your computer and use it in GitHub Desktop.
update OpsWorks Layers' enable_auto_healing
require 'aws-sdk'
TO=false
def main
client = AWS::OpsWorks::Client.new(region: 'us-east-1')
client.describe_stacks[:stacks].each do |s|
puts "## #{s[:stack_id]}: #{s[:name]}"
puts "##### [begin] at #{Time.now}"
client.describe_layers(stack_id: s[:stack_id])[:layers].each do |l|
client.update_layer(layer_id: l[:layer_id], enable_auto_healing: TO)
print "- #{l[:name]}(#{l[:layer_id]}): "
puts "#{l[:enable_auto_healing]} to #{TO}"
end
puts "##### [finished] at #{Time.now}"
end
end
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment