This repository has been archived by the owner on Sep 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from guardian/aa/scaling
Use simple scaling for easier testing
- Loading branch information
Showing
4 changed files
with
164 additions
and
76 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
CLOUDFORMATION_STACK_NAME=playground-CODE-scaling-asg-rolling-update | ||
|
||
POLICY_ARN=$( | ||
aws cloudformation describe-stacks \ | ||
--stack-name "$CLOUDFORMATION_STACK_NAME" \ | ||
--profile developerPlayground \ | ||
--region eu-west-1 \ | ||
--no-cli-pager | \ | ||
jq -r '.Stacks[].Outputs[] | select( [.OutputKey | contains("ScaleInArn") ] | any) | .OutputValue' | ||
) | ||
|
||
ASG_NAME=$( | ||
aws cloudformation describe-stacks \ | ||
--stack-name "$CLOUDFORMATION_STACK_NAME" \ | ||
--profile developerPlayground \ | ||
--region eu-west-1 \ | ||
--no-cli-pager | \ | ||
jq -r '.Stacks[].Outputs[] | select( [.OutputKey | contains("AutoscalingGroupName") ] | any) | .OutputValue' | ||
) | ||
|
||
CURRENT_DESIRED_CAPACITY=$( | ||
aws autoscaling describe-auto-scaling-groups \ | ||
--auto-scaling-group-names "$ASG_NAME" \ | ||
--profile developerPlayground \ | ||
--region eu-west-1 | \ | ||
jq -r '.AutoScalingGroups[].DesiredCapacity' | ||
) | ||
|
||
aws autoscaling execute-policy \ | ||
--policy-name "$POLICY_ARN" \ | ||
--profile developerPlayground \ | ||
--region eu-west-1 | ||
|
||
NEW_DESIRED_CAPACITY=$( | ||
aws autoscaling describe-auto-scaling-groups \ | ||
--auto-scaling-group-names "$ASG_NAME" \ | ||
--profile developerPlayground \ | ||
--region eu-west-1 | \ | ||
jq -r '.AutoScalingGroups[].DesiredCapacity' | ||
) | ||
|
||
echo "Desired capacity has been updated from $CURRENT_DESIRED_CAPACITY to $NEW_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
CLOUDFORMATION_STACK_NAME=playground-CODE-scaling-asg-rolling-update | ||
|
||
POLICY_ARN=$( | ||
aws cloudformation describe-stacks \ | ||
--stack-name "$CLOUDFORMATION_STACK_NAME" \ | ||
--profile developerPlayground \ | ||
--region eu-west-1 \ | ||
--no-cli-pager | \ | ||
jq -r '.Stacks[].Outputs[] | select( [.OutputKey | contains("ScaleOutArn") ] | any) | .OutputValue' | ||
) | ||
|
||
ASG_NAME=$( | ||
aws cloudformation describe-stacks \ | ||
--stack-name "$CLOUDFORMATION_STACK_NAME" \ | ||
--profile developerPlayground \ | ||
--region eu-west-1 \ | ||
--no-cli-pager | \ | ||
jq -r '.Stacks[].Outputs[] | select( [.OutputKey | contains("AutoscalingGroupName") ] | any) | .OutputValue' | ||
) | ||
|
||
CURRENT_DESIRED_CAPACITY=$( | ||
aws autoscaling describe-auto-scaling-groups \ | ||
--auto-scaling-group-names "$ASG_NAME" \ | ||
--profile developerPlayground \ | ||
--region eu-west-1 | \ | ||
jq -r '.AutoScalingGroups[].DesiredCapacity' | ||
) | ||
|
||
aws autoscaling execute-policy \ | ||
--policy-name "$POLICY_ARN" \ | ||
--profile developerPlayground \ | ||
--region eu-west-1 | ||
|
||
NEW_DESIRED_CAPACITY=$( | ||
aws autoscaling describe-auto-scaling-groups \ | ||
--auto-scaling-group-names "$ASG_NAME" \ | ||
--profile developerPlayground \ | ||
--region eu-west-1 | \ | ||
jq -r '.AutoScalingGroups[].DesiredCapacity' | ||
) | ||
|
||
echo "Desired capacity has been updated from $CURRENT_DESIRED_CAPACITY to $NEW_DESIRED_CAPACITY" |