• 沒有找到結果。

AWS Cloud Map

N/A
N/A
Protected

Academic year: 2022

Share "AWS Cloud Map"

Copied!
162
0
0

加載中.... (立即查看全文)

全文

(1)

AWS Cloud Map

API Reference

API Version 2017-03-14

(2)

AWS Cloud Map: API Reference

Copyright © Amazon Web Services, Inc. and/or its affiliates. All rights reserved.

Amazon's trademarks and trade dress may not be used in connection with any product or service that is not Amazon's, in any manner that is likely to cause confusion among customers, or in any manner that disparages or discredits Amazon. All other trademarks not owned by Amazon are the property of their respective owners, who may or may not be affiliated with, connected to, or sponsored by Amazon.

(3)

Table of Contents

Welcome ... 1

Actions ... 2

CreateHttpNamespace ... 3

Request Syntax ... 3

Request Parameters ... 3

Response Syntax ... 4

Response Elements ... 4

Errors ... 4

Examples ... 5

See Also ... 5

CreatePrivateDnsNamespace ... 7

Request Syntax ... 7

Request Parameters ... 7

Response Syntax ... 8

Response Elements ... 8

Errors ... 9

Examples ... 9

See Also ... 10

CreatePublicDnsNamespace ... 11

Request Syntax ... 11

Request Parameters ... 11

Response Syntax ... 12

Response Elements ... 12

Errors ... 12

Examples ... 13

See Also ... 14

CreateService ... 15

Request Syntax ... 15

Request Parameters ... 15

Response Syntax ... 17

Response Elements ... 18

Errors ... 18

Examples ... 19

See Also ... 20

DeleteNamespace ... 21

Request Syntax ... 21

Request Parameters ... 21

Response Syntax ... 21

Response Elements ... 21

Errors ... 21

Examples ... 22

See Also ... 23

DeleteService ... 24

Request Syntax ... 24

Request Parameters ... 24

Response Elements ... 24

Errors ... 24

Examples ... 25

See Also ... 25

DeregisterInstance ... 26

Request Syntax ... 26

Request Parameters ... 26

Response Syntax ... 26

Response Elements ... 26

(4)

Errors ... 27

Examples ... 27

See Also ... 28

DiscoverInstances ... 29

Request Syntax ... 29

Request Parameters ... 29

Response Syntax ... 31

Response Elements ... 31

Errors ... 31

Examples ... 32

See Also ... 32

GetInstance ... 34

Request Syntax ... 34

Request Parameters ... 34

Response Syntax ... 34

Response Elements ... 34

Errors ... 35

Examples ... 35

See Also ... 36

GetInstancesHealthStatus ... 37

Request Syntax ... 37

Request Parameters ... 37

Response Syntax ... 38

Response Elements ... 38

Errors ... 38

Examples ... 39

See Also ... 39

GetNamespace ... 41

Request Syntax ... 41

Request Parameters ... 41

Response Syntax ... 41

Response Elements ... 41

Errors ... 42

Examples ... 42

See Also ... 43

GetOperation ... 44

Request Syntax ... 44

Request Parameters ... 44

Response Syntax ... 44

Response Elements ... 44

Errors ... 45

Examples ... 45

See Also ... 46

GetService ... 47

Request Syntax ... 47

Request Parameters ... 47

Response Syntax ... 47

Response Elements ... 48

Errors ... 48

Examples ... 48

See Also ... 49

ListInstances ... 50

Request Syntax ... 50

Request Parameters ... 50

Response Syntax ... 50

Response Elements ... 51

Errors ... 51

(5)

Examples ... 51

See Also ... 52

ListNamespaces ... 54

Request Syntax ... 54

Request Parameters ... 54

Response Syntax ... 55

Response Elements ... 55

Errors ... 56

Examples ... 56

See Also ... 57

ListOperations ... 58

Request Syntax ... 58

Request Parameters ... 58

Response Syntax ... 59

Response Elements ... 59

Errors ... 59

Examples ... 60

See Also ... 60

ListServices ... 62

Request Syntax ... 62

Request Parameters ... 62

Response Syntax ... 63

Response Elements ... 63

Errors ... 64

Examples ... 64

See Also ... 65

ListTagsForResource ... 66

Request Syntax ... 66

Request Parameters ... 66

Response Syntax ... 66

Response Elements ... 66

Errors ... 66

Examples ... 67

See Also ... 68

RegisterInstance ... 69

Request Syntax ... 69

Request Parameters ... 69

Response Syntax ... 72

Response Elements ... 72

Errors ... 72

Examples ... 73

See Also ... 73

TagResource ... 75

Request Syntax ... 75

Request Parameters ... 75

Response Elements ... 75

Errors ... 75

Examples ... 76

See Also ... 77

UntagResource ... 78

Request Syntax ... 78

Request Parameters ... 78

Response Elements ... 78

Errors ... 78

Examples ... 79

See Also ... 79

UpdateHttpNamespace ... 81

(6)

Request Syntax ... 81

Request Parameters ... 81

Response Syntax ... 81

Response Elements ... 82

Errors ... 82

See Also ... 82

UpdateInstanceCustomHealthStatus ... 84

Request Syntax ... 84

Request Parameters ... 84

Response Elements ... 84

Errors ... 85

Examples ... 85

See Also ... 86

UpdatePrivateDnsNamespace ... 87

Request Syntax ... 87

Request Parameters ... 87

Response Syntax ... 88

Response Elements ... 88

Errors ... 88

See Also ... 88

UpdatePublicDnsNamespace ... 90

Request Syntax ... 90

Request Parameters ... 90

Response Syntax ... 91

Response Elements ... 91

Errors ... 91

See Also ... 91

UpdateService ... 93

Request Syntax ... 93

Request Parameters ... 93

Response Syntax ... 94

Response Elements ... 94

Errors ... 94

Examples ... 94

See Also ... 95

Data Types ... 96

DnsConfig ... 98

Contents ... 98

See Also ... 99

DnsConfigChange ... 100

Contents ... 100

See Also ... 100

DnsProperties ... 101

Contents ... 101

See Also ... 101

DnsRecord ... 102

Contents ... 102

See Also ... 103

HealthCheckConfig ... 104

Contents ... 104

See Also ... 105

HealthCheckCustomConfig ... 107

Contents ... 107

See Also ... 108

HttpInstanceSummary ... 109

Contents ... 109

See Also ... 110

(7)

HttpNamespaceChange ... 111

Contents ... 111

See Also ... 111

HttpProperties ... 112

Contents ... 112

See Also ... 112

Instance ... 113

Contents ... 113

See Also ... 115

InstanceSummary ... 116

Contents ... 116

See Also ... 117

Namespace ... 118

Contents ... 118

See Also ... 119

NamespaceFilter ... 120

