AWS ECS集群容量提供程序

问题描述

我正在使用此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的新手,非常感谢您的帮助。

解决方法

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

"CapacityProviders" : "ECSCapacityProvider",

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

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