AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Implementation for accessing ServiceDiscovery

Cloud Map

With Cloud Map, you can configure public DNS, private DNS, or HTTP namespaces that your microservice applications run in. When an instance becomes available, you can call the Cloud Map API to register the instance with Cloud Map. For public or private DNS namespaces, Cloud Map automatically creates DNS records and an optional health check. Clients that submit public or private DNS queries, or HTTP requests, for the service receive an answer that contains up to eight healthy records.

Inheritance Hierarchy

System.Object
  Amazon.Runtime.AmazonServiceClient
    Amazon.ServiceDiscovery.AmazonServiceDiscoveryClient

Namespace: Amazon.ServiceDiscovery
Assembly: AWSSDK.ServiceDiscovery.dll
Version: 3.x.y.z

Syntax

C#
public class AmazonServiceDiscoveryClient : AmazonServiceClient
         IAmazonService, IAmazonServiceDiscovery, IDisposable

The AmazonServiceDiscoveryClient type exposes the following members

Constructors

NameDescription
Public Method AmazonServiceDiscoveryClient()

Constructs AmazonServiceDiscoveryClient with the credentials loaded from the application's default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance. Example App.config with credentials set.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <appSettings>
        <add key="AWSProfileName" value="AWS Default"/>
    </appSettings>
</configuration>
             

Public Method AmazonServiceDiscoveryClient(RegionEndpoint)

Constructs AmazonServiceDiscoveryClient with the credentials loaded from the application's default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance. Example App.config with credentials set.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <appSettings>
        <add key="AWSProfileName" value="AWS Default"/>
    </appSettings>
</configuration>
             

Public Method AmazonServiceDiscoveryClient(AmazonServiceDiscoveryConfig)

Constructs AmazonServiceDiscoveryClient with the credentials loaded from the application's default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance. Example App.config with credentials set.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <appSettings>
        <add key="AWSProfileName" value="AWS Default"/>
    </appSettings>
</configuration>
             

Public Method AmazonServiceDiscoveryClient(AWSCredentials)

Constructs AmazonServiceDiscoveryClient with AWS Credentials

Public Method AmazonServiceDiscoveryClient(AWSCredentials, RegionEndpoint)

Constructs AmazonServiceDiscoveryClient with AWS Credentials

Public Method AmazonServiceDiscoveryClient(AWSCredentials, AmazonServiceDiscoveryConfig)

Constructs AmazonServiceDiscoveryClient with AWS Credentials and an AmazonServiceDiscoveryClient Configuration object.

Public Method AmazonServiceDiscoveryClient(string, string)

Constructs AmazonServiceDiscoveryClient with AWS Access Key ID and AWS Secret Key

Public Method AmazonServiceDiscoveryClient(string, string, RegionEndpoint)

Constructs AmazonServiceDiscoveryClient with AWS Access Key ID and AWS Secret Key

Public Method AmazonServiceDiscoveryClient(string, string, AmazonServiceDiscoveryConfig)

Constructs AmazonServiceDiscoveryClient with AWS Access Key ID, AWS Secret Key and an AmazonServiceDiscoveryClient Configuration object.

Public Method AmazonServiceDiscoveryClient(string, string, string)

Constructs AmazonServiceDiscoveryClient with AWS Access Key ID and AWS Secret Key

Public Method AmazonServiceDiscoveryClient(string, string, string, RegionEndpoint)

Constructs AmazonServiceDiscoveryClient with AWS Access Key ID and AWS Secret Key

Public Method AmazonServiceDiscoveryClient(string, string, string, AmazonServiceDiscoveryConfig)

Constructs AmazonServiceDiscoveryClient with AWS Access Key ID, AWS Secret Key and an AmazonServiceDiscoveryClient Configuration object.

Properties

NameTypeDescription
Public Property Config Amazon.Runtime.IClientConfig Inherited from Amazon.Runtime.AmazonServiceClient.
Public Property Paginators Amazon.ServiceDiscovery.Model.IServiceDiscoveryPaginatorFactory

Paginators for the service

Methods

Note:

Asynchronous operations (methods ending with Async) in the table below are for .NET 4.5 or higher. For .NET 3.5 the SDK follows the standard naming convention of BeginMethodName and EndMethodName to indicate asynchronous operations - these method pairs are not shown in the table below.

NameDescription
Public Method CreateHttpNamespace(CreateHttpNamespaceRequest)

Creates an HTTP namespace. Service instances registered using an HTTP namespace can be discovered using a DiscoverInstances request but can't be discovered using DNS.

For the current quota on the number of namespaces that you can create using the same Amazon Web Services account, see Cloud Map quotas in the Cloud Map Developer Guide.

Public Method CreateHttpNamespaceAsync(CreateHttpNamespaceRequest, CancellationToken)

Creates an HTTP namespace. Service instances registered using an HTTP namespace can be discovered using a DiscoverInstances request but can't be discovered using DNS.

For the current quota on the number of namespaces that you can create using the same Amazon Web Services account, see Cloud Map quotas in the Cloud Map Developer Guide.

Public Method CreatePrivateDnsNamespace(CreatePrivateDnsNamespaceRequest)

Creates a private namespace based on DNS, which is visible only inside a specified Amazon VPC. The namespace defines your service naming scheme. For example, if you name your namespace example.com and name your service backend, the resulting DNS name for the service is backend.example.com. Service instances that are registered using a private DNS namespace can be discovered using either a DiscoverInstances request or using DNS. For the current quota on the number of namespaces that you can create using the same Amazon Web Services account, see Cloud Map quotas in the Cloud Map Developer Guide.

Public Method CreatePrivateDnsNamespaceAsync(CreatePrivateDnsNamespaceRequest, CancellationToken)

Creates a private namespace based on DNS, which is visible only inside a specified Amazon VPC. The namespace defines your service naming scheme. For example, if you name your namespace example.com and name your service backend, the resulting DNS name for the service is backend.example.com. Service instances that are registered using a private DNS namespace can be discovered using either a DiscoverInstances request or using DNS. For the current quota on the number of namespaces that you can create using the same Amazon Web Services account, see Cloud Map quotas in the Cloud Map Developer Guide.

Public Method CreatePublicDnsNamespace(CreatePublicDnsNamespaceRequest)

Creates a public namespace based on DNS, which is visible on the internet. The namespace defines your service naming scheme. For example, if you name your namespace example.com and name your service backend, the resulting DNS name for the service is backend.example.com. You can discover instances that were registered with a public DNS namespace by using either a DiscoverInstances request or using DNS. For the current quota on the number of namespaces that you can create using the same Amazon Web Services account, see Cloud Map quotas in the Cloud Map Developer Guide.

The CreatePublicDnsNamespace API operation is not supported in the Amazon Web Services GovCloud (US) Regions.

Public Method CreatePublicDnsNamespaceAsync(CreatePublicDnsNamespaceRequest, CancellationToken)

Creates a public namespace based on DNS, which is visible on the internet. The namespace defines your service naming scheme. For example, if you name your namespace example.com and name your service backend, the resulting DNS name for the service is backend.example.com. You can discover instances that were registered with a public DNS namespace by using either a DiscoverInstances request or using DNS. For the current quota on the number of namespaces that you can create using the same Amazon Web Services account, see Cloud Map quotas in the Cloud Map Developer Guide.

The CreatePublicDnsNamespace API operation is not supported in the Amazon Web Services GovCloud (US) Regions.

Public Method CreateService(CreateServiceRequest)

Creates a service. This action defines the configuration for the following entities:

  • For public and private DNS namespaces, one of the following combinations of DNS records in Amazon Route 53:

    • A

    • AAAA

    • A and AAAA

    • SRV

    • CNAME

  • Optionally, a health check

After you create the service, you can submit a RegisterInstance request, and Cloud Map uses the values in the configuration to create the specified entities.

For the current quota on the number of instances that you can register using the same namespace and using the same service, see Cloud Map quotas in the Cloud Map Developer Guide.

Public Method CreateServiceAsync(CreateServiceRequest, CancellationToken)

Creates a service. This action defines the configuration for the following entities:

  • For public and private DNS namespaces, one of the following combinations of DNS records in Amazon Route 53:

    • A

    • AAAA

    • A and AAAA

    • SRV

    • CNAME

  • Optionally, a health check

After you create the service, you can submit a RegisterInstance request, and Cloud Map uses the values in the configuration to create the specified entities.

For the current quota on the number of instances that you can register using the same namespace and using the same service, see Cloud Map quotas in the Cloud Map Developer Guide.

Public Method DeleteNamespace(DeleteNamespaceRequest)

Deletes a namespace from the current account. If the namespace still contains one or more services, the request fails.

Public Method DeleteNamespaceAsync(DeleteNamespaceRequest, CancellationToken)

Deletes a namespace from the current account. If the namespace still contains one or more services, the request fails.

Public Method DeleteService(DeleteServiceRequest)

Deletes a specified service. If the service still contains one or more registered instances, the request fails.

Public Method DeleteServiceAsync(DeleteServiceRequest, CancellationToken)

Deletes a specified service. If the service still contains one or more registered instances, the request fails.

Public Method DeregisterInstance(DeregisterInstanceRequest)

Deletes the Amazon Route 53 DNS records and health check, if any, that Cloud Map created for the specified instance.

Public Method DeregisterInstanceAsync(DeregisterInstanceRequest, CancellationToken)

Deletes the Amazon Route 53 DNS records and health check, if any, that Cloud Map created for the specified instance.

Public Method DetermineServiceOperationEndpoint(AmazonWebServiceRequest)

Returns the endpoint that will be used for a particular request.

Public Method DiscoverInstances(DiscoverInstancesRequest)

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.

Public Method DiscoverInstancesAsync(DiscoverInstancesRequest, CancellationToken)

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.

Public Method DiscoverInstancesRevision(DiscoverInstancesRevisionRequest)

Discovers the increasing revision associated with an instance.

Public Method DiscoverInstancesRevisionAsync(DiscoverInstancesRevisionRequest, CancellationToken)

Discovers the increasing revision associated with an instance.

Public Method Dispose() Inherited from Amazon.Runtime.AmazonServiceClient.
Public Method GetInstance(GetInstanceRequest)

Gets information about a specified instance.

Public Method GetInstanceAsync(GetInstanceRequest, CancellationToken)

Gets information about a specified instance.

Public Method GetInstancesHealthStatus(GetInstancesHealthStatusRequest)

Gets the current health status (Healthy, Unhealthy, or Unknown) of one or more instances that are associated with a specified service.

There's a brief delay between when you register an instance and when the health status for the instance is available.

Public Method GetInstancesHealthStatusAsync(GetInstancesHealthStatusRequest, CancellationToken)

Gets the current health status (Healthy, Unhealthy, or Unknown) of one or more instances that are associated with a specified service.

There's a brief delay between when you register an instance and when the health status for the instance is available.

Public Method GetNamespace(GetNamespaceRequest)

Gets information about a namespace.

Public Method GetNamespaceAsync(GetNamespaceRequest, CancellationToken)

Gets information about a namespace.

Public Method GetOperation(GetOperationRequest)

Gets information about any operation that returns an operation ID in the response, such as a CreateHttpNamespace request.

To get a list of operations that match specified criteria, see ListOperations.

Public Method GetOperationAsync(GetOperationRequest, CancellationToken)

Gets information about any operation that returns an operation ID in the response, such as a CreateHttpNamespace request.

To get a list of operations that match specified criteria, see ListOperations.

Public Method GetService(GetServiceRequest)

Gets the settings for a specified service.

Public Method GetServiceAsync(GetServiceRequest, CancellationToken)

Gets the settings for a specified service.

Public Method ListInstances(ListInstancesRequest)

Lists summary information about the instances that you registered by using a specified service.

Public Method ListInstancesAsync(ListInstancesRequest, CancellationToken)

Lists summary information about the instances that you registered by using a specified service.

Public Method ListNamespaces(ListNamespacesRequest)

Lists summary information about the namespaces that were created by the current Amazon Web Services account.

Public Method ListNamespacesAsync(ListNamespacesRequest, CancellationToken)

Lists summary information about the namespaces that were created by the current Amazon Web Services account.

Public Method ListOperations(ListOperationsRequest)

Lists operations that match the criteria that you specify.

Public Method ListOperationsAsync(ListOperationsRequest, CancellationToken)

Lists operations that match the criteria that you specify.

Public Method ListServices(ListServicesRequest)

Lists summary information for all the services that are associated with one or more namespaces.

Public Method ListServicesAsync(ListServicesRequest, CancellationToken)

Lists summary information for all the services that are associated with one or more namespaces.

Public Method ListTagsForResource(ListTagsForResourceRequest)

Lists tags for the specified resource.

Public Method ListTagsForResourceAsync(ListTagsForResourceRequest, CancellationToken)

Lists tags for the specified resource.

Public Method RegisterInstance(RegisterInstanceRequest)

Creates or updates one or more records and, optionally, creates a health check based on the settings in a specified service. When you submit a RegisterInstance request, the following occurs:

  • For each DNS record that you define in the service that's specified by ServiceId, a record is created or updated in the hosted zone that's associated with the corresponding namespace.

  • If the service includes HealthCheckConfig, a health check is created based on the settings in the health check configuration.

  • The health check, if any, is associated with each of the new or updated records.

One RegisterInstance request must complete before you can submit another request and specify the same service ID and instance ID.

For more information, see CreateService.

When Cloud Map receives a DNS query for the specified DNS name, it returns the applicable value:

  • If the health check is healthy: returns all the records

  • If the health check is unhealthy: returns the applicable value for the last healthy instance

  • If you didn't specify a health check configuration: returns all the records

For the current quota on the number of instances that you can register using the same namespace and using the same service, see Cloud Map quotas in the Cloud Map Developer Guide.

Public Method RegisterInstanceAsync(RegisterInstanceRequest, CancellationToken)