Contents ... 120

See Also ... 120

NamespaceProperties ... 121

Contents ... 121

See Also ... 121

NamespaceSummary ... 122

Contents ... 122

See Also ... 123

Operation ... 124

Contents ... 124

See Also ... 125

OperationFilter ... 127

Contents ... 127

See Also ... 128

OperationSummary ... 129

Contents ... 129

See Also ... 129

PrivateDnsNamespaceChange ... 130

Contents ... 130

See Also ... 130

PrivateDnsNamespaceProperties ... 131

Contents ... 131

See Also ... 131

PrivateDnsNamespacePropertiesChange ... 132

Contents ... 132

See Also ... 132

PrivateDnsPropertiesMutable ... 133

Contents ... 133

See Also ... 133

PrivateDnsPropertiesMutableChange ... 134

Contents ... 134

See Also ... 134

PublicDnsNamespaceChange ... 135

Contents ... 135

See Also ... 135

PublicDnsNamespaceProperties ... 136

Contents ... 136

See Also ... 136

PublicDnsNamespacePropertiesChange ... 137

Contents ... 137

See Also ... 137

(8)

PublicDnsPropertiesMutable ... 138

Contents ... 138

See Also ... 138

PublicDnsPropertiesMutableChange ... 139

Contents ... 139

See Also ... 139

Service ... 140

Contents ... 140

See Also ... 142

ServiceChange ... 143

Contents ... 143

See Also ... 143

ServiceFilter ... 144

Contents ... 144

See Also ... 144

ServiceSummary ... 145

Contents ... 145

See Also ... 146

SOA ... 148

Contents ... 148

See Also ... 148

SOAChange ... 149

Contents ... 149

See Also ... 149

Tag ... 150

Contents ... 150

See Also ... 150

Common Parameters ... 151

Common Errors ... 153

(9)

Welcome

AWS Cloud Map is a fully managed service that you can use to create and maintain a map of the backend services and resources that your applications depend on. Here's how AWS Cloud Map works:

1. You create a namespace that identifies the name that you want to use to locate your resources and also specifies how you want to locate resources: using AWS Cloud Map DiscoverInstances API calls, DNS queries in a VPC, or public DNS queries. Typically, a namespace contains all the services for an application, such as a billing application.

2. You create an AWS Cloud Map service for each type of resource for which you want to use AWS Cloud Map to locate endpoints. For example, you might create services for web servers and database servers.

A service is a template that AWS Cloud Map uses when your application adds another resource, such as another web server. If you chose to locate resources using DNS when you created the namespace, a service contains information about the types of records that you want to use to locate the web server.

A service also indicates whether you want to check the health of the resource and, if so, whether you want to use Route 53 health checks or a third-party health checker.

3. When your application adds a resource, it can call the AWS Cloud Map RegisterInstance API action, which creates a service instance. The service instance contains information about how your application can locate the resource, whether using DNS or using the AWS Cloud Map DiscoverInstances API action.

4. When your application needs to connect to a resource, it calls DiscoverInstances and specifies the namespace and service that are associated with the resource. AWS Cloud Map returns information about how to locate one or more resources. If you specified health checking when you created the service, AWS Cloud Map returns only healthy instances.

AWS Cloud Map is tightly integrated with Amazon Elastic Container Service (Amazon ECS). As new container tasks spin up or down, they automatically register with AWS Cloud Map. You can use the Kubernetes ExternalDNS connector to integrate Amazon Elastic Kubernetes Service with AWS Cloud Map. You can also use AWS Cloud Map to register and locate any cloud resources, such as Amazon EC2 instances, Amazon DynamoDB, Amazon S3 buckets, Amazon Simple Queue Service (Amazon SQS) queues, or APIs deployed on top of Amazon API Gateway, among others. You can specify attribute values for services instances, and clients can use these attributes to filter the resources that AWS Cloud Map returns. For example, an application can request resources in a particular deployment stage, like BETA or PROD.

(10)

Actions

The following actions are supported:

• CreateHttpNamespace (p. 3)

• CreatePrivateDnsNamespace (p. 7)

• CreatePublicDnsNamespace (p. 11)

• CreateService (p. 15)

• DeleteNamespace (p. 21)

• DeleteService (p. 24)

• DeregisterInstance (p. 26)

• DiscoverInstances (p. 29)

• GetInstance (p. 34)

• GetInstancesHealthStatus (p. 37)

• GetNamespace (p. 41)

• GetOperation (p. 44)

• GetService (p. 47)

• ListInstances (p. 50)

• ListNamespaces (p. 54)

• ListOperations (p. 58)

• ListServices (p. 62)

• ListTagsForResource (p. 66)

• RegisterInstance (p. 69)

• TagResource (p. 75)

• UntagResource (p. 78)

• UpdateHttpNamespace (p. 81)

• UpdateInstanceCustomHealthStatus (p. 84)

• UpdatePrivateDnsNamespace (p. 87)

• UpdatePublicDnsNamespace (p. 90)

• UpdateService (p. 93)

(11)

CreateHttpNamespace

CreateHttpNamespace

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 AWS account, see AWS Cloud Map quotas in the AWS Cloud Map Developer Guide.

Request Syntax

{ "CreatorRequestId": "string", "Description": "string", "Name": "string",

"Tags": [ {

"Key": "string", "Value": "string"

} ] }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters (p. 151).

The request accepts the following data in JSON format.

CreatorRequestId (p. 3)

A unique string that identifies the request and that allows failed CreateHttpNamespace requests to be retried without the risk of running the operation twice. CreatorRequestId can be any unique string (for example, a date/time stamp).

Type: String

Length Constraints: Maximum length of 64.

Required: No Description (p. 3)

A description for the namespace.

Type: String

Length Constraints: Maximum length of 1024.

Required: No Name (p. 3)

The name that you want to assign to this namespace.

Type: String

Length Constraints: Maximum length of 1024.

Pattern: ^[!-~]{1,1024}$

(12)

Response Syntax

Required: Yes Tags (p. 3)

The tags to add to the namespace. Each tag consists of a key and an optional value that you define.

Tags keys can be up to 128 characters in length, and tag values can be up to 256 characters in length.

Type: Array of Tag (p. 150) objects

Array Members: Minimum number of 0 items. Maximum number of 200 items.

Required: No

Response Syntax

{ "OperationId": "string"

}

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

OperationId (p. 4)

A value that you can use to determine whether the request completed successfully. To get the status of the operation, see GetOperation.

Type: String

Length Constraints: Maximum length of 255.

Errors

For information about the errors that are common to all actions, see Common Errors (p. 153).

DuplicateRequest

The operation is already in progress.

HTTP Status Code: 400 InvalidInput

One or more specified values aren't valid. For example, a required value might be missing, a numeric value might be outside the allowed range, or a string value might exceed length constraints.

