namespaces
Creates, updates, deletes, gets or lists a namespaces resource.
Overview
| Name | namespaces |
| Type | Resource |
| Id | aws.servicediscovery.namespaces |
Fields
The following fields are returned by SELECT queries:
- get_namespace
| Name | Datatype | Description |
|---|---|---|
arn | string | The Amazon Resource Name (ARN) that Cloud Map assigns to the namespace when you create it. |
create_date | string (date-time) | The date that the namespace was created, in Unix date/time format and Coordinated Universal Time (UTC). The value of CreateDate is accurate to milliseconds. For example, the value 1516925490.087 represents Friday, January 26, 2018 12:11:30.087 AM. |
creator_request_id | string | A unique string that identifies the request and that allows failed requests to be retried without the risk of running an operation twice. |
description | string | The description that you specify for the namespace when you create it. |
id | string | The ID of a namespace. |
name | string | The name of the namespace, such as example.com. (pattern: <code>^[!-~]{1,1024}$</code>) |
properties | object | A complex type that contains information that's specific to the type of the namespace. |
resource_owner | string | The ID of the Amazon Web Services account that created the namespace. If this isn't your account ID, it's the ID of the account that shared the namespace with your account. For more information about shared namespaces, see Cross-account Cloud Map namespace sharing in the Cloud Map Developer Guide. |
service_count | integer | The number of services that are associated with the namespace. |
type | string | The type of the namespace. The methods for discovering instances depends on the value that you specify: HTTP Instances can be discovered only programmatically, using the Cloud Map DiscoverInstances API. DNS_PUBLIC Instances can be discovered using public DNS queries and using the DiscoverInstances API. DNS_PRIVATE Instances can be discovered using DNS queries in VPCs and using the DiscoverInstances API. (DNS_PUBLIC, DNS_PRIVATE, HTTP) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_namespace | select | region | Gets information about a namespace. | |
create_private_dns_namespace | insert | region, Vpc | 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 Amazon Web Services account, see Cloud Map quotas in the Cloud Map Developer Guide. | |
create_http_namespace | insert | region | 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 Amazon Web Services account, see Cloud Map quotas in the Cloud Map Developer Guide. | |
update_http_namespace | update | region | Updates an HTTP namespace. | |
delete_namespace | delete | region | Deletes a namespace from the current account. If the namespace still contains one or more services, the request fails. | |
create_public_dns_namespace | exec | region | 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. | |
discover_instances_revision | exec | region, NamespaceName, ServiceName | Discovers the increasing revision associated with an instance. | |
list_namespaces | exec | region | Lists summary information about the namespaces that were created by the current Amazon Web Services account and shared with the current Amazon Web Services account. | |
update_private_dns_namespace | exec | region | Updates a private DNS namespace. | |
update_public_dns_namespace | exec | region | Updates a public DNS namespace. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
region | string | AWS region (default: us-east-1) |
SELECT examples
- get_namespace
Gets information about a namespace.
SELECT
arn,
create_date,
creator_request_id,
description,
id,
name,
properties,
resource_owner,
service_count,
type
FROM aws.servicediscovery.namespaces
WHERE region = '{{ region }}' -- required
;
INSERT examples
- create_private_dns_namespace
- create_http_namespace
- Manifest
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 Amazon Web Services account, see Cloud Map quotas in the Cloud Map Developer Guide.
INSERT INTO aws.servicediscovery.namespaces (
Name,
CreatorRequestId,
Description,
Vpc,
Tags,
Properties,
region
)
SELECT
'{{ Name }}',
'{{ CreatorRequestId }}',
'{{ Description }}',
'{{ Vpc }}' /* required */,
'{{ Tags }}',
'{{ Properties }}',
'{{ region }}'
RETURNING
operation_id
;
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 Amazon Web Services account, see Cloud Map quotas in the Cloud Map Developer Guide.
INSERT INTO aws.servicediscovery.namespaces (
Name,
CreatorRequestId,
Description,
Tags,
region
)
SELECT
'{{ Name }}',
'{{ CreatorRequestId }}',
'{{ Description }}',
'{{ Tags }}',
'{{ region }}'
RETURNING
operation_id
;
# Description fields are for documentation purposes
- name: namespaces
props:
- name: region
value: "{{ region }}"
description: Required parameter for the namespaces resource.
- name: Name
value: "{{ Name }}"
description: |
The name that you want to assign to this namespace.
- name: CreatorRequestId
value: "{{ CreatorRequestId }}"
description: |
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).
- name: Description
value: "{{ Description }}"
description: |
A description for the namespace.
- name: Vpc
value: "{{ Vpc }}"
description: |
The ID of the Amazon VPC that you want to associate the namespace with.
- name: Tags
description: |
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.
value:
- Key: "{{ Key }}"
Value: "{{ Value }}"
- name: Properties
description: |
Properties for the private DNS namespace.
value:
DnsProperties:
SOA:
TTL: {{ TTL }}
UPDATE examples
- update_http_namespace
Updates an HTTP namespace.
UPDATE aws.servicediscovery.namespaces
SET
Id = '{{ Id }}',
UpdaterRequestId = '{{ UpdaterRequestId }}',
Namespace = '{{ Namespace }}'
WHERE
region = '{{ region }}' --required
RETURNING
operation_id;
DELETE examples
- delete_namespace
Deletes a namespace from the current account. If the namespace still contains one or more services, the request fails.
DELETE FROM aws.servicediscovery.namespaces
WHERE region = '{{ region }}' --required
;
Lifecycle Methods
- create_public_dns_namespace
- discover_instances_revision
- list_namespaces
- update_private_dns_namespace
- update_public_dns_namespace
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.
EXEC aws.servicediscovery.namespaces.create_public_dns_namespace
@region='{{ region }}' --required
@@json=
'{
"Name": "{{ Name }}",
"CreatorRequestId": "{{ CreatorRequestId }}",
"Description": "{{ Description }}",
"Tags": "{{ Tags }}",
"Properties": "{{ Properties }}"
}'
;
Discovers the increasing revision associated with an instance.
EXEC aws.servicediscovery.namespaces.discover_instances_revision
@region='{{ region }}' --required
@@json=
'{
"NamespaceName": "{{ NamespaceName }}",
"ServiceName": "{{ ServiceName }}",
"OwnerAccount": "{{ OwnerAccount }}"
}'
;
Lists summary information about the namespaces that were created by the current Amazon Web Services account and shared with the current Amazon Web Services account.
EXEC aws.servicediscovery.namespaces.list_namespaces
@region='{{ region }}' --required
@@json=
'{
"NextToken": "{{ NextToken }}",
"MaxResults": {{ MaxResults }},
"Filters": "{{ Filters }}"
}'
;
Updates a private DNS namespace.
EXEC aws.servicediscovery.namespaces.update_private_dns_namespace
@region='{{ region }}' --required
@@json=
'{
"Id": "{{ Id }}",
"UpdaterRequestId": "{{ UpdaterRequestId }}",
"Namespace": "{{ Namespace }}"
}'
;
Updates a public DNS namespace.
EXEC aws.servicediscovery.namespaces.update_public_dns_namespace
@region='{{ region }}' --required
@@json=
'{
"Id": "{{ Id }}",
"UpdaterRequestId": "{{ UpdaterRequestId }}",
"Namespace": "{{ Namespace }}"
}'
;