System Operations on AWS - Lab 6W - Using Auto Scaling (Windows)

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

1. 创建你的AMI

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

System Operations on AWS - Lab 6W - Using Auto Scaling (Windows)_第1张图片

1.2 创建一个安全组

1.3 登陆到CommandHost实例

System Operations on AWS - Lab 6W - Using Auto Scaling (Windows)_第2张图片

1.4.1 创建新的EC2实例

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

1.4.2 监控该新建EC2实例状态

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

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

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

1.4.4 使用PowerShell脚本测试web server

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

System Operations on AWS - Lab 6W - Using Auto Scaling (Windows)_第3张图片

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

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

System Operations on AWS - Lab 6W - Using Auto Scaling (Windows)_第4张图片

2. 创建Auto Scaling环境

2.1 创建一个load balancer

System Operations on AWS - Lab 6W - Using Auto Scaling (Windows)_第5张图片

2.2 创建一个启动配置

System Operations on AWS - Lab 6W - Using Auto Scaling (Windows)_第6张图片

System Operations on AWS - Lab 6W - Using Auto Scaling (Windows)_第7张图片

2.3 创建一个Auto Scaling group

System Operations on AWS - Lab 6W - Using Auto Scaling (Windows)_第8张图片

System Operations on AWS - Lab 6W - Using Auto Scaling (Windows)_第9张图片

2.4 设置scale-out策略

System Operations on AWS - Lab 6W - Using Auto Scaling (Windows)_第10张图片

System Operations on AWS - Lab 6W - Using Auto Scaling (Windows)_第11张图片

System Operations on AWS - Lab 6W - Using Auto Scaling (Windows)_第12张图片

System Operations on AWS - Lab 6W - Using Auto Scaling (Windows)_第13张图片

2.5 设置scale-in策略

System Operations on AWS - Lab 6W - Using Auto Scaling (Windows)_第14张图片

System Operations on AWS - Lab 6W - Using Auto Scaling (Windows)_第15张图片

System Operations on AWS - Lab 6W - Using Auto Scaling (Windows)_第16张图片

2.6 完成Auto Scaling group的创建

2.7 确认该Auto Scaling配置

System Operations on AWS - Lab 6W - Using Auto Scaling (Windows)_第17张图片

System Operations on AWS - Lab 6W - Using Auto Scaling (Windows)_第18张图片

System Operations on AWS - Lab 6W - Using Auto Scaling (Windows)_第19张图片

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

点击Start Stress

System Operations on AWS - Lab 6W - Using Auto Scaling (Windows)_第20张图片

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

你可能感兴趣的:(System Operations on AWS - Lab 6W - Using Auto Scaling (Windows))