File tree Expand file tree Collapse file tree 4 files changed +13
-3
lines changed Expand file tree Collapse file tree 4 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -46,5 +46,10 @@ To use these scripts in your own application:
46461 . Copy the ` .sh ` files in this directory into your application source.
47471 . Edit your application's ` appspec.yml ` to run ` deregister_from_elb.sh ` on the ApplicationStop event,
4848and ` register_with_elb.sh ` on the ApplicationStart event.
49+ 1 . If your instance is not in an Auto Scaling Group,
50+ edit ` common_functions.sh ` to set ` ELB_LIST ` to contain the name(s) of the Elastic Load
51+ Balancer(s) your deployment group is a part of. Make sure the entries in ELB_LIST are separated by space.
52+ Alternatively, you can set ` ELB_LIST ` to ` all ` to automatically use all load balancers the instance is
53+ registered to.
49541 . Deploy!
5055
Original file line number Diff line number Diff line change 1515
1616# ELB_LIST defines which Elastic Load Balancers this instance should be part of.
1717# The elements in ELB_LIST should be separated by space.
18+ # Set to "all" to automatically find all load balancers the instance is registered to.
1819ELB_LIST=" "
1920
2021# Under normal circumstances, you shouldn't need to change anything below this line.
Original file line number Diff line number Diff line change 5050
5151msg " Instance is not part of an ASG, continuing..."
5252
53- msg " Checking that user set at least one load balancer"
54- if test -z " $ELB_LIST " ; then
53+ if [ " ${ELB_LIST} " = all ]; then
5554 msg " Finding all the ELBs that this instance is registered to"
5655 get_elb_list $INSTANCE_ID
5756 if [ $? != 0 ]; then
@@ -60,6 +59,11 @@ if test -z "$ELB_LIST"; then
6059 echo " $ELB_LIST " > /tmp/elblist
6160fi
6261
62+ msg " Checking that user set at least one load balancer"
63+ if test -z " $ELB_LIST " ; then
64+ error_exit " Must have at least one load balancer to deregister from"
65+ fi
66+
6367# Loop through all LBs the user set, and attempt to deregister this instance from them.
6468for elb in $ELB_LIST ; do
6569 msg " Checking validity of load balancer named '$elb '"
Original file line number Diff line number Diff line change 5151msg " Instance is not part of an ASG, continuing..."
5252
5353msg " Checking that user set at least one load balancer"
54- if test -z " $ ELB_LIST" ; then
54+ if [ " ${ ELB_LIST} " = all ] ; then
5555 if [ -a /tmp/elblist ]; then
5656 msg " Finding all the ELBs that this instance was previously registered to"
5757 read ELB_LIST < /tmp/elblist
You can’t perform that action at this time.
0 commit comments