Creates or updates one or more records and, optionally, creates a health check based on the settings in a specified service. When you submit a RegisterInstance request, the following occurs:

  • For each DNS record that you define in the service that's specified by ServiceId, a record is created or updated in the hosted zone that's associated with the corresponding namespace.

  • If the service includes HealthCheckConfig, a health check is created based on the settings in the health check configuration.

  • The health check, if any, is associated with each of the new or updated records.

One RegisterInstance request must complete before you can submit another request and specify the same service ID and instance ID.

For more information, see CreateService.

When Cloud Map receives a DNS query for the specified DNS name, it returns the applicable value:

  • If the health check is healthy: returns all the records

  • If the health check is unhealthy: returns the applicable value for the last healthy instance

  • If you didn't specify a health check configuration: returns all the records

For the current quota on the number of instances that you can register using the same namespace and using the same service, see Cloud Map quotas in the Cloud Map Developer Guide.

Public Method TagResource(TagResourceRequest)

Adds one or more tags to the specified resource.

Public Method TagResourceAsync(TagResourceRequest, CancellationToken)

Adds one or more tags to the specified resource.

Public Method UntagResource(UntagResourceRequest)

Removes one or more tags from the specified resource.

Public Method UntagResourceAsync(UntagResourceRequest, CancellationToken)

Removes one or more tags from the specified resource.

Public Method UpdateHttpNamespace(UpdateHttpNamespaceRequest)

Updates an HTTP namespace.

Public Method UpdateHttpNamespaceAsync(UpdateHttpNamespaceRequest, CancellationToken)

Updates an HTTP namespace.

Public Method UpdateInstanceCustomHealthStatus(UpdateInstanceCustomHealthStatusRequest)

Submits a request to change the health status of a custom health check to healthy or unhealthy.

You can use UpdateInstanceCustomHealthStatus to change the status only for custom health checks, which you define using HealthCheckCustomConfig when you create a service. You can't use it to change the status for Route 53 health checks, which you define using HealthCheckConfig.

For more information, see HealthCheckCustomConfig.

Public Method UpdateInstanceCustomHealthStatusAsync(UpdateInstanceCustomHealthStatusRequest, CancellationToken)

Submits a request to change the health status of a custom health check to healthy or unhealthy.

You can use UpdateInstanceCustomHealthStatus to change the status only for custom health checks, which you define using HealthCheckCustomConfig when you create a service. You can't use it to change the status for Route 53 health checks, which you define using HealthCheckConfig.

For more information, see HealthCheckCustomConfig.

Public Method UpdatePrivateDnsNamespace(UpdatePrivateDnsNamespaceRequest)

Updates a private DNS namespace.

Public Method UpdatePrivateDnsNamespaceAsync(UpdatePrivateDnsNamespaceRequest, CancellationToken)

Updates a private DNS namespace.

Public Method UpdatePublicDnsNamespace(UpdatePublicDnsNamespaceRequest)

Updates a public DNS namespace.

Public Method UpdatePublicDnsNamespaceAsync(UpdatePublicDnsNamespaceRequest, CancellationToken)

Updates a public DNS namespace.

Public Method UpdateService(UpdateServiceRequest)

Submits a request to perform the following operations:

  • Update the TTL setting for existing DnsRecords configurations

  • Add, update, or delete HealthCheckConfig for a specified service

    You can't add, update, or delete a HealthCheckCustomConfig configuration.

For public and private DNS namespaces, note the following:

  • If you omit any existing DnsRecords or HealthCheckConfig configurations from an UpdateService request, the configurations are deleted from the service.

  • If you omit an existing HealthCheckCustomConfig configuration from an UpdateService request, the configuration isn't deleted from the service.

When you update settings for a service, Cloud Map also updates the corresponding settings in all the records and health checks that were created by using the specified service.

Public Method UpdateServiceAsync(UpdateServiceRequest, CancellationToken)

Submits a request to perform the following operations:

  • Update the TTL setting for existing DnsRecords configurations

  • Add, update, or delete HealthCheckConfig for a specified service

    You can't add, update, or delete a HealthCheckCustomConfig configuration.

For public and private DNS namespaces, note the following:

  • If you omit any existing DnsRecords or HealthCheckConfig configurations from an UpdateService request, the configurations are deleted from the service.

  • If you omit an existing HealthCheckCustomConfig configuration from an UpdateService request, the configuration isn't deleted from the service.

When you update settings for a service, Cloud Map also updates the corresponding settings in all the records and health checks that were created by using the specified service.

Events

NameDescription
Event AfterResponseEvent Inherited from Amazon.Runtime.AmazonServiceClient.
Event BeforeRequestEvent Inherited from Amazon.Runtime.AmazonServiceClient.
Event ExceptionEvent Inherited from Amazon.Runtime.AmazonServiceClient.

Version Information

.NET Core App:
Supported in: 3.1

.NET Standard:
Supported in: 2.0

.NET Framework:
Supported in: 4.5, 4.0, 3.5