Created
November 16, 2018 03:49
-
-
Save pahud/535998b275f28ab5d6b915ae51eee015 to your computer and use it in GitHub Desktop.
Create Autoscaling Group with more instance types and purchase options
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
#!/bin/bash | |
# make sure your awscli version is >= 1.16.56 | |
# | |
# 1. create a launch template and copy the LaunchTemplateId | |
# 2. create mix-policy.json | |
# 3. run create-asg.sh | |
# | |
# by [email protected] | |
asgname=demo | |
aws autoscaling create-auto-scaling-group \ | |
--auto-scaling-group-name=$asgname \ | |
--min-size=2 \ | |
--desired-capacity=8 \ | |
--max-size=10 \ | |
--vpc-zone-identifier=subnet-01afddf2fa02affaf,subnet-052e393860f11bde9,subnet-0be531a55836fef9c \ | |
--mixed-instances-policy=file://mix-policy.json |
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
{ | |
"LaunchTemplate": { | |
"LaunchTemplateSpecification": { | |
"LaunchTemplateId": "lt-0bc5d3f873b573e3c" | |
}, | |
"Overrides": [ | |
{ | |
"InstanceType": "t3.small" | |
}, | |
{ | |
"InstanceType": "t3.medium" | |
}, | |
{ | |
"InstanceType": "t3.large" | |
}, | |
{ | |
"InstanceType": "t3.xlarge" | |
} | |
] | |
}, | |
"InstancesDistribution": { | |
"OnDemandAllocationStrategy": "prioritized", | |
"OnDemandBaseCapacity": 2, | |
"OnDemandPercentageAboveBaseCapacity": 0, | |
"SpotAllocationStrategy": "lowest-price", | |
"SpotInstancePools": 10 | |
} | |
} |
Author
pahud
commented
Nov 16, 2018
Thanks! You have saved me from figuring that out myself.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment