AWS ECS集群容量提供程序

时间:2020-08-21 23:05:41

标签: amazon-web-services amazon-cloudformation amazon-ecs autoscaling

我正在使用此cloudformation模板通过ecs容量提供程序中指定的自动扩展组为ECS集群创建容量提供程序:

"ECSCapacityProvider": {
            "Type": "AWS::ECS::CapacityProvider",
            "Properties": {
                "AutoScalingGroupProvider": {
                    "AutoScalingGroupArn": { "Ref" : "AutoScalingGroup" }
                }
            },
            "DependsOn" : "AutoScalingGroup" 
        },
        "DRCluster": {
            "Type": "AWS::ECS::Cluster",
            "Properties": {
                "ClusterName": { "Ref" : "WindowsECSCluster" },
                "CapacityProviders" : "ECSCapacityProvider",
                "Tags": [
                    {
                        "Key": "environment",
                        "Value": "dr"
                    }
                ]
            },
            "DependsOn" : "ECSCapacityProvider" 
        }

但是在创建堆栈时会导致以下错误:

Model validation failed (#/CapacityProviders: expected type: JSONArray, found: String)

我找不到有关容量提供者的适当文档。我正在使用它将Auto Scaling组附加到群集,我希望这是正确的方法。我是cloudformation的新手,非常感谢您的帮助。

1 个答案:

答案 0 :(得分:2)

CapacityProviders字符串列表,而不是像现在这样的String

"CapacityProviders" : "ECSCapacityProvider",

因此,在您DRCluster中,您可以改用以下内容:

"CapacityProviders" : [ {"Ref": "ECSCapacityProvider"} ],