ã¯ããã«
- ELB ã§é
ä¸ã®ã¤ã³ã¹ã¿ã³ã¹ã
AutoScaling
ã使ã£ã¦ç«ã¡ä¸ããããè½ã¨ããããã - ã¨ãããã試ããéã®ã³ãã³ããã¡ã¢
- 詳細ã¯é©å®ã¢ãããã¼ããã¦ãã
åè
- autoscaling
- AWSã®VPCã§Auto Scalingã試ããè¨é²
- ELB & CloudWatch & AutoScaling - AWSãã¤ã¹ã¿ã¼ã·ãªã¼ãº
- Auto Scalingã®èãè³æ
- Aws st 20130617-auto_scaling
- Load Balancing with Auto Scaling
- Dynamic Scaling
æ§æå³
ãã¡ããåèã«ä»¥ä¸ã®ãããªæ§æã§è©¦ãã¦ã¿ãã
ãã¼ã¯ã¼ã
ãã¡ãã®è³æã® 47 ãã¼ã¸ç®ãå人çã«ã¯è§£ããããã£ãã
Launch Configuration
- èµ·åããã¤ã³ã¹ã¿ã³ã¹ã®ãã©ã¡ã¼ã¿ãæå®ãã
AMI
ãã¤ã³ã¹ã¿ã³ã¹ã¿ã¤ãçãæå®- ã¤ã³ã¹ã¿ã³ã¹ãèµ·åããéã®ãã©ã¡ã¼ã¿ã¨ä¼¼ã¦ãã
Auto Scaling Group
Auto Scaling
ãããã°ã«ã¼ããæå®ãã- ã©ã®
Launch Configuration
ãå©ç¨ããã - ã°ã«ã¼ãå ã§ã®ã¤ã³ã¹ã¿ã³ã¹ã®æå°ãæ大æ°
- ãã«ã¹ãã§ãã¯ã®ã¿ã¤ãï¼
EC2
orELB
ï¼ AZ
ãVPC
ã®Subnet
ç
Scaling Policy
CloudWatch
ã®ã¢ã©ã¼ã ãçºçããéã®ããªã·ã¼ãæå®- ã¢ã©ã¼ã çºçã®ããªã¬ã¼ï¼
CPU
使ç¨çãAuto Scaling
ã°ã«ã¼ãå ã®ã¤ã³ã¹ã¿ã³ã¹æ°çï¼ - ããã¤ã®ã¤ã³ã¹ã¿ã³ã¹ãå¢ãããï¼
- å人çã«ç解ãææ§ãªã®ã§å¼ãç¶ãã調ã¹ã
è¨å®
Launch Configuration
aws autoscaling create-launch-configuration \ --launch-configuration-name my-test-as \ --image-id ami-xxxxxxx \ --instance-type t1.micro \ --key-name ${your_key} \ --security-groups sg-xxxxxxx \ --associate-public-ip-address \ --user-data file://path/to/script
以ä¸ã®ããã«è¨å®ããå 容ã確èªããã
aws autoscaling describe-launch-configurations --launch-configuration-name my-test-as
以ä¸ã®ããã«åºåãããã
{ "LaunchConfigurations": [ { "UserData": "IyEvYmluL2Jhc2gKCnNlcnZpY2Ugbmdpbnggc3RhcnQKaG9zdG5hbWUgPiAvdXNyL3NoYXJlL25naW54L2h0bWwvaW5kZXguaHRtbAo=", "EbsOptimized": false, "LaunchConfigurationARN": "arn:aws:autoscaling:ap-northeast-1:1234567890123:launchConfiguration:7f3dcc1b-caaa-4e46-83d6-ec8227a1337a:launchConfigurationName/my-test-as", "InstanceMonitoring": { "Enabled": true }, "ImageId": "ami-xxxxxxx", "CreatedTime": "2014-01-05T01:15:37.866Z", "BlockDeviceMappings": [], "KeyName": "your_key", "SecurityGroups": [ "sg-xxxxxxx" ], "LaunchConfigurationName": "my-test-as", "KernelId": null, "RamdiskId": null, "InstanceType": "t1.micro", "AssociatePublicIpAddress": true } ] }
åé¤ã¯ä»¥ä¸ã®ã¨ããã
aws autoscaling delete-launch-configuration --launch-configuration-name my-test-as
å°ãAuto Scaling
èªä½ã®åé¤ã¯ã³ããå¿
è¦ãªã®ã§æ³¨æããï¼ä»¥ä¸ãAuto Scaling ã®åé¤ã«ã¤ãã¦
ãåç
§ï¼
Auto Scaling Group
aws autoscaling create-auto-scaling-group \ --auto-scaling-group-name my-test-asg \ --launch-configuration-name my-test-as \ --min-size 1 \ --max-size 2 \ --desired-capacity 2 \ --load-balancer-names hoge \ --health-check-type ELB \ --health-check-grace-period 180 \ --availability-zones ap-northeast-1a ap-northeast-1c \ --vpc-zone-identifier subnet-xxxxxxx,subnet-xxxxxxx
è¨å®å
容ãåçã«æ´æ°ããå ´åã«ã¯ update-auto-scaling-group
ãå©ç¨ããã
aws autoscaling update-auto-scaling-group --auto-scaling-group-name my-test-asg --min-size 2 --max-size 2 --desired-capacity 2
以ä¸ã®ããã«è¨å®ããå 容ã確èªããã
aws autoscaling describe-auto-scaling-groups
以ä¸ã®ããã«åºåãããã
{ "AutoScalingGroups": [ { "AutoScalingGroupARN": "arn:aws:autoscaling:ap-northeast-1:1234567890123:autoScalingGroup:fc90ac04-81bc-4cf8-a291-4bebb8d1ce3d:autoScalingGroupName/my-test-asg", "HealthCheckGracePeriod": 180, "SuspendedProcesses": [], "DesiredCapacity": 2, "Tags": [], "EnabledMetrics": [], "LoadBalancerNames": [ "hoge" ], "AutoScalingGroupName": "my-test-asg", "DefaultCooldown": 300, "MinSize": 2, "Instances": [ { "InstanceId": "i-xxxxxx1", "AvailabilityZone": "ap-northeast-1c", "HealthStatus": "Healthy", "LifecycleState": "InService", "LaunchConfigurationName": "my-test-as" }, { "InstanceId": "i-xxxxxx2", "AvailabilityZone": "ap-northeast-1a", "HealthStatus": "Healthy", "LifecycleState": "InService", "LaunchConfigurationName": "my-test-as" } ], "MaxSize": 2, "VPCZoneIdentifier": "subnet-xxxxxx1,subnet-xxxxxx2", "TerminationPolicies": [ "Default" ], "LaunchConfigurationName": "my-test-as", "CreatedTime": "2014-01-05T01:15:55.839Z", "AvailabilityZones": [ "ap-northeast-1c", "ap-northeast-1a" ], "HealthCheckType": "ELB" } ] }
Scaling Policy
aws autoscaling put-scaling-policy \ --auto-scaling-group-name my-test-asg \ --policy-name my-test-poli \ --scaling-adjustment 2 \ --adjustment-type ExactCapacity
以ä¸ã®ããã«è¨å®å 容ã確èªããã
describe-policies
以ä¸ã®ããã«è¨å®ãåé¤ããã
aws autoscaling delete-policy \ --auto-scaling-group-name my-test-asg \ --policy-name my-test-poli
Auto Scaling ã®åé¤ã«ã¤ãã¦
Auto Scaling
ã®æ§æãåé¤ããå ´åã«ã¯ããããã®ã³ã³ãã¼ãã³ãã®è¨å®ãåé¤ããã ãã§ã¯åé¤ãããã¨ã¯åºæ¥ãªãã
ã¾ã㯠Scaling Policy
ãåé¤ããã
aws autoscaling delete-policy \ --auto-scaling-group-name my-test-asg \ --policy-name my-test-poli
次ã«ã以ä¸ã®ããã« auto-scaling-group
ã®ãã©ã¡ã¼ã¿ãã¢ãããã¼ãããã
aws autoscaling update-auto-scaling-group --auto-scaling-group-name my-test-asg --min-size 0 --desired-capacity 0
ãã®å¾ãæ«ãæéãç½®ãã¦ä»¥ä¸ãå®è¡ã㦠auto-scaling-group
ãåé¤ããã
aws autoscaling delete-auto-scaling-group --auto-scaling-group-name my-test-asg
ãã®å¾ãLaunch Configuration
ãåé¤ããã
aws autoscaling delete-launch-configuration --launch-configuration-name my-test-as
åä½ç¢ºèª
é©å½ã«ã¢ã¯ã»ã¹ãã¦ã¿ã
åä½ç¢ºèªã¯ã³ãã³ãã©ã¤ã³ãã ELB
ã® DNS Name
ã«å¯¾ã㦠curl
ã使ã£ã¦ã¢ã¯ã»ã¹ããã
% curl http://hoge-1234567890.ap-northeast-1.elb.amazonaws.com ip-10-0-0-37 % curl http://hoge-1234567890.ap-northeast-1.elb.amazonaws.com ip-10-0-1-51
ã¡ãã£ã¨æ°ã«ãªã£ãã®ããã¢ã¯ã»ã¹ãã¦ããã¨ä¸ã¤ã®ã¤ã³ã¹ã¿ã³ã¹ã«ã¢ã¯ã»ã¹ãåã£ã¦ãã¾ãç¾è±¡ãè¦ããããããã£ã¦ ãï¼è¿½è¨ï¼è»½ãæ¯è¼ãã¦ã¿ãã¨ããã¤ã³ã¹ã¿ã³ã¹ãåä¸ã® ELB
ã®è¨å®ã«æ¼ãããã£ããããã®ããã...AZ
ã«ããå ´åã«ã¯ã©ã³ãã ã«ã¢ã¯ã»ã¹ãããã£ã½ããç°ãªã AZ
ã®å ´åã«ã¯ã¢ã¯ã»ã¹ã«åããããããã«è¦ãã...ï¼
é害çºçï¼
é害çºçï¼ã¨ããã·ãã¥ã¨ã¼ã·ã§ã³ãæå³çã«ä½ã£ã¦ Auto Scaling
ã®ééå³ã試ãã¦ã¿ãã
é害çºçï¼
æ«ãããã¨...ã¤ã³ã¹ã¿ã³ã¹ãèªåèµ·åï¼
ããã
CloudWatch ã®ã¡ããªã¯ã¹
Auto Scaling
㯠CloudWatch
ãå©ç¨ãã¦ã¤ã³ã¹ã¿ã³ã¹ã®ç£è¦çµæãããªã¬ã¼ã«ã¤ã³ã¹ã¿ã³ã¹ã®å¢æ¸ãè¡ãã®ã§ CloudWatch
å´ã§ã¯ä»¥ä¸ã®ããã«ã¤ã³ã¹ã¿ã³ã¹æ°ã®å¢æ¸ãã¡ããªã¯ã¹ã¨ãã¦ããããããã¦ããã
æå¾ã«
- æã£ãããç°¡åã«
Auto Scaling
ã試ããã¨ãåºæ¥ã - ä½ãã
Auto Scaling Group
ã®è¨å®ã§ãã©ã¡ã¼ã¿ã®å¤ãè¤æ°è¨å®åºæ¥ããã¹ãã¼ã¹ã§åºåãã®ã¨ã«ã³ãåºåãã§åºåãã®ããã£ã¦ç¦ã£ã ELB
ã§AZ
ãã¾ããå ´åã«ã¯å²ãæ¯ããåã£ãããã«è¦ããç¾è±¡ã«ã¤ãã¦ã¯å¼ãç¶ã調æ»