AWS creation failed: Service already exists. (Service: AWSServiceDiscovery; Status Code: 400; Error Code:...
i am new to aws and encountred some problem while trying to create a EC2 service in a ECS cluster.
i was able to successfully create a brand new service (service1) in cluster1, but afterwards, i decided to delete cluster1 and create cluster2. The problem came when i try to re-create service1 in cluster2. whenever i try to add the service, i will get the following error
creation failed: Service already exists. (Service: AWSServiceDiscovery; Status Code: 400; Error Code: ServiceAlreadyExists; Request ID: d854025e-ebcc-11e8-84ab-b3bac906f2ef)
anyone know how to resolve this problem? i have tried deregistering the task definition but it didn't work. cluster1 has been deleted and there are no services in cluster2
amazon-web-services amazon-ec2 amazon amazon-ecs
|
show 5 more comments
i am new to aws and encountred some problem while trying to create a EC2 service in a ECS cluster.
i was able to successfully create a brand new service (service1) in cluster1, but afterwards, i decided to delete cluster1 and create cluster2. The problem came when i try to re-create service1 in cluster2. whenever i try to add the service, i will get the following error
creation failed: Service already exists. (Service: AWSServiceDiscovery; Status Code: 400; Error Code: ServiceAlreadyExists; Request ID: d854025e-ebcc-11e8-84ab-b3bac906f2ef)
anyone know how to resolve this problem? i have tried deregistering the task definition but it didn't work. cluster1 has been deleted and there are no services in cluster2
amazon-web-services amazon-ec2 amazon amazon-ecs
Have you tried creating a service with a different name?
– Mohit Kumar
Nov 19 '18 at 7:59
i thought about it but i would like to find a way to remove the residues from the previous service @MohitKumar
– DJ_
Nov 19 '18 at 8:21
Haow have you created the cluster : using the CLI or the AWS Console? If it is the second, please make sure you have no services whatsoever: > In this case, after the cluster is deleted, you should delete any remaining AWS CloudFormation stack resources or Auto Scaling groups associated with the cluster to avoid incurring any future charges for those resources.
– AlexK
Nov 19 '18 at 9:23
@DJ_ have you checked the cloudformation stack for cluster1 if it exists or not ?
– Mohit Kumar
Nov 19 '18 at 9:31
@DJ_ it looks like you have created AWS Service with Fargate type?. If yes, when you created as Fargate and enabled Service Discovery for it then under Route 53, it has created entry under Hosted Zones(private, I guess)?. Then please go to Route 53 and delete/cleanup the ECS Service related domain zones.
– Imran
Nov 20 '18 at 1:54
|
show 5 more comments
i am new to aws and encountred some problem while trying to create a EC2 service in a ECS cluster.
i was able to successfully create a brand new service (service1) in cluster1, but afterwards, i decided to delete cluster1 and create cluster2. The problem came when i try to re-create service1 in cluster2. whenever i try to add the service, i will get the following error
creation failed: Service already exists. (Service: AWSServiceDiscovery; Status Code: 400; Error Code: ServiceAlreadyExists; Request ID: d854025e-ebcc-11e8-84ab-b3bac906f2ef)
anyone know how to resolve this problem? i have tried deregistering the task definition but it didn't work. cluster1 has been deleted and there are no services in cluster2
amazon-web-services amazon-ec2 amazon amazon-ecs
i am new to aws and encountred some problem while trying to create a EC2 service in a ECS cluster.
i was able to successfully create a brand new service (service1) in cluster1, but afterwards, i decided to delete cluster1 and create cluster2. The problem came when i try to re-create service1 in cluster2. whenever i try to add the service, i will get the following error
creation failed: Service already exists. (Service: AWSServiceDiscovery; Status Code: 400; Error Code: ServiceAlreadyExists; Request ID: d854025e-ebcc-11e8-84ab-b3bac906f2ef)
anyone know how to resolve this problem? i have tried deregistering the task definition but it didn't work. cluster1 has been deleted and there are no services in cluster2
amazon-web-services amazon-ec2 amazon amazon-ecs
amazon-web-services amazon-ec2 amazon amazon-ecs
asked Nov 19 '18 at 7:41
DJ_DJ_
315
315
Have you tried creating a service with a different name?
– Mohit Kumar
Nov 19 '18 at 7:59
i thought about it but i would like to find a way to remove the residues from the previous service @MohitKumar
– DJ_
Nov 19 '18 at 8:21
Haow have you created the cluster : using the CLI or the AWS Console? If it is the second, please make sure you have no services whatsoever: > In this case, after the cluster is deleted, you should delete any remaining AWS CloudFormation stack resources or Auto Scaling groups associated with the cluster to avoid incurring any future charges for those resources.
– AlexK
Nov 19 '18 at 9:23
@DJ_ have you checked the cloudformation stack for cluster1 if it exists or not ?
– Mohit Kumar
Nov 19 '18 at 9:31
@DJ_ it looks like you have created AWS Service with Fargate type?. If yes, when you created as Fargate and enabled Service Discovery for it then under Route 53, it has created entry under Hosted Zones(private, I guess)?. Then please go to Route 53 and delete/cleanup the ECS Service related domain zones.
– Imran
Nov 20 '18 at 1:54
|
show 5 more comments
Have you tried creating a service with a different name?
– Mohit Kumar
Nov 19 '18 at 7:59
i thought about it but i would like to find a way to remove the residues from the previous service @MohitKumar
– DJ_
Nov 19 '18 at 8:21
Haow have you created the cluster : using the CLI or the AWS Console? If it is the second, please make sure you have no services whatsoever: > In this case, after the cluster is deleted, you should delete any remaining AWS CloudFormation stack resources or Auto Scaling groups associated with the cluster to avoid incurring any future charges for those resources.
– AlexK
Nov 19 '18 at 9:23
@DJ_ have you checked the cloudformation stack for cluster1 if it exists or not ?
– Mohit Kumar
Nov 19 '18 at 9:31
@DJ_ it looks like you have created AWS Service with Fargate type?. If yes, when you created as Fargate and enabled Service Discovery for it then under Route 53, it has created entry under Hosted Zones(private, I guess)?. Then please go to Route 53 and delete/cleanup the ECS Service related domain zones.
– Imran
Nov 20 '18 at 1:54
Have you tried creating a service with a different name?
– Mohit Kumar
Nov 19 '18 at 7:59
Have you tried creating a service with a different name?
– Mohit Kumar
Nov 19 '18 at 7:59
i thought about it but i would like to find a way to remove the residues from the previous service @MohitKumar
– DJ_
Nov 19 '18 at 8:21
i thought about it but i would like to find a way to remove the residues from the previous service @MohitKumar
– DJ_
Nov 19 '18 at 8:21
Haow have you created the cluster : using the CLI or the AWS Console? If it is the second, please make sure you have no services whatsoever: > In this case, after the cluster is deleted, you should delete any remaining AWS CloudFormation stack resources or Auto Scaling groups associated with the cluster to avoid incurring any future charges for those resources.
– AlexK
Nov 19 '18 at 9:23
Haow have you created the cluster : using the CLI or the AWS Console? If it is the second, please make sure you have no services whatsoever: > In this case, after the cluster is deleted, you should delete any remaining AWS CloudFormation stack resources or Auto Scaling groups associated with the cluster to avoid incurring any future charges for those resources.
– AlexK
Nov 19 '18 at 9:23
@DJ_ have you checked the cloudformation stack for cluster1 if it exists or not ?
– Mohit Kumar
Nov 19 '18 at 9:31
@DJ_ have you checked the cloudformation stack for cluster1 if it exists or not ?
– Mohit Kumar
Nov 19 '18 at 9:31
@DJ_ it looks like you have created AWS Service with Fargate type?. If yes, when you created as Fargate and enabled Service Discovery for it then under Route 53, it has created entry under Hosted Zones(private, I guess)?. Then please go to Route 53 and delete/cleanup the ECS Service related domain zones.
– Imran
Nov 20 '18 at 1:54
@DJ_ it looks like you have created AWS Service with Fargate type?. If yes, when you created as Fargate and enabled Service Discovery for it then under Route 53, it has created entry under Hosted Zones(private, I guess)?. Then please go to Route 53 and delete/cleanup the ECS Service related domain zones.
– Imran
Nov 20 '18 at 1:54
|
show 5 more comments
1 Answer
1
active
oldest
votes
Here is full answer. When you created AWS ECS Service and you have also selected optional ServiceDiscovery for it as well which created an namespace(.local) and service(with same name as ECS Service) in Route53.
When you deleted ECS service & cluster, it won't automatically delete Route53 namespace/service entries. Now, you are getting Service already exists
error since your new ECS Service matches with same name as ServiceDiscovery service. You have 3 options. 1. Clean up Route53 namespaces and services. 2. Re-use Route53 Service if you want to continue to use ServiceDiscovery feature. 3. Don't enable service discovery integration when you are creating ECS Service.
Option 1 -
- You cannot delete Route53 ServiceDiscovery namespaces and service via Console. You will need to use AWS CLI.(Make sure you have configured CLI with AWS Keys same as the account where you have created ECS) https://docs.aws.amazon.com/cli/latest/reference/servicediscovery/index.html
- List the Namespaces & Services with CLI using following commands and sample output you should get.
aws servicediscovery list-services
{
"Services": [
{
"Id": "srv-x4acveybedar32mv",
"Arn": "arn:aws:servicediscovery:us-east-1:1234567890:service/srv-x4acveybedar32mv",
"Name": "nginx"
}
] }
aws servicediscovery list-namespaces
{
"Namespaces": [
{
"Id": "ns-3yd7pskwsxhwlq67",
"Arn": "arn:aws:servicediscovery:us-east-1:1234567890:namespace/ns-3yd7pskwsxhwlq67",
"Name": "local",
"Type": "DNS_PRIVATE"
}
] }
- Delete the Service first with command.
aws servicediscovery delete-service --id "srv-x4acveybedar32mv"
. Result is empty response from CLI. - Delete the namespace with command.
aws servicediscovery delete-namespace --id "ns-3yd7pskwsxhwlq67"
{
"OperationId": "s573v5dr62yee5d7vbfvsy5h65ybxmoh-jossalgs" }
- That's all. Now, you can re-create ECS services which you wanted.
Note -
Sometimes, DNS cleanup operations will take couple of minutes to reflect properly so just give always few minutes before retrying.
Option 2 -
- Re-use Route53 Services by selecting exiting one instead of creating with same name.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53370256%2faws-creation-failed-service-already-exists-service-awsservicediscovery-stat%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Here is full answer. When you created AWS ECS Service and you have also selected optional ServiceDiscovery for it as well which created an namespace(.local) and service(with same name as ECS Service) in Route53.
When you deleted ECS service & cluster, it won't automatically delete Route53 namespace/service entries. Now, you are getting Service already exists
error since your new ECS Service matches with same name as ServiceDiscovery service. You have 3 options. 1. Clean up Route53 namespaces and services. 2. Re-use Route53 Service if you want to continue to use ServiceDiscovery feature. 3. Don't enable service discovery integration when you are creating ECS Service.
Option 1 -
- You cannot delete Route53 ServiceDiscovery namespaces and service via Console. You will need to use AWS CLI.(Make sure you have configured CLI with AWS Keys same as the account where you have created ECS) https://docs.aws.amazon.com/cli/latest/reference/servicediscovery/index.html
- List the Namespaces & Services with CLI using following commands and sample output you should get.
aws servicediscovery list-services
{
"Services": [
{
"Id": "srv-x4acveybedar32mv",
"Arn": "arn:aws:servicediscovery:us-east-1:1234567890:service/srv-x4acveybedar32mv",
"Name": "nginx"
}
] }
aws servicediscovery list-namespaces
{
"Namespaces": [
{
"Id": "ns-3yd7pskwsxhwlq67",
"Arn": "arn:aws:servicediscovery:us-east-1:1234567890:namespace/ns-3yd7pskwsxhwlq67",
"Name": "local",
"Type": "DNS_PRIVATE"
}
] }
- Delete the Service first with command.
aws servicediscovery delete-service --id "srv-x4acveybedar32mv"
. Result is empty response from CLI. - Delete the namespace with command.
aws servicediscovery delete-namespace --id "ns-3yd7pskwsxhwlq67"
{
"OperationId": "s573v5dr62yee5d7vbfvsy5h65ybxmoh-jossalgs" }
- That's all. Now, you can re-create ECS services which you wanted.
Note -
Sometimes, DNS cleanup operations will take couple of minutes to reflect properly so just give always few minutes before retrying.
Option 2 -
- Re-use Route53 Services by selecting exiting one instead of creating with same name.
add a comment |
Here is full answer. When you created AWS ECS Service and you have also selected optional ServiceDiscovery for it as well which created an namespace(.local) and service(with same name as ECS Service) in Route53.
When you deleted ECS service & cluster, it won't automatically delete Route53 namespace/service entries. Now, you are getting Service already exists
error since your new ECS Service matches with same name as ServiceDiscovery service. You have 3 options. 1. Clean up Route53 namespaces and services. 2. Re-use Route53 Service if you want to continue to use ServiceDiscovery feature. 3. Don't enable service discovery integration when you are creating ECS Service.
Option 1 -
- You cannot delete Route53 ServiceDiscovery namespaces and service via Console. You will need to use AWS CLI.(Make sure you have configured CLI with AWS Keys same as the account where you have created ECS) https://docs.aws.amazon.com/cli/latest/reference/servicediscovery/index.html
- List the Namespaces & Services with CLI using following commands and sample output you should get.
aws servicediscovery list-services
{
"Services": [
{
"Id": "srv-x4acveybedar32mv",
"Arn": "arn:aws:servicediscovery:us-east-1:1234567890:service/srv-x4acveybedar32mv",
"Name": "nginx"
}
] }
aws servicediscovery list-namespaces
{
"Namespaces": [
{
"Id": "ns-3yd7pskwsxhwlq67",
"Arn": "arn:aws:servicediscovery:us-east-1:1234567890:namespace/ns-3yd7pskwsxhwlq67",
"Name": "local",
"Type": "DNS_PRIVATE"
}
] }
- Delete the Service first with command.
aws servicediscovery delete-service --id "srv-x4acveybedar32mv"
. Result is empty response from CLI. - Delete the namespace with command.
aws servicediscovery delete-namespace --id "ns-3yd7pskwsxhwlq67"
{
"OperationId": "s573v5dr62yee5d7vbfvsy5h65ybxmoh-jossalgs" }
- That's all. Now, you can re-create ECS services which you wanted.
Note -
Sometimes, DNS cleanup operations will take couple of minutes to reflect properly so just give always few minutes before retrying.
Option 2 -
- Re-use Route53 Services by selecting exiting one instead of creating with same name.
add a comment |
Here is full answer. When you created AWS ECS Service and you have also selected optional ServiceDiscovery for it as well which created an namespace(.local) and service(with same name as ECS Service) in Route53.
When you deleted ECS service & cluster, it won't automatically delete Route53 namespace/service entries. Now, you are getting Service already exists
error since your new ECS Service matches with same name as ServiceDiscovery service. You have 3 options. 1. Clean up Route53 namespaces and services. 2. Re-use Route53 Service if you want to continue to use ServiceDiscovery feature. 3. Don't enable service discovery integration when you are creating ECS Service.
Option 1 -
- You cannot delete Route53 ServiceDiscovery namespaces and service via Console. You will need to use AWS CLI.(Make sure you have configured CLI with AWS Keys same as the account where you have created ECS) https://docs.aws.amazon.com/cli/latest/reference/servicediscovery/index.html
- List the Namespaces & Services with CLI using following commands and sample output you should get.
aws servicediscovery list-services
{
"Services": [
{
"Id": "srv-x4acveybedar32mv",
"Arn": "arn:aws:servicediscovery:us-east-1:1234567890:service/srv-x4acveybedar32mv",
"Name": "nginx"
}
] }
aws servicediscovery list-namespaces
{
"Namespaces": [
{
"Id": "ns-3yd7pskwsxhwlq67",
"Arn": "arn:aws:servicediscovery:us-east-1:1234567890:namespace/ns-3yd7pskwsxhwlq67",
"Name": "local",
"Type": "DNS_PRIVATE"
}
] }
- Delete the Service first with command.
aws servicediscovery delete-service --id "srv-x4acveybedar32mv"
. Result is empty response from CLI. - Delete the namespace with command.
aws servicediscovery delete-namespace --id "ns-3yd7pskwsxhwlq67"
{
"OperationId": "s573v5dr62yee5d7vbfvsy5h65ybxmoh-jossalgs" }
- That's all. Now, you can re-create ECS services which you wanted.
Note -
Sometimes, DNS cleanup operations will take couple of minutes to reflect properly so just give always few minutes before retrying.
Option 2 -
- Re-use Route53 Services by selecting exiting one instead of creating with same name.
Here is full answer. When you created AWS ECS Service and you have also selected optional ServiceDiscovery for it as well which created an namespace(.local) and service(with same name as ECS Service) in Route53.
When you deleted ECS service & cluster, it won't automatically delete Route53 namespace/service entries. Now, you are getting Service already exists
error since your new ECS Service matches with same name as ServiceDiscovery service. You have 3 options. 1. Clean up Route53 namespaces and services. 2. Re-use Route53 Service if you want to continue to use ServiceDiscovery feature. 3. Don't enable service discovery integration when you are creating ECS Service.
Option 1 -
- You cannot delete Route53 ServiceDiscovery namespaces and service via Console. You will need to use AWS CLI.(Make sure you have configured CLI with AWS Keys same as the account where you have created ECS) https://docs.aws.amazon.com/cli/latest/reference/servicediscovery/index.html
- List the Namespaces & Services with CLI using following commands and sample output you should get.
aws servicediscovery list-services
{
"Services": [
{
"Id": "srv-x4acveybedar32mv",
"Arn": "arn:aws:servicediscovery:us-east-1:1234567890:service/srv-x4acveybedar32mv",
"Name": "nginx"
}
] }
aws servicediscovery list-namespaces
{
"Namespaces": [
{
"Id": "ns-3yd7pskwsxhwlq67",
"Arn": "arn:aws:servicediscovery:us-east-1:1234567890:namespace/ns-3yd7pskwsxhwlq67",
"Name": "local",
"Type": "DNS_PRIVATE"
}
] }
- Delete the Service first with command.
aws servicediscovery delete-service --id "srv-x4acveybedar32mv"
. Result is empty response from CLI. - Delete the namespace with command.
aws servicediscovery delete-namespace --id "ns-3yd7pskwsxhwlq67"
{
"OperationId": "s573v5dr62yee5d7vbfvsy5h65ybxmoh-jossalgs" }
- That's all. Now, you can re-create ECS services which you wanted.
Note -
Sometimes, DNS cleanup operations will take couple of minutes to reflect properly so just give always few minutes before retrying.
Option 2 -
- Re-use Route53 Services by selecting exiting one instead of creating with same name.
edited Jan 11 at 1:17
answered Nov 22 '18 at 16:08
ImranImran
1,2051721
1,2051721
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53370256%2faws-creation-failed-service-already-exists-service-awsservicediscovery-stat%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Have you tried creating a service with a different name?
– Mohit Kumar
Nov 19 '18 at 7:59
i thought about it but i would like to find a way to remove the residues from the previous service @MohitKumar
– DJ_
Nov 19 '18 at 8:21
Haow have you created the cluster : using the CLI or the AWS Console? If it is the second, please make sure you have no services whatsoever: > In this case, after the cluster is deleted, you should delete any remaining AWS CloudFormation stack resources or Auto Scaling groups associated with the cluster to avoid incurring any future charges for those resources.
– AlexK
Nov 19 '18 at 9:23
@DJ_ have you checked the cloudformation stack for cluster1 if it exists or not ?
– Mohit Kumar
Nov 19 '18 at 9:31
@DJ_ it looks like you have created AWS Service with Fargate type?. If yes, when you created as Fargate and enabled Service Discovery for it then under Route 53, it has created entry under Hosted Zones(private, I guess)?. Then please go to Route 53 and delete/cleanup the ECS Service related domain zones.
– Imran
Nov 20 '18 at 1:54