When I try to import ecs resources (cluster, task definition and service) using CloudFormation console, I got an error like
Resource handler returned message: "Invalid request provided: DescribeServices error: Invalid identifier: Identifier is for cluster MyECSCluster. Your cluster is default (Service: AmazonECS; Status Code: 400; Error Code: InvalidParameterException; Request ID: xxxxxxxxx; Proxy: null)" (RequestToken: xxxxxxxxx, HandlerErrorCode: InvalidRequest)
I got this error after all the resources imports succeeded. The cluster update also succeeded. The failure occurs in the ECS service update. I used CLI to create the cluster and the service. For the task definition, I used existing one so I don't remember how it was created. I also tried to create a cluster (only cluster itself, not task def and service) by management console and cloudformation because the cluster is created on cloudformation (When I create a cluster by CLI, the cluster is not created on cloudformation). However, I got the similar error which says
... Your cluster is default ...
How can I solve this? Is there any way to create a non-default cluster?
My existing cluster and its service are working properly and template used for the import is
{
"AWSTemplateFormatVersion": "2010-09-09",
"Resources": {
"ECSCluster": {
"Type": "AWS::ECS::Cluster",
"DeletionPolicy": "Delete"
},
"ECSTaskDefinition": {
"Type": "AWS::ECS::TaskDefinition",
"DeletionPolicy": "Retain"
},
"ECSService": {
"Type": "AWS::ECS::Service",
"DeletionPolicy": "Delete"
}
}
}
Thanks,
But adding "Cluster" key triggers a replacement.