discoverInstances

Discovers registered instances for a specified namespace and service. You can use DiscoverInstances to discover instances for any type of namespace. DiscoverInstances returns a randomized list of instances allowing customers to distribute traffic evenly across instances. For public and private DNS namespaces, you can also use DNS queries to discover instances.

Samples

import aws.sdk.kotlin.services.servicediscovery.model.HealthStatusFilter

fun main() { 
   //sampleStart 
   // Discovers instances in a shared namespace by specifying the OwnerAccount parameter, useful when
// working with shared namespaces.
val resp = serviceDiscoveryClient.discoverInstances {
    namespaceName = "example-shared-namespace"
    serviceName = "shared-namespace-service"
    ownerAccount = "123456789012"
} 
   //sampleEnd
}
import aws.sdk.kotlin.services.servicediscovery.model.HealthStatusFilter

fun main() { 
   //sampleStart 
   // Example Discover registered instances
val resp = serviceDiscoveryClient.discoverInstances {
    namespaceName = "example.com"
    serviceName = "myservice"
    maxResults = 10
    healthStatus = HealthStatusFilter.fromValue("ALL")
} 
   //sampleEnd
}