I'm using this cloudformation template to create capacity providers for ECS cluster with the autoscaling group specified in the ecs capacity provider:
"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"
}
But while creating the stack it resulted in the following error:
Model validation failed (#/CapacityProviders: expected type: JSONArray, found: String)
I could not find proper documentation for the capacity providers. I'm using it to attach the Auto Scaling group to the cluster, which i hope is the correct way to do so. I'm new to cloudformation, any help is much appreciated.
CapacityProviders is a List of String, not a String
like you have now:
"CapacityProviders" : "ECSCapacityProvider",
Therefore, in you DRCluster
you can use the following instead:
"CapacityProviders" : [ {"Ref": "ECSCapacityProvider"} ],