CreatePrivateDnsNamespace - AWS Cloud Map

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.

The request accepts the following data in JSON format.

CreatorRequestId

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

A description for the namespace.

Type: String

Length Constraints: Maximum length of 1024.

Required: No

Name

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 253.

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

Required: Yes

Properties

Properties for the private DNS namespace.

Type: PrivateDnsNamespaceProperties object

Required: No

Tags

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 objects

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

Required: No

Vpc

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

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.

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] { "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: