Last active
June 13, 2017 16:18
-
-
Save alekseyl/d4aafc089a770fbefd467eb1b306d7ef to your computer and use it in GitHub Desktop.
Chef switch recipe for green/blue deploy
This file contains hidden or 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
# 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