- 延伸 PART.3 加上 Autoscaling 來增減 instances
- 用 stress.php 增加 instances 的 loading
-
Region:Oregon (us-west-2)
-
Network
-
VPC
- CIDR:10.128.0.0/16
-
Internet Gateways
-
Subnet
- public-2a
- CIDR:10.128.11.0/24
- public-2b
- CIDR:10.128.21.0/24
- private-2a
- CIDR:10.128.12.0/24
- private-2b
- CIDR:10.128.22.0/24
- public-2a
-
Internet Gateways
-
NAT Gateway
- select public-2a
- select public-2b
-
Route table
- Public
- Destination:0.0.0.0/0 , Target:igw
- Associations 2 public subnet
- private-2a
- Destination:0.0.0.0/0 , Target:nat(public-2a)
- Associations private-2a subnet
- private-2b
- Destination:0.0.0.0/0 , Target:nat(public-2b)
- Associations private-2b subnet
- Public
-
-
EC2
-
Security Group
- public-ssh
- Port:22, source:MyIP
- private-ssh
- Port:22, source:sg-${public-ssh-id}
- web-lb
- Port:80, source:0.0.0.0/0
- web-wb
- Port:80, source:sg-${web-lb-id}
- public-ssh
-
Instances
- Bastion
- public subnet
- assign public ip
- WEB
- private subnet
- don't assign public ip
- install apache and php
- install host.php
- install stress.php
- build image to ami
- Bastion
-
Load balancer
- Class LB
- Security Groups:web-lb
- Health Check
- Ping Protocol:HTTP
- Ping Port:80
- Ping Path:/host.php
- Response Timeout:5
- Interval:10
- Unhealthy threshold:2
- Healthy threshold:2
- Class LB
-
Auto scaling
- Launch Configurations
security groups
trust port 80 sourceanywhere
- Auto Scaling Groups
- select private-{2a,2b}
- add elb
- health check use elb (check use ec2 type)
- add instance tag
- Desired:2
- Min:1
- Max:5
- Scaling Policies
- scale-out
- Whenever Maximum of CPU
- Is >= 70%
- Add 67% percent of group when 70%
- scale-in
- Whenever Maximum of CPU
- Is <= 30%
- remove 1 instance when 30%
- scale-out
- Launch Configurations
-
- EC2
- ELB
- AMI
- AutoScaling
- VPC
- NAT Gateway
- EIP