質問

I am trying to perform auto scaling on Amazon EC2 with below commands:

elb-create-lb nalb1 --headers --listener "lb-port=80,instance-port=80,protocol=http" --availability-zones us-east-1c  

elb-register-instances-with-lb nalb1 --headers --instances i-1ecef57c  

elb-configure-healthcheck nalb1 --headers --target "HTTP:80/" --interval 30 --timeout 3 --unhealthy-threshold 2 --healthy-threshold 10  

as-create-launch-config nalc1 --image-id ami-cdd306a4 --instance-type t1.micro  

as-create-auto-scaling-group naasg1 --launch-configuration nalc1 --availability-zones us-east-1c --min-size 0 --max-size 10 --load-balancers nalb1  
as-put-scaling-policy --auto-scaling-group naasg1 --name policy-scaleup --adjustment 100 --type PercentChangeInCapacity  
as-put-scaling-policy --auto-scaling-group naasg1 --name policy-scaledown --adjustment=-1 --type ChangeInCapacity  

as-create-or-update-trigger nat1 \  
--auto-scaling-group naasg1 --namespace "AWS/EC2" \  
--measure CPUUtilization --statistic Average \  
--dimensions "AutoScalingGroupName=naasg1" \  
--period 60 --lower-threshold 30 --upper-threshold 60 \  
--lower-breach-increment=-1 --upper-breach-increment=1 \  
--breach-duration 120  

The following commands describe the status of various parameters once the above commands are hit.

root@domU-12-31-39-09-B8-12 ~# elb-describe-lbs  
LOAD_BALANCER nalb1 nalb1-1717211844.us-east-1.elb.amazonaws.com 2012-01-24T09:45:11.440Z  
root@domU-12-31-39-09-B8-12 ~# as-describe-launch-configs  
LAUNCH-CONFIG nalc1 ami-cdd306a4 t1.micro  
root@domU-12-31-39-09-B8-12 ~# as-describe-auto-scaling-groups  
AUTO-SCALING-GROUP naasg1 nalc1 us-east-1c nalb1 0 10 0  
root@domU-12-31-39-09-B8-12 ~# as-describe-policies  
No policies found  
root@domU-12-31-39-09-B8-12 ~# as-describe-triggers --auto-scaling-group naasg1  
DEPRECATED: This command is deprecated and included only to facilitate migration to the new trigger mechanism. You should use this command for migration purposes only.  
TRIGGER nat1 naasg1 NoData AWS/EC2 CPUUtilization Average 60  
root@domU-12-31-39-09-B8-12 ~#  

Despite all these, auto scaling is not happening
What might be the reason?

Thanks for help

役に立ちましたか?

解決

The below command worked :)

elb-create-lb nalb1 --headers --listener "lb-port=80,instance-port=80,protocol=http" --availability-zones us-east-1c

elb-register-instances-with-lb nalb1 --headers --instances i-1ecef57c

elb-configure-healthcheck nalb1 --headers --target "HTTP:80/" --interval 30 --timeout 3 --unhealthy-threshold 2 --healthy-threshold 10

as-create-launch-config nalc1 --image-id ami-cdd306a4 --instance-type t1.micro

as-create-auto-scaling-group naasg1 --launch-configuration nalc1 --availability-zones us-east-1c --min-size 2 --max-size 10 --load-balancers nalb1
as-put-scaling-policy --auto-scaling-group naasg1 --name policy-scaleup --adjustment=2 --type ChangeInCapacity
as-put-scaling-policy --auto-scaling-group naasg1 --name policy-scaledown --adjustment=-1 --type ChangeInCapacity
as-set-desired-capacity naasg1 -c 2

Of course you need to create alarms on CloudWatch and associate these policies to two alarms, each handling step up and step down.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top