0

我正在使用 CloudFormation 的自动缩放设置。添加 ALB 目标。如何配置 ALB(非经典 LB)以使用自动缩放?ALB 目标和我的 Templetes 的 ARN 如下。在指南中,应为 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-southeast-1:7*****3:loadbalancer/app/ALB-sgp/9*****6

和 ALB 目标。arn:aws:elasticloadbalancing:ap-southeast-1:7*****3:targetgroup/sgp-ALB/4*****2

4

0 回答 0