HTTP Status Code: 400 NamespaceAlreadyExists

The namespace that you're trying to create already exists.

HTTP Status Code: 400

(13)

Examples

ResourceLimitExceeded

The resource can't be created because you've reached the quota on the number of resources.

HTTP Status Code: 400 TooManyTagsException

The list of tags on the resource is over the quota. The maximum number of tags that can be applied to a resource is 50.

HTTP Status Code: 400

Examples

CreateHttpNamespace Example

This example illustrates one usage of CreateHttpNamespace.

Sample Request

POST / HTTP/1.1

host:servicediscovery.us-west-2.amazonaws.com x-amz-date:20181118T211703Z

authorization: AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20181118/us-west-2/

servicediscovery/aws4_request,

SignedHeaders=content-length;content-type;host;user-agent;x-amz-date;x-amz- target,

Signature=[calculated-signature]

x-amz-target:Route53AutoNaming_v20170314.CreateHttpNamespace content-type:application/x-amz-json-1.1

content-length:[number of characters in the JSON string]

{

"CreatorRequestId": "example-creator-request-id-0001", "Name": "example-http.com",

"Description": "Example.com AWS Cloud Map HTTP Namespace"

}

Sample Response

HTTP/1.1 200

Content-Length: [number of characters in the JSON string]

Content-Type: application/x-amz-json-1.1 {

"OperationId":"httpvoqozuhfet5kzxoxg-a-response-example"

}

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following:

• AWS Command Line Interface

• AWS SDK for .NET

• AWS SDK for C++

• AWS SDK for Go

(14)

See Also

• AWS SDK for Java V2

• AWS SDK for JavaScript

• AWS SDK for PHP V3

• AWS SDK for Python

• AWS SDK for Ruby V3

(15)

CreatePrivateDnsNamespace

CreatePrivateDnsNamespace

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 AWS account, see AWS Cloud Map quotas in the AWS Cloud Map Developer Guide.

Request Syntax

{ "CreatorRequestId": "string", "Description": "string", "Name": "string",

"Properties": { "DnsProperties": { "SOA": {

"TTL": number }

} },

"Tags": [ {

"Key": "string", "Value": "string"

} ],

"Vpc": "string"

}

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters (p. 151).

The request accepts the following data in JSON format.

CreatorRequestId (p. 7)

A unique string that identifies the request and that allows failed CreatePrivateDnsNamespace requests to be retried without the risk of running the operation twice. CreatorRequestId can be any unique string (for example, a date/timestamp).

Type: String

Length Constraints: Maximum length of 64.

Required: No Description (p. 7)

A description for the namespace.

Type: String

Length Constraints: Maximum length of 1024.

(16)

Response Syntax

Required: No Name (p. 7)

The name that you want to assign to this namespace. When you create a private DNS namespace, AWS Cloud Map automatically creates an Amazon Route 53 private hosted zone that has the same name as the namespace.

Type: String

Length Constraints: Maximum length of 1024.

Pattern: ^[!-~]{1,1024}$

Required: Yes Properties (p. 7)

Properties for the private DNS namespace.

Type: PrivateDnsNamespaceProperties (p. 131) object Required: No

Tags (p. 7)

The tags to add to the namespace. Each tag consists of a key and an optional value that you define.

Tags keys can be up to 128 characters in length, and tag values can be up to 256 characters in length.

Type: Array of Tag (p. 150) objects

Array Members: Minimum number of 0 items. Maximum number of 200 items.

Required: No Vpc (p. 7)

The ID of the Amazon VPC that you want to associate the namespace with.

Type: String

Length Constraints: Maximum length of 64.

Required: Yes

Response Syntax

{

"OperationId": "string"

}

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

OperationId (p. 8)

A value that you can use to determine whether the request completed successfully. To get the status of the operation, see GetOperation.

(17)

Errors

Type: String

Length Constraints: Maximum length of 255.

Errors

For information about the errors that are common to all actions, see Common Errors (p. 153).

DuplicateRequest

The operation is already in progress.

HTTP Status Code: 400 InvalidInput

One or more specified values aren't valid. For example, a required value might be missing, a numeric value might be outside the allowed range, or a string value might exceed length constraints.

HTTP Status Code: 400 NamespaceAlreadyExists

The namespace that you're trying to create already exists.

HTTP Status Code: 400 ResourceLimitExceeded

The resource can't be created because you've reached the quota on the number of resources.

HTTP Status Code: 400 TooManyTagsException

The list of tags on the resource is over the quota. The maximum number of tags that can be applied to a resource is 50.

HTTP Status Code: 400

Examples

CreatePrivateDnsNamespace Example

This example illustrates one usage of CreatePrivateDnsNamespace.

Sample Request

POST / HTTP/1.1

host:servicediscovery.us-west-2.amazonaws.com x-amz-date:20181118T211704Z

authorization: AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20181118/us-west-2/

servicediscovery/aws4_request,

SignedHeaders=content-length;content-type;host;user-agent;x-amz-date;x-amz- target,

Signature=[calculated-signature]

x-amz-target:Route53AutoNaming_v20170314.CreatePrivateDnsNamespace content-type:application/x-amz-json-1.1

content-length:[number of characters in the JSON string]

(18)

See Also

{

"CreatorRequestId": "example-creator-request-id-0002", "Name": "example-private-dns.com",

"Description": "Example.com AWS Cloud Map Private DNS Namespace", "Vpc": "vpc-12345678"

}

Sample Response

HTTP/1.1 200

Content-Length: [number of characters in the JSON string]

Content-Type: application/x-amz-json-1.1

{ "OperationId":"dns1voqozuhfet5kzxoxg-a-response-example"

}

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following:

• AWS Command Line Interface

• AWS SDK for .NET

• AWS SDK for C++

• AWS SDK for Go

• AWS SDK for Java V2

• AWS SDK for JavaScript

• AWS SDK for PHP V3

• AWS SDK for Python

• AWS SDK for Ruby V3

(19)

CreatePublicDnsNamespace

CreatePublicDnsNamespace

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 AWS account, see AWS Cloud Map quotas in the AWS Cloud Map Developer Guide.

Important

The CreatePublicDnsNamespace API operation is not supported in the AWS GovCloud (US) Regions.

Request Syntax

{ "CreatorRequestId": "string", "Description": "string", "Name": "string",

"Properties": { "DnsProperties": { "SOA": {

"TTL": number }

} },

"Tags": [ {

"Key": "string", "Value": "string"

} ] }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters (p. 151).

The request accepts the following data in JSON format.

CreatorRequestId (p. 11)

A unique string that identifies the request and that allows failed CreatePublicDnsNamespace requests to be retried without the risk of running the operation twice. CreatorRequestId can be any unique string (for example, a date/timestamp).

