Here is an example of creating an auto scaling group using the new CLI:
aws autoscaling create-launch-configuration --launch-configuration-name NiravTestASconfig --image-id ami-35792c5c --security-groups NiravTestSecGrp --instance-type t1.micro --key-name niravkothariaws
aws autoscaling create-launch-configuration --launch-configuration-name NiravTestASconfig --image-id ami-35792c5c --security-groups NiravTestSecGrp --instance-type t1.micro --key-name niravkothariaws
aws autoscaling create-auto-scaling-group --auto-scaling-group-name NiravTestASGrp --launch-configuration-name NiravTestASconfig --min-size 2 --max-size 4 --default-cooldown 300 --load-balancer-names NiravTestELB --tags Key=Name,Value=CreatedBYAS --availability-zones us-east-1c --termination-policies NewestInstance
ADDARN=`aws autoscaling put-scaling-policy --auto-scaling-group-name NiravTestASGrp --policy-name NiravTestADDPolicy --scaling-adjustment +1 --adjustment-type ChangeInCapacity --cooldown 300 | grep -i "PolicyARN" | awk '{print $2}' | sed 's/"//g’`
DELARN=`aws autoscaling put-scaling-policy --auto-scaling-group-name NiravTestASGrp --policy-name NiravTestDELPolicy --scaling-adjustment -1 --adjustment-type ChangeInCapacity --cooldown 300 | grep -i "PolicyARN" | awk '{print $2}' | sed 's/"//g'`
echo ARN for scale-up policy $ADDARN
echo ARN for scale-down policy $DELARN
aws autoscaling put-notification-configuration --auto-scaling-group-name NiravTestASGrp --topic-arn arn:aws:sns:us-east-1:228152208343:niravtestsns --notification-types autoscaling:EC2_INSTANCE_LAUNCH autoscaling:EC2_INSTANCE_TERMINATE
sleep 10s
No comments:
Post a Comment