CmdID / aws / aws servicediscovery
aws servicediscovery deregister-instance
Deletes the Amazon Route 53 DNS records and health check, if any, that Cloud Map created for the specified instance. AWS CLI reference
2 examples 2 options Its page in the AWS CLI reference
Examples
Example 1: To deregister a service instance
The following deregister-instance example deregisters a service instance.
aws servicediscovery deregister-instance --service-id srv-p5zdwlg5uvvzjita --instance-id myservice-53Identify--service-idThe ID or Amazon Resource Name (ARN) of the service that the instance is associated with.--instance-idThe value that you specified for Id in the RegisterInstance request.Its output
{
"OperationId": "4yejorelbukcjzpnr6tlmrghsjwpngf4-k98rnaiq"
}To confirm that the operation succeeded, you can run get-operation. For more information, see get-operation.
For more information, see Deregistering service instances in the AWS Cloud Map Developer Guide.
Example 2: To deregister a service instance using service ARN for shared namespaces
The following deregister-instance example deregisters a service instance using a service ARN instead of service ID. Specifying an ARN is required when deregistering instances from services created in namespaces that are shared with your account.
aws servicediscovery deregister-instance --service-id arn:aws:servicediscovery:us-west-2:123456789012:service/srv-p5zdwlg5uvvzjita --instance-id web-server-01Identify--service-idThe ID or Amazon Resource Name (ARN) of the service that the instance is associated with.--instance-idThe value that you specified for Id in the RegisterInstance request.Its output
{
"OperationId": "gv4g5meo7ndmkqjrhpn39wk42xmpl"
}For more information, see Shared AWS Cloud Map namespaces and Deregistering an AWS Cloud Map service instance in the AWS Cloud Map Developer Guide.
Options
--instance-idThe value that you specified for Id in the RegisterInstance request.--service-idThe ID or Amazon Resource Name (ARN) of the service that the instance is associated with.