Type: String

Length Constraints: Maximum length of 64.

Required: No Description (p. 11)

A description for the namespace.

Type: String

Length Constraints: Maximum length of 1024.

(20)

Response Syntax

Required: No Name (p. 11)

The name that you want to assign to this namespace.

Type: String

Length Constraints: Maximum length of 1024.

Pattern: ^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z0-9]([a-zA- Z0-9\-]{0,61}[a-zA-Z0-9])?$

Required: Yes Properties (p. 11)

Properties for the public DNS namespace.

Type: PublicDnsNamespaceProperties (p. 136) object Required: No

Tags (p. 11)

The tags to add to the namespace. Each tag consists of a key and an optional value that you define.

Tags keys can be up to 128 characters in length, and tag values can be up to 256 characters in length.

Type: Array of Tag (p. 150) objects

Array Members: Minimum number of 0 items. Maximum number of 200 items.

Required: No

Response Syntax

{ "OperationId": "string"

}

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

OperationId (p. 12)

A value that you can use to determine whether the request completed successfully. To get the status of the operation, see GetOperation.

Type: String

Length Constraints: Maximum length of 255.

Errors

For information about the errors that are common to all actions, see Common Errors (p. 153).

(21)

Examples

DuplicateRequest

The operation is already in progress.

HTTP Status Code: 400 InvalidInput

One or more specified values aren't valid. For example, a required value might be missing, a numeric value might be outside the allowed range, or a string value might exceed length constraints.

HTTP Status Code: 400 NamespaceAlreadyExists

The namespace that you're trying to create already exists.

HTTP Status Code: 400 ResourceLimitExceeded

The resource can't be created because you've reached the quota on the number of resources.

HTTP Status Code: 400 TooManyTagsException

The list of tags on the resource is over the quota. The maximum number of tags that can be applied to a resource is 50.

HTTP Status Code: 400

Examples

CreatePublicDnsNamespace Example

This example illustrates one usage of CreatePublicDnsNamespace.

Sample Request

POST / HTTP/1.1

host:servicediscovery.us-west-2.amazonaws.com x-amz-date:20181118T211705Z

authorization: AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20181118/us-west-2/

servicediscovery/aws4_request,

SignedHeaders=content-length;content-type;host;user-agent;x-amz-date;x-amz- target,

Signature=[calculated-signature]

x-amz-target:Route53AutoNaming_v20170314.CreatePublicDnsNamespace content-type:application/x-amz-json-1.1

content-length:[number of characters in the JSON string]

{

"CreatorRequestId": "example-creator-request-id-0003", "Name": "example-public-dns.com",

"Description": "Example.com AWS Cloud Map Public DNS Namespace"

}

Sample Response

HTTP/1.1 200

(22)

See Also

Content-Length: [number of characters in the JSON string]

Content-Type: application/x-amz-json-1.1

{ "OperationId":"dns2voqozuhfet5kzxoxg-a-response-example"

}

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following:

• AWS Command Line Interface

• AWS SDK for .NET

• AWS SDK for C++

• AWS SDK for Go

• AWS SDK for Java V2

• AWS SDK for JavaScript

• AWS SDK for PHP V3

• AWS SDK for Python

• AWS SDK for Ruby V3

(23)

CreateService

CreateService

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 AWS 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 AWS Cloud Map quotas in the AWS Cloud Map Developer Guide.

Request Syntax

{ "CreatorRequestId": "string", "Description": "string", "DnsConfig": {

"DnsRecords": [ {

"TTL": number, "Type": "string"

} ],

"NamespaceId": "string", "RoutingPolicy": "string"

},

"HealthCheckConfig": { "FailureThreshold": number, "ResourcePath": "string", "Type": "string"

},

"HealthCheckCustomConfig": { "FailureThreshold": number },

"Name": "string",

"NamespaceId": "string", "Tags": [

{

"Key": "string", "Value": "string"

} ],

"Type": "string"

}

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters (p. 151).

(24)

Request Parameters

The request accepts the following data in JSON format.

CreatorRequestId (p. 15)

A unique string that identifies the request and that allows failed CreateService requests to be retried without the risk of running the operation twice. CreatorRequestId can be any unique string (for example, a date/timestamp).

Type: String

Length Constraints: Maximum length of 64.

Required: No Description (p. 15)

A description for the service.

Type: String

Length Constraints: Maximum length of 1024.

Required: No DnsConfig (p. 15)

A complex type that contains information about the Amazon Route 53 records that you want AWS Cloud Map to create when you register an instance.

Type: DnsConfig (p. 98) object Required: No

HealthCheckConfig (p. 15)

Public DNS and HTTP namespaces only. A complex type that contains settings for an optional Route 53 health check. If you specify settings for a health check, AWS Cloud Map associates the health check with all the Route 53 DNS records that you specify in DnsConfig.

Important

If you specify a health check configuration, you can specify either HealthCheckCustomConfig or HealthCheckConfig but not both.

For information about the charges for health checks, see AWS Cloud Map Pricing.

Type: HealthCheckConfig (p. 104) object Required: No

HealthCheckCustomConfig (p. 15)

A complex type that contains information about an optional custom health check.

Important

If you specify a health check configuration, you can specify either HealthCheckCustomConfig or HealthCheckConfig but not both.

You can't add, update, or delete a HealthCheckCustomConfig configuration from an existing service.

Type: HealthCheckCustomConfig (p. 107) object Required: No

Name (p. 15)

The name that you want to assign to the service.

(25)

Response Syntax

If you want AWS Cloud Map to create an SRV record when you register an instance and you're using a system that requires a specific SRV format, such as HAProxy, specify the following for Name:

• Start the name with an underscore (_), such as _exampleservice.

• End the name with ._protocol, such as ._tcp.

When you register an instance, AWS Cloud Map creates an SRV record and assigns a name to the record by concatenating the service name and the namespace name (for example,

_exampleservice._tcp.example.com).

Note

For services that are accessible by DNS queries, you can't create multiple services with names that differ only by case (such as EXAMPLE and example). Otherwise, these services have the same DNS name and can't be distinguished. However, if you use a namespace that's only accessible by API calls, then you can create services that with names that differ only by case.

Type: String

Pattern: ((?=^.{1,127}$)^([a-zA-Z0-9_][a-zA-Z0-9-_]{0,61}[a-zA-Z0-9_]|[a-zA- Z0-9])(\.([a-zA-Z0-9_][a-zA-Z0-9-_]{0,61}[a-zA-Z0-9_]|[a-zA-Z0-9]))*$)|(^\.

$)

Required: Yes NamespaceId (p. 15)

The ID of the namespace that you want to use to create the service. The namespace ID must be specified, but it can be specified either here or in the DnsConfig object.

Type: String

