我正在使用CloudFormation进行自动缩放设置。添加ALB目标。 如何配置ALB(非经典LB)以使用自动缩放? ALB目标的ARN和我的Templetes如下。 在指南中,应为ALB添加目标ARN。
{
"AWSTemplateFormatVersion": "2010-09-09",
"Resources": {
"asgautotestgr": {
"Type": "AWS::AutoScaling::AutoScalingGroup",
"Properties": {
"AvailabilityZones": [
"ap-southeast-1a"
],
"Cooldown": "300",
"DesiredCapacity": "2",
"HealthCheckGracePeriod": "300",
"HealthCheckType": "EC2",
"MaxSize": "4",
"MinSize": "2",
"VPCZoneIdentifier": [ "subnet-3fe2c***" ],
"LaunchConfigurationName": {
"Ref": "lcautotest"
},
"LoadBalancerNames" : [ "arn:aws:elasticloadbalancing:ap-southeast-1:7****3:targetgroup/sgp-ALB/4*****2" ],
"MetricsCollection": [
{
"Granularity": "1Minute",
"Metrics": [
"GroupInServiceInstances",
"GroupMaxSize",
"GroupPendingInstances",
"GroupDesiredCapacity",
"GroupStandbyInstances",
"GroupTerminatingInstances",
"GroupMinSize",
"GroupTotalInstances"
]
}
],
"TerminationPolicies": [
"Default"
]
}
},
"lcautotest": {
"Type": "AWS::AutoScaling::LaunchConfiguration",
"Properties": {
"IamInstanceProfile" : "Cd***2",
"AssociatePublicIpAddress": true,
"ImageId": "ami-*****0",
"InstanceType": "t2.large",
"KeyName": "key",
"InstanceMonitoring": "true",
"SecurityGroups": [ "sg-6***" ],
"BlockDeviceMappings": [
{
"DeviceName": "/dev/sda1",
"Ebs": {
"SnapshotId": "snap-0e0edaa*6",
"VolumeSize": 60
}
}
]
}
}
},
"Description": ""
}
我的ALB ARN听到了。 ARN:AWS:elasticloadbalancing:AP-东南-1:7 ***** 3:负载均衡器/应用程序/ ALB-SGP / 9 ***** 6
和ALB目标。 ARN:AWS:elasticloadbalancing:AP-东南-1:7 ***** 3:targetgroup / SGP-ALB / 4 ***** 2