AWS::ServiceDiscovery::PrivateDnsNamespace
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.
Syntax
To declare this entity in your AWS CloudFormation template, use the following syntax:
JSON
{ "Type" : "AWS::ServiceDiscovery::PrivateDnsNamespace", "Properties" : { "Description" :
String
, "Name" :String
, "Properties" :Properties
, "Tags" :[ Tag, ... ]
, "Vpc" :String
} }
YAML
Type: AWS::ServiceDiscovery::PrivateDnsNamespace Properties: Description:
String
Name:String
Properties:Properties
Tags:- Tag
Vpc:String
Properties
Description
-
A description for the namespace.
Required: No
Type: String
Maximum:
1024
Update requires: No interruption
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.
Required: Yes
Type: String
Pattern:
^[!-~]{1,253}$
Maximum:
253
Update requires: Replacement
Properties
-
Properties for the private DNS namespace.
Required: No
Type: Properties
Update requires: No interruption
-
The tags for the namespace. Each tag consists of a key and an optional value, both of which you define. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.
Required: No
Type: Array of Tag
Minimum:
0
Maximum:
200
Update requires: Updates are not supported.
Vpc
-
The ID of the Amazon VPC that you want to associate the namespace with.
Required: Yes
Type: String
Maximum:
64
Update requires: Replacement
Return values
Ref
When you pass the logical ID of this resource to the intrinsic Ref
function, Ref
returns the value of Id
for the namespace, such as
ns-e4anhexample0004
.
For more information about using the Ref
function, see Ref
.
Fn::GetAtt
The Fn::GetAtt
intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.
For more information about using the Fn::GetAtt
intrinsic function, see Fn::GetAtt
.
Arn
-
The Amazon Resource Name (ARN) of the private namespace.
HostedZoneId
-
The ID for the Route 53 hosted zone that AWS Cloud Map creates when you create a namespace.
Id
-
The ID of the private namespace.
Examples
Create a private DNS namespace
The following example creates a private DNS namespace named private-example.com
.
JSON
{ "Resources": { "PrivateDnsNamespace": { "Type": "AWS::ServiceDiscovery::PrivateDnsNamespace", "Properties": { "Description": "AWS Cloud Map private DNS namespace for resources for example.com website", "Vpc": "vpc-12345678", "Name": "private-example.com", "Properties": { "DnsProperties": { "SOA": { "TTL": 100 } } } } } } }
YAML
Resources: PrivateDnsNamespace: Type: AWS::ServiceDiscovery::PrivateDnsNamespace Properties: Description: AWS Cloud Map private DNS namespace for resources for example.com website Vpc: vpc-12345678 Name: private-example.com Properties: DnsProperties: SOA: TTL: 100
See also
-
CreatePrivateDnsNamespace in the AWS Cloud Map API Reference