Length Constraints: Maximum length of 64.

Required: No Tags (p. 15)

The tags to add to the service. Each tag consists of a key and an optional value that you define. Tags keys can be up to 128 characters in length, and tag values can be up to 256 characters in length.

Type: Array of Tag (p. 150) objects

Array Members: Minimum number of 0 items. Maximum number of 200 items.

Required: No Type (p. 15)

If present, specifies that the service instances are only discoverable using the DiscoverInstances API operation. No DNS records is registered for the service instances. The only valid value is HTTP.

Type: String Valid Values: HTTP Required: No

Response Syntax

{ "Service": {

(26)

Response Elements

"Arn": "string", "CreateDate": number,

"CreatorRequestId": "string", "Description": "string", "DnsConfig": {

"DnsRecords": [ {

"TTL": number, "Type": "string"

} ],

"NamespaceId": "string", "RoutingPolicy": "string"

},

"HealthCheckConfig": { "FailureThreshold": number, "ResourcePath": "string", "Type": "string"

},

"HealthCheckCustomConfig": { "FailureThreshold": number },

"Id": "string",

"InstanceCount": number, "Name": "string",

"NamespaceId": "string", "Type": "string"

}}

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

Service (p. 17)

A complex type that contains information about the new service.

Type: Service (p. 140) object

Errors

For information about the errors that are common to all actions, see Common Errors (p. 153).

InvalidInput

One or more specified values aren't valid. For example, a required value might be missing, a numeric value might be outside the allowed range, or a string value might exceed length constraints.

HTTP Status Code: 400 NamespaceNotFound

No namespace exists with the specified ID.

HTTP Status Code: 400 ResourceLimitExceeded

The resource can't be created because you've reached the quota on the number of resources.

(27)

Examples

HTTP Status Code: 400 ServiceAlreadyExists

The service can't be created because a service with the same name already exists.

HTTP Status Code: 400 TooManyTagsException

The list of tags on the resource is over the quota. The maximum number of tags that can be applied to a resource is 50.

HTTP Status Code: 400

Examples

CreateService Example

This example illustrates one usage of CreateService.

Sample Request

POST / HTTP/1.1

host:servicediscovery.us-west-2.amazonaws.com x-amz-date:20181118T211706Z

authorization: AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20181118/us-west-2/

servicediscovery/aws4_request,

SignedHeaders=content-length;content-type;host;user-agent;x-amz-date;x-amz- target,

Signature=[calculated-signature]

x-amz-target:Route53AutoNaming_v20170314.CreateService content-type:application/x-amz-json-1.1

content-length:[number of characters in the JSON string]

{

"CreatorRequestId": "example-creator-request-id-0004", "NamespaceId": "ns-e4anhexample0004",

"Name": "example-http-service", "HealthCheckConfig": {

"Type": "HTTPS", "ResourcePath": "/", "FailureThreshold": 1 },

"Description": "Example.com AWS Cloud Map HTTP Service"

}

Sample Response

HTTP/1.1 200

Content-Length: [number of characters in the JSON string]

Content-Type: application/x-amz-json-1.1 {

"Service": {

"Arn": "arn:aws:servicediscovery:us-west-2:123456789120:service/srv- e4anhexample0004",

"CreateDate": "20181118T211707Z",

"CreatorRequestId": "example-creator-request-id-0004", "Description": "Example.com AWS Cloud Map HTTP Service", "HealthCheckConfig": {

(28)

See Also

"FailureThreshold": 1, "ResourcePath": "/", "Type": "HTTPS"

},

"Id": "srv-e4anhexample0004", "Name": "example-http-service", "NamespaceId": "ns-e4anhexample0004"

} }

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following:

• AWS Command Line Interface

• AWS SDK for .NET

• AWS SDK for C++

• AWS SDK for Go

• AWS SDK for Java V2

• AWS SDK for JavaScript

• AWS SDK for PHP V3

• AWS SDK for Python

• AWS SDK for Ruby V3

(29)

DeleteNamespace

DeleteNamespace

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

Request Syntax

{ "Id": "string"

}

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters (p. 151).

The request accepts the following data in JSON format.

Id (p. 21)

The ID of the namespace that you want to delete.

Type: String

Length Constraints: Maximum length of 64.

Required: Yes

Response Syntax

{ "OperationId": "string"

}

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

OperationId (p. 21)

A value that you can use to determine whether the request completed successfully. To get the status of the operation, see GetOperation.

Type: String

Length Constraints: Maximum length of 255.

Errors

For information about the errors that are common to all actions, see Common Errors (p. 153).

(30)

Examples

DuplicateRequest

The operation is already in progress.

HTTP Status Code: 400 InvalidInput

One or more specified values aren't valid. For example, a required value might be missing, a numeric value might be outside the allowed range, or a string value might exceed length constraints.

HTTP Status Code: 400 NamespaceNotFound

No namespace exists with the specified ID.

HTTP Status Code: 400 ResourceInUse

The specified resource can't be deleted because it contains other resources. For example, you can't delete a service that contains any instances.

HTTP Status Code: 400

Examples

DeleteNamespace Example

This example illustrates one usage of DeleteNamespace.

Sample Request

POST / HTTP/1.1

host:servicediscovery.us-west-2.amazonaws.com x-amz-date:20181118T211707Z

authorization: AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20181118/us-west-2/

servicediscovery/aws4_request,

SignedHeaders=content-length;content-type;host;user-agent;x-amz-date;x-amz- target,

Signature=[calculated-signature]

x-amz-target:Route53AutoNaming_v20170314.DeleteNamespace content-type:application/x-amz-json-1.1

content-length:[number of characters in the JSON string]

{

"Id": "ns-e4anhexample0004"

}

Sample Response

HTTP/1.1 200

Content-Length: [number of characters in the JSON string]

Content-Type: application/x-amz-json-1.1

{ "OperationId":"deleteelozuhfet5kzxoxg-a-response-example"

}

(31)

See Also

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following:

• AWS Command Line Interface

• AWS SDK for .NET

• AWS SDK for C++

• AWS SDK for Go

• AWS SDK for Java V2

• AWS SDK for JavaScript

• AWS SDK for PHP V3

• AWS SDK for Python

• AWS SDK for Ruby V3

(32)

DeleteService

DeleteService

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

Request Syntax

{ "Id": "string"

}

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters (p. 151).

The request accepts the following data in JSON format.

Id (p. 24)

The ID of the service that you want to delete.

Type: String

Length Constraints: Maximum length of 64.

Required: Yes

Response Elements

If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body.

Errors

For information about the errors that are common to all actions, see Common Errors (p. 153).

InvalidInput

One or more specified values aren't valid. For example, a required value might be missing, a numeric value might be outside the allowed range, or a string value might exceed length constraints.

