Skip to content

create_public_dns_namespace

create_public_dns_namespace(
    name: NamespaceNamePublic,
    *,
    config_overrides: Optional[ServiceDiscoveryClientConfig] = None,
    creator_request_id: Optional[ResourceId] = None,
    description: Optional[ResourceDescription] = None,
    tags: Optional[TagList] = None,
    properties: Optional[PublicDnsNamespaceProperties] = None,
) -> CreatePublicDnsNamespaceResponse

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.

Parameters:

  • name (NamespaceNamePublic) –

    The name that you want to assign to this namespace.

    Do not include sensitive information in the name. The name is publicly available using DNS queries.

  • creator_request_id (Optional[ResourceId], default: None ) –

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

  • description (Optional[ResourceDescription], default: None ) –

    A description for the namespace.

  • tags (Optional[TagList], default: None ) –

    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.

  • properties (Optional[PublicDnsNamespaceProperties], default: None ) –

    Properties for the public DNS namespace.

Raises:

  • DuplicateRequest –

    The operation is already in progress.

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

  • NamespaceAlreadyExists –

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

  • ResourceLimitExceeded –

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

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

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

CreatePublicDnsNamespace example This example creates a public namespace based on DNS.

>>> client.create_public_dns_namespace(creator_request_id='example-creator-request-id-0003', name='example-public-dns.com', description='Example.com AWS Cloud Map Public DNS Namespace')
Source code in docs_src/capo_servicediscovery/_services/service_discovery.py
def create_public_dns_namespace(
    self,
    name: "capo_servicediscovery.types.namespace_name_public.NamespaceNamePublic",
    *,
    config_overrides: Optional[ServiceDiscoveryClientConfig] = None,
    creator_request_id: Optional[
        "capo_servicediscovery.types.resource_id.ResourceId"
    ] = None,
    description: Optional[
        "capo_servicediscovery.types.resource_description.ResourceDescription"
    ] = None,
    tags: Optional["capo_servicediscovery.types.tag_list.TagList"] = None,
    properties: Optional[
        "capo_servicediscovery.types.public_dns_namespace_properties.PublicDnsNamespaceProperties"
    ] = None,
) -> "capo_servicediscovery.types.create_public_dns_namespace_response.CreatePublicDnsNamespaceResponse":
    """<p>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 <code>example.com</code> and name your service <code>backend</code>, the resulting DNS name for the service is <code>backend.example.com</code>. You can discover instances that were registered with a public DNS namespace by using either a <code>DiscoverInstances</code> 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 <a href="https://docs.aws.amazon.com/cloud-map/latest/dg/cloud-map-limits.html">Cloud Map quotas</a> in the <i>Cloud Map Developer Guide</i>.</p> <important> <p>The <code>CreatePublicDnsNamespace</code> API operation is not supported in the Amazon Web Services GovCloud (US) Regions.</p> </important>

    Args:
        name: <p>The name that you want to assign to this namespace.</p> <note> <p>Do not include sensitive information in the name. The name is publicly available using DNS queries.</p> </note>
        creator_request_id: <p>A unique string that identifies the request and that allows failed <code>CreatePublicDnsNamespace</code> requests to be retried without the risk of running the operation twice. <code>CreatorRequestId</code> can be any unique string (for example, a date/timestamp).</p>
        description: <p>A description for the namespace.</p>
        tags: <p>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.</p>
        properties: <p>Properties for the public DNS namespace.</p>

    Raises:
        capo_servicediscovery.errors.duplicate_request.DuplicateRequest: <p>The operation is already in progress.</p>
        capo_servicediscovery.errors.invalid_input.InvalidInput: <p>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.</p>
        capo_servicediscovery.errors.namespace_already_exists.NamespaceAlreadyExists: <p>The namespace that you're trying to create already exists.</p>
        capo_servicediscovery.errors.resource_limit_exceeded.ResourceLimitExceeded: <p>The resource can't be created because you've reached the quota on the number of resources.</p>
        capo_servicediscovery.errors.too_many_tags_exception.TooManyTagsException: <p>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.</p>
        capo_servicediscovery.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        CreatePublicDnsNamespace example
        This example creates a public namespace based on DNS.

        >>> client.create_public_dns_namespace(creator_request_id='example-creator-request-id-0003', name='example-public-dns.com', description='Example.com AWS Cloud Map Public DNS Namespace')
    """

    def _handler(
        req: "OperationRequest[capo_servicediscovery.types.create_public_dns_namespace_request.CreatePublicDnsNamespaceRequest]",
    ) -> OperationResponse[
        "capo_servicediscovery.types.create_public_dns_namespace_response.CreatePublicDnsNamespaceResponse"
    ]:
        import capo_servicediscovery._operations.route53_auto_naming_v20170314.create_public_dns_namespace

        output, http_response = (
            capo_servicediscovery._operations.route53_auto_naming_v20170314.create_public_dns_namespace.create_public_dns_namespace(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreatePublicDnsNamespace")
    )
    input_: capo_servicediscovery.types.create_public_dns_namespace_request.CreatePublicDnsNamespaceRequest = {
        "name": name
    }
    if creator_request_id is None:
        creator_request_id = str(uuid.uuid4())
    input_["creator_request_id"] = creator_request_id
    if description is not None:
        input_["description"] = description
    if tags is not None:
        input_["tags"] = tags
    if properties is not None:
        input_["properties"] = properties

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output