-
Notifications
You must be signed in to change notification settings - Fork 266
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Terminate the instance directly rather than mark it unhealthy
This will allow us to have more control over the timing and capacity of the ASG. Signed-off-by: Tom Duffield <tom@chef.io>
- Loading branch information
Showing
5 changed files
with
27 additions
and
11 deletions.
There are no files selected for viewing
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
if [[ "${1:-false}" == "true" ]] ; then | ||
should_decrement="should" | ||
else | ||
should_decrement="no-should" | ||
fi | ||
|
||
instance_id=$(curl -fsSL http://169.254.169.254/latest/meta-data/instance-id) | ||
region=$(curl -fsSL http://169.254.169.254/latest/meta-data/placement/availability-zone | head -c -1) | ||
|
||
aws autoscaling terminate-instance-in-auto-scaling-group --region "$region" --instance-id "$instance_id" "--${should_decrement}-decrement-desired-capacity" |
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
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