+86 13541016684Mon. - Fri. 10:00-22:00

System Operations on AWS – Using Auto Scaling (Windows)教程

System Operations on AWS - Using Auto Scaling (Windows)教程

System Operations on AWS – Using Auto Scaling (Windows)教程

582266-20160306114448768-76489476

创建你的一个web server,然后将这个实例制成你的AMI,通过启动配置生成一个Auto Scaling组(包括scale-in/scale-out策略),配置一台Load Balancer指向你的Auto Scaling组

1. 创建你的AMI

1.1 获得密钥对名称,AMI ID,子网ID的信息

582266-20160306115547174-1015999641

1.2 创建一个安全组

582266-20160306115912440-434406125

582266-20160306121939971-1082163020

1.3 登陆到CommandHost实例

582266-20160306120052205-1767600881

1.4.1 创建新的EC2实例

1
aws ec2 run-instances --key-name qwikLABS-L1042-414119 --instance-type t2.micro --image-id ami-df8767bf --user-data file://c:\temp\UserData.txt --security-group-ids sg-51de5f36 --subnet-id subnet-ec617c9b --associate-public-ip-address

582266-20160306122436315-2023027128

1.4.2 监控该新建EC2实例状态

1
aws ec2 describe-instance-status --instance-id i-1849cec0

1.4.3 显示该实例的公共DNS名称

1
aws ec2 describe-instances --instance-id i-1849cec0 --query 'Reservations[0].Instances[0].NetworkInterfaces[0].Association.PublicDnsName'

582266-20160306122812268-1787021714

1.4.4 使用PowerShell脚本测试web server

1
(new-object net.webclient).DownloadString('http://ec2-52-10-69-251.us-west-2.compute.amazonaws.com/stressapp/Default')

582266-20160306123059987-1679222417

1.5 根据该实例来创建你的AMI

1
aws ec2 create-image --name WebServer --instance-id i-1849cec0

582266-20160306123354268-2136581731

582266-20160306123809002-155811672

2. 创建Auto Scaling环境

2.1 创建一个load balancer

582266-20160306124304674-1626727762

582266-20160306124316674-872171666

582266-20160306124611268-506670661

582266-20160306124618315-1396905775

582266-20160306124757705-1236212201

582266-20160306125103018-1880836264

582266-20160306125302455-1531025374

582266-20160306125312018-1751194614

582266-20160306125900221-159847430

2.2 创建一个启动配置

582266-20160306130223237-499902947

582266-20160306130231580-1869684751

582266-20160306130334518-455039661

582266-20160306130420299-1531199835

582266-20160306130459674-2096857620

582266-20160306130734815-1990819376

582266-20160306130746049-363039567

582266-20160306130859674-1060945555

582266-20160306131021721-1792250953

2.3 创建一个Auto Scaling group

582266-20160306133014065-1187703672

582266-20160306133026440-18755570

582266-20160306133416299-1485661613

2.4 设置scale-out策略

582266-20160306133529393-934332986

582266-20160306133720752-1185583587

582266-20160306133919237-1814772300

582266-20160306134006518-1594938966

2.5 设置scale-in策略

582266-20160306134149862-497415058

582266-20160306134304190-1503557366

582266-20160306134341549-1222877144

582266-20160306134415409-2019127624

2.6 完成Auto Scaling group的创建

582266-20160306134525690-436234601

582266-20160306134603877-1056838453

2.7 确认该Auto Scaling配置

582266-20160306135133096-1119086419

582266-20160306135141784-1342711609

582266-20160306135350393-913504505

在本地访问http://webserverloadbalancer-93038626.us-west-2.elb.amazonaws.com/stressapp/Default

582266-20160306135400268-2114484848

点击Start Stress

582266-20160306135524034-1650879868

在该Auto Scaling group的活动历史记录中发现scale-out策略生效,一台新实例被自动创建了

582266-20160306135810065-1587310742