AWS Cloud Map Private Dns Namespace

This page shows how to write Terraform and CloudFormation for AWS Cloud Map Private Dns Namespace and write them securely.

aws_service_discovery_private_dns_namespace (Terraform)

The Private Dns Namespace in AWS Cloud Map can be configured in Terraform with the resource name aws_service_discovery_private_dns_namespace. The following sections describe 5 examples of how to use the resource and its parameters.

Example Usage from GitHub

service_discovery.tf#L1
resource "aws_service_discovery_private_dns_namespace" "proxy" {
  name = "movieanalyst.org"
  vpc  = aws_vpc.test.id
}

resource "aws_service_discovery_service" "proxy_sd" {
service_discovery_namespace.tf#L1
resource "aws_service_discovery_private_dns_namespace" "demo" {
    name = "demo"
    description = "Service Discovery namespace for elasticsearch"
    vpc = aws_vpc.es_vpc.id
}

service_discovery.tf#L1
resource "aws_service_discovery_private_dns_namespace" "this" {
  name        = local.name
  description = "private namespace for elastic cluster"
  vpc         = var.vpc_id
}

service-discovery.tf#L1
resource "aws_service_discovery_private_dns_namespace" "common" {
  name = "local"
  vpc  = var.vpc_main_id
}

output "sd_ns_common_id" {
main.tf#L2
resource "aws_service_discovery_private_dns_namespace" "private_dns_namespace" {
  name        = format("%s.%s.local", var.tags["Project"], var.tags["Environment"])
  description = "Private DNS namespace for service discovery"
  vpc         =  var.vpc_id
}

Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Provides a Service Discovery Private DNS Namespace resource.

AWS::ServiceDiscovery::PrivateDnsNamespace (CloudFormation)

The PrivateDnsNamespace in ServiceDiscovery can be configured in CloudFormation with the resource name AWS::ServiceDiscovery::PrivateDnsNamespace. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

An example could not be found in GitHub.

Parameters

Explanation in CloudFormation Registry

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.

Frequently asked questions

What is AWS Cloud Map Private Dns Namespace?

AWS Cloud Map Private Dns Namespace is a resource for Cloud Map of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS Cloud Map Private Dns Namespace?

For Terraform, the MiguelIsaza95/movie-analyst-containers, exNihlio/terraform and DButter/elk-ecs-cluster source code examples are useful. See the Terraform Example section for further details.