HTTP Status Code: 400 ResourceInUse

The specified resource can't be deleted because it contains other resources. For example, you can't delete a service that contains any instances.

HTTP Status Code: 400 ServiceNotFound

No service exists with the specified ID.

HTTP Status Code: 400

(33)

Examples

Examples

DeleteService Example

This example illustrates one usage of DeleteService.

Sample Request

POST / HTTP/1.1

host:servicediscovery.us-west-2.amazonaws.com x-amz-date:20181118T211708Z

authorization: AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20181118/us-west-2/

servicediscovery/aws4_request,

SignedHeaders=content-length;content-type;host;user-agent;x-amz-date;x-amz- target,

Signature=[calculated-signature]

x-amz-target:Route53AutoNaming_v20170314.DeleteService content-type:application/x-amz-json-1.1

content-length:[number of characters in the JSON string]

{ "Id": "srv-e4anhexample0004"

}

Sample Response

HTTP/1.1 200

Content-Length: [number of characters in the JSON string]

Content-Type: application/x-amz-json-1.1 {}

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following:

• AWS Command Line Interface

• AWS SDK for .NET

• AWS SDK for C++

• AWS SDK for Go

• AWS SDK for Java V2

• AWS SDK for JavaScript

• AWS SDK for PHP V3

• AWS SDK for Python

• AWS SDK for Ruby V3

(34)

DeregisterInstance

DeregisterInstance

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

Request Syntax

{ "InstanceId": "string", "ServiceId": "string"

}

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters (p. 151).

The request accepts the following data in JSON format.

InstanceId (p. 26)

The value that you specified for Id in the RegisterInstance request.

Type: String

Length Constraints: Maximum length of 64.

Required: Yes ServiceId (p. 26)

The ID of the service that the instance is associated with.

Type: String

Length Constraints: Maximum length of 64.

Required: Yes

Response Syntax

{ "OperationId": "string"

}

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

OperationId (p. 26)

A value that you can use to determine whether the request completed successfully. To get the status of the operation, see GetOperation.

(35)

Errors

Type: String

Length Constraints: Maximum length of 255.

Errors

For information about the errors that are common to all actions, see Common Errors (p. 153).

DuplicateRequest

The operation is already in progress.

HTTP Status Code: 400 InstanceNotFound

No instance exists with the specified ID, or the instance was recently registered, and information about the instance hasn't propagated yet.

HTTP Status Code: 400 InvalidInput

One or more specified values aren't valid. For example, a required value might be missing, a numeric value might be outside the allowed range, or a string value might exceed length constraints.

HTTP Status Code: 400 ResourceInUse

The specified resource can't be deleted because it contains other resources. For example, you can't delete a service that contains any instances.

HTTP Status Code: 400 ServiceNotFound

No service exists with the specified ID.

HTTP Status Code: 400

Examples

DeregisterInstance Example

This example illustrates one usage of DeregisterInstance.

Sample Request

POST / HTTP/1.1

host:servicediscovery.us-west-2.amazonaws.com x-amz-date:20181118T211816Z

authorization: AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20181118/us-west-2/

servicediscovery/aws4_request,

SignedHeaders=content-length;content-type;host;user-agent;x-amz-date;x-amz- target,

Signature=[calculated-signature]

x-amz-target:Route53AutoNaming_v20170314.DeregisterInstance content-type:application/x-amz-json-1.1

content-length:[number of characters in the JSON string]

(36)

See Also

{ "InstanceId": "i-abcd1234", "ServiceId": "srv-e4anhexample0004"

}

Sample Response

HTTP/1.1 200

Content-Length: [number of characters in the JSON string]

Content-Type: application/x-amz-json-1.1 {

"OperationId":"httpvoqozuhfet5kzxoxg-a-response-example"

}

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following:

• AWS Command Line Interface

• AWS SDK for .NET

• AWS SDK for C++

• AWS SDK for Go

• AWS SDK for Java V2

• AWS SDK for JavaScript

• AWS SDK for PHP V3

• AWS SDK for Python

• AWS SDK for Ruby V3

(37)

DiscoverInstances

DiscoverInstances

Discovers registered instances for a specified namespace and service. You can use DiscoverInstances to discover instances for any type of namespace. For public and private DNS namespaces, you can also use DNS queries to discover instances.

Request Syntax

{ "HealthStatus": "string", "MaxResults": number, "NamespaceName": "string", "OptionalParameters": { "string" : "string"

},

"QueryParameters": { "string" : "string"

},

"ServiceName": "string"

}

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters (p. 151).

The request accepts the following data in JSON format.

HealthStatus (p. 29)

The health status of the instances that you want to discover. This parameter is ignored for services that don't have a health check configured, and all instances are returned.

HEALTHY

Returns healthy instances.

UNHEALTHY

Returns unhealthy instances.

ALL

Returns all instances.

HEALTHY_OR_ELSE_ALL

Returns healthy instances, unless none are reporting a healthy state. In that case, return all instances. This is also called failing open.

Type: String

Valid Values: HEALTHY | UNHEALTHY | ALL | HEALTHY_OR_ELSE_ALL Required: No

MaxResults (p. 29)

The maximum number of instances that you want AWS Cloud Map to return in the response to a DiscoverInstances request. If you don't specify a value for MaxResults, AWS Cloud Map returns up to 100 instances.

(38)

Request Parameters

Type: Integer

Valid Range: Minimum value of 1. Maximum value of 1000.

Required: No NamespaceName (p. 29)

The HttpName name of the namespace. It's found in the HttpProperties member of the Properties member of the namespace.

Type: String

Length Constraints: Maximum length of 1024.

Required: Yes

OptionalParameters (p. 29)

Opportunistic filters to scope the results based on custom attributes. If there are instances that match both the filters specified in both the QueryParameters parameter and this parameter, all of these instances are returned. Otherwise, the filters are ignored, and only instances that match the filters that are specified in the QueryParameters parameter are returned.

Type: String to string map

Key Length Constraints: Maximum length of 255.

Key Pattern: ^[a-zA-Z0-9!-~]+$

Value Length Constraints: Maximum length of 1024.

Value Pattern: ^([a-zA-Z0-9!-~][ \ta-zA-Z0-9!-~]*){0,1}[a-zA-Z0-9!-~]{0,1}$

Required: No

QueryParameters (p. 29)

Filters to scope the results based on custom attributes for the instance (for example, {version=v1, az=1a}). Only instances that match all the specified key-value pairs are returned.

Type: String to string map

Key Length Constraints: Maximum length of 255.

Key Pattern: ^[a-zA-Z0-9!-~]+$

Value Length Constraints: Maximum length of 1024.

Value Pattern: ^([a-zA-Z0-9!-~][ \ta-zA-Z0-9!-~]*){0,1}[a-zA-Z0-9!-~]{0,1}$

Required: No ServiceName (p. 29)

The name of the service that you specified when you registered the instance.

Type: String

Pattern: ((?=^.{1,127}$)^([a-zA-Z0-9_][a-zA-Z0-9-_]{0,61}[a-zA-Z0-9_]|[a-zA- Z0-9])(\.([a-zA-Z0-9_][a-zA-Z0-9-_]{0,61}[a-zA-Z0-9_]|[a-zA-Z0-9]))*$)|(^\.

$)

(39)

Response Syntax

Required: Yes

Response Syntax

{

"Instances": [ {

"Attributes": { "string" : "string"

},

"HealthStatus": "string", "InstanceId": "string", "NamespaceName": "string", "ServiceName": "string"

} ]}

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

Instances (p. 31)

A complex type that contains one HttpInstanceSummary for each registered instance.

Type: Array of HttpInstanceSummary (p. 109) objects

Errors

For information about the errors that are common to all actions, see Common Errors (p. 153).

InvalidInput

One or more specified values aren't valid. For example, a required value might be missing, a numeric value might be outside the allowed range, or a string value might exceed length constraints.

HTTP Status Code: 400 NamespaceNotFound

No namespace exists with the specified ID.

HTTP Status Code: 400 RequestLimitExceeded

The operation can't be completed because you've reached the quota for the number of requests. For more information, see AWS Cloud Map API request throttling quota in the AWS Cloud Map Developer Guide.

HTTP Status Code: 400 ServiceNotFound

No service exists with the specified ID.

(40)

Examples

HTTP Status Code: 400

Examples

DiscoverInstances Example

This example illustrates one usage of DiscoverInstances.

Sample Request

POST / HTTP/1.1

host:data-servicediscovery.us-west-2.amazonaws.com x-amz-date:20181118T211819Z

authorization: AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20181118/us-west-2/

servicediscovery/aws4_request,

SignedHeaders=content-length;content-type;host;user-agent;x-amz-date;x-amz- target,

Signature=[calculated-signature]

x-amz-target:Route53AutoNaming_v20170314.DiscoverInstances content-type:application/x-amz-json-1.1

content-length:[number of characters in the JSON string]

{ "NamespaceName": "example-public-dns.com", "ServiceName": "example-dns-pub-service"

}

Sample Response

HTTP/1.1 200

Content-Length: [number of characters in the JSON string]

Content-Type: application/x-amz-json-1.1 {

"Instances": [ {

"Attributes": {

"AWS_INSTANCE_IPV4": "192.0.2.44", "AWS_INSTANCE_PORT": "80",

"color": "green", "region": "us-west-2", "stage": "beta"

},

"HealthStatus": "HEALTHY", "InstanceId": "i-abcd1234",

"NamespaceName": "example-public-dns.com", "ServiceName": "example-dns-pub-service"

} ] }

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following:

• AWS Command Line Interface

• AWS SDK for .NET

(41)

See Also

• AWS SDK for C++

• AWS SDK for Go

• AWS SDK for Java V2

• AWS SDK for JavaScript

• AWS SDK for PHP V3

• AWS SDK for Python

• AWS SDK for Ruby V3

(42)

GetInstance

GetInstance

Gets information about a specified instance.

Request Syntax

{ "InstanceId": "string", "ServiceId": "string"

}

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters (p. 151).

The request accepts the following data in JSON format.

InstanceId (p. 34)

The ID of the instance that you want to get information about.

Type: String

Length Constraints: Maximum length of 64.

Required: Yes ServiceId (p. 34)

The ID of the service that the instance is associated with.

Type: String

Length Constraints: Maximum length of 64.

Required: Yes

Response Syntax

{ "Instance": { "Attributes": { "string" : "string"

},

"CreatorRequestId": "string", "Id": "string"

}}

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

(43)

Errors

Instance (p. 34)

A complex type that contains information about a specified instance.

Type: Instance (p. 113) object

Errors

For information about the errors that are common to all actions, see Common Errors (p. 153).

InstanceNotFound

No instance exists with the specified ID, or the instance was recently registered, and information about the instance hasn't propagated yet.

HTTP Status Code: 400 InvalidInput

One or more specified values aren't valid. For example, a required value might be missing, a numeric value might be outside the allowed range, or a string value might exceed length constraints.

HTTP Status Code: 400 ServiceNotFound

No service exists with the specified ID.

HTTP Status Code: 400

Examples

GetInstance Example

This example illustrates one usage of GetInstance.

Sample Request

POST / HTTP/1.1

host:servicediscovery.us-west-2.amazonaws.com x-amz-date:20181118T211816Z

authorization: AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20181118/us-west-2/

servicediscovery/aws4_request,

SignedHeaders=content-length;content-type;host;user-agent;x-amz-date;x-amz- target,

Signature=[calculated-signature]

x-amz-target:Route53AutoNaming_v20170314.GetInstance content-type:application/x-amz-json-1.1

content-length:[number of characters in the JSON string]

{

"InstanceId": "i-abcd1234", "ServiceId": "srv-e4anhexample0004"

}

Sample Response

HTTP/1.1 200

(44)

See Also

Content-Length: [number of characters in the JSON string]

Content-Type: application/x-amz-json-1.1 {

"Instance": {

"Id": "i-abcd1234", "Attributes": {

"AWS_INSTANCE_IPV4": "192.0.2.44", "AWS_INSTANCE_PORT": "80",

"color": "green", "region": "us-west-2", "stage": "beta"

} } }

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following:

• AWS Command Line Interface

• AWS SDK for .NET

• AWS SDK for C++

• AWS SDK for Go

• AWS SDK for Java V2

• AWS SDK for JavaScript

• AWS SDK for PHP V3

• AWS SDK for Python

• AWS SDK for Ruby V3

(45)

GetInstancesHealthStatus

GetInstancesHealthStatus

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

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

Request Syntax

{ "Instances": [ "string" ], "MaxResults": number, "NextToken": "string", "ServiceId": "string"

}

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters (p. 151).

The request accepts the following data in JSON format.

Instances (p. 37)

An array that contains the IDs of all the instances that you want to get the health status for.

If you omit Instances, AWS Cloud Map returns the health status for all the instances that are associated with the specified service.

NoteTo get the IDs for the instances that you've registered by using a specified service, submit a ListInstances request.

Type: Array of strings

Array Members: Minimum number of 1 item.

Length Constraints: Maximum length of 64.

Required: No MaxResults (p. 37)

The maximum number of instances that you want AWS Cloud Map to return in the response to a GetInstancesHealthStatus request. If you don't specify a value for MaxResults, AWS Cloud Map returns up to 100 instances.

Type: Integer

Valid Range: Minimum value of 1. Maximum value of 100.

Required: No NextToken (p. 37)

For the first GetInstancesHealthStatus request, omit this value.

(46)

Response Syntax

If more than MaxResults instances match the specified criteria, you can submit another GetInstancesHealthStatus request to get the next group of results. Specify the value of NextToken from the previous response in the next request.

Type: String

Length Constraints: Maximum length of 4096.

Required: No ServiceId (p. 37)

The ID of the service that the instance is associated with.

Type: String

Length Constraints: Maximum length of 64.

Required: Yes

Response Syntax

{ "NextToken": "string", "Status": {

"string" : "string"

}}

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

NextToken (p. 38)

If more than MaxResults instances match the specified criteria, you can submit another GetInstancesHealthStatus request to get the next group of results. Specify the value of NextToken from the previous response in the next request.

Type: String

Length Constraints: Maximum length of 4096.

Status (p. 38)

A complex type that contains the IDs and the health status of the instances that you specified in the GetInstancesHealthStatus request.

Type: String to string map

Key Length Constraints: Maximum length of 64.

Valid Values: HEALTHY | UNHEALTHY | UNKNOWN

Errors

For information about the errors that are common to all actions, see Common Errors (p. 153).

(47)

Examples

InstanceNotFound

No instance exists with the specified ID, or the instance was recently registered, and information about the instance hasn't propagated yet.

HTTP Status Code: 400 InvalidInput

One or more specified values aren't valid. For example, a required value might be missing, a numeric value might be outside the allowed range, or a string value might exceed length constraints.

HTTP Status Code: 400 ServiceNotFound

No service exists with the specified ID.

HTTP Status Code: 400

Examples

GetInstancesHealthStatus Example

This example illustrates one usage of GetInstancesHealthStatus.

Sample Request

POST / HTTP/1.1

host:servicediscovery.us-west-2.amazonaws.com x-amz-date:20181118T211818Z

authorization: AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20181118/us-west-2/

servicediscovery/aws4_request,

SignedHeaders=content-length;content-type;host;user-agent;x-amz-date;x-amz- target,

Signature=[calculated-signature]

x-amz-target:Route53AutoNaming_v20170314.GetInstancesHealthStatus content-type:application/x-amz-json-1.1

content-length:[number of characters in the JSON string]

{ "ServiceId": "srv-e4anhexample0004"

}

Sample Response

HTTP/1.1 200

Content-Length: [number of characters in the JSON string]

Content-Type: application/x-amz-json-1.1 {

"Status": {

"i-abcd1234": "HEALTHY", "i-abcd1235": "UNHEALTHY"

} }

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following:

(48)

See Also

• AWS Command Line Interface

• AWS SDK for .NET

• AWS SDK for C++

• AWS SDK for Go

• AWS SDK for Java V2

• AWS SDK for JavaScript

• AWS SDK for PHP V3

• AWS SDK for Python

• AWS SDK for Ruby V3

(49)

GetNamespace

GetNamespace

Gets information about a namespace.

Request Syntax

{

"Id": "string"

}

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters (p. 151).

The request accepts the following data in JSON format.

Id (p. 41)

The ID of the namespace that you want to get information about.

Type: String

Length Constraints: Maximum length of 64.

Required: Yes

Response Syntax

{

"Namespace": { "Arn": "string", "CreateDate": number,

"CreatorRequestId": "string", "Description": "string", "Id": "string",

"Name": "string", "Properties": { "DnsProperties": {

"HostedZoneId": "string", "SOA": {

"TTL": number }

},

"HttpProperties": { "HttpName": "string"

} },

"ServiceCount": number, "Type": "string"

}}

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

(50)

Errors

The following data is returned in JSON format by the service.

Namespace (p. 41)

A complex type that contains information about the specified namespace.

Type: Namespace (p. 118) object

Errors

For information about the errors that are common to all actions, see Common Errors (p. 153).

InvalidInput

One or more specified values aren't valid. For example, a required value might be missing, a numeric value might be outside the allowed range, or a string value might exceed length constraints.

HTTP Status Code: 400 NamespaceNotFound

No namespace exists with the specified ID.

HTTP Status Code: 400

Examples

GetNamespace Example

This example illustrates one usage of GetNamespace.

Sample Request

POST / HTTP/1.1

host:servicediscovery.us-west-2.amazonaws.com x-amz-date:20181118T211711Z

authorization: AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20181118/us-west-2/

servicediscovery/aws4_request,

SignedHeaders=content-length;content-type;host;user-agent;x-amz-date;x-amz- target,

Signature=[calculated-signature]

x-amz-target:Route53AutoNaming_v20170314.GetNamespace content-type:application/x-amz-json-1.1

content-length:[number of characters in the JSON string]

{

"Id": "ns-e4anhexample0004"

}

Sample Response

HTTP/1.1 200

Content-Length: [number of characters in the JSON string]

Content-Type: application/x-amz-json-1.1 { "Namespace": {

(51)

See Also

"Arn": "arn:aws:servicediscovery:us-west-2: 123456789120:namespace/ns- e1tpmexample0001",

"CreateDate": "20181118T211712Z",

"CreatorRequestId": "example-creator-request-id-0001", "Description": "Example.com AWS Cloud Map HTTP Namespace", "Id": "ns-e1tpmexample0001",

"Name": "example-http.com", "Properties": {

"DnsProperties": {}, "HttpProperties": {

"HttpName": "example-http.com"

} },

"Type": "HTTP"

} }

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following:

• AWS Command Line Interface

• AWS SDK for .NET

• AWS SDK for C++

• AWS SDK for Go

• AWS SDK for Java V2

• AWS SDK for JavaScript

• AWS SDK for PHP V3

• AWS SDK for Python

• AWS SDK for Ruby V3

參考文獻

相關文件

1 Generalized Extreme Value Distribution Let Y be a random variable having a generalized extreme- value (GEV) distribution with shape parameter ξ, loca- tion parameter µ and

For the more able students, teachers might like to ask them to perform their play to an intended audience as an extended activity. The intended audience might be a primary

If the best number of degrees of freedom for pure error can be specified, we might use some standard optimality criterion to obtain an optimal design for the given model, and

Lemma 3 An American call or a European call on a non-dividend-paying stock is never worth less than its intrinsic value.. • An American call cannot be worth less than its

Lemma 3 An American call or a European call on a non-dividend-paying stock is never worth less than its intrinsic value.. • An American call cannot be worth less than its

Lemma 2 An American call or a European call on a non-dividend-paying stock is never worth less than its intrinsic value.. • An American call cannot be worth less than its

• An algorithm is any well-defined computational procedure that takes some value, or set of values, as input and produces some value, or set of values, as output.. • An algorithm is

If necessary, you might like to guide students to read over the notes and discuss the roles and language required of a chairperson or secretary to prepare them for the activity9.