首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >亚马逊EC2上未发生自动伸缩

亚马逊EC2上未发生自动伸缩
EN

Stack Overflow用户
提问于 2012-01-25 17:55:32
回答 1查看 959关注 0票数 1

我正在尝试使用以下命令在亚马逊EC2上执行自动伸缩:

代码语言:javascript
复制
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  

以下命令描述了命中上述命令后各参数的状态。

代码语言:javascript
复制
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 ~#  

尽管如此,自动伸缩并没有发生

可能的原因是什么?

感谢你的帮助

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-01-27 18:47:31

以下命令起作用了:)

代码语言:javascript
复制
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

当然,您需要在CloudWatch上创建告警,并将这些策略与两个告警相关联,每个告警的处理都是逐步递增和递减的。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/9000673

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档