Skip to content

Instantly share code, notes, and snippets.

@alekseyl
Last active June 13, 2017 16:18
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 alekseyl/d4aafc089a770fbefd467eb1b306d7ef to your computer and use it in GitHub Desktop.
Save alekseyl/d4aafc089a770fbefd467eb1b306d7ef to your computer and use it in GitHub Desktop.
Chef switch recipe for green/blue deploy
# in order to access ENV you need to include your env recipe
include_recipe 'application::env'
chef_gem 'aws-sdk' do
version '2.7.9'
end
require 'aws-sdk'
owc = Aws::OpsWorks::Client.new( region: 'us-east-1' )
owc.detach_elastic_load_balancer( elastic_load_balancer_name: ENV['ELB_NAME'], layer_id: ENV['SWITCH_ELB_FROM'] )
owc.attach_elastic_load_balancer( elastic_load_balancer_name: ENV['ELB_NAME'], layer_id: ENV['SWITCH_ELB_TO'] )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment