Table: aws_service_discovery_namespace - Query AWS Cloud Map Service Discovery Namespace using SQL
The AWS Cloud Map Service Discovery Namespace is a component of AWS Cloud Map that helps applications to discover services dynamically over the cloud. It allows services to register their instance and utilize naming schema for easy discovery. This aids in maintaining the updated location of services, which is crucial for microservice architectures and serverless applications.
Table Usage Guide
The aws_service_discovery_namespace
table in Steampipe provides you with information about AWS Cloud Map Service Discovery Namespaces. This table allows you, as a DevOps engineer, to query namespace-specific details, including namespace type (DNS, HTTP), associated services, and associated metadata. You can utilize this table to gather insights on namespaces, such as the number of services in each namespace, namespace types, and more. The schema outlines the various attributes of the service discovery namespace for you, including the namespace ID, ARN, name, type, and associated tags.
Examples
Basic info
Determine the areas in which AWS services are being utilized, by identifying their names, IDs, types, and regions. This is useful for understanding your AWS service usage and distribution across different regions.
select name, id, arn, type, regionfrom aws_service_discovery_namespace;
select name, id, arn, type, regionfrom aws_service_discovery_namespace;
List private namespaces
Explore which namespaces are private within your AWS Service Discovery to better manage your resources and ensure data security. This is particularly useful in scenarios where you need to isolate specific resources or data within your AWS environment.
select name, id, arn, type, service_countfrom aws_service_discovery_namespacewhere type ilike '%private%';
select name, id, arn, type, service_countfrom aws_service_discovery_namespacewhere type like '%private%';
List HTTP type namespaces
Identify instances where the type of AWS Service Discovery Namespace is HTTP. This can help in understanding the distribution of different namespace types and aid in the management of AWS services.
select name, id, arn, type, service_countfrom aws_service_discovery_namespacewhere type = 'HTTP';
select name, id, arn, type, service_countfrom aws_service_discovery_namespacewhere type = 'HTTP';
List namespaces created in the last 30 days
Discover the segments that have been recently added to the service discovery namespace in AWS within the past month. This can be useful in tracking recent changes or additions to your AWS environment.
select name, id, description, create_datefrom aws_service_discovery_namespacewhere create_date >= now() - interval '30' day;
select name, id, description, create_datefrom aws_service_discovery_namespacewhere create_date >= datetime('now', '-30 day');
Get HTTP property details of namespaces
Explore the details of HTTP properties associated with specific namespaces to better understand their configuration and usage in your AWS service discovery setup. This can be useful in diagnosing issues or optimizing resource utilization.
select name, id, http_properties ->> 'HttpName' as http_namefrom aws_service_discovery_namespacewhere type = 'HTTP';
select name, id, json_extract(http_properties, '$.HttpName') as http_namefrom aws_service_discovery_namespacewhere type = 'HTTP';
Get private DNS property details of namspaces
Determine the areas in which private DNS properties of namespaces are utilized within AWS Service Discovery. This assists in understanding the specific configuration and settings of your private DNS, thus aiding in better resource management and optimization.
select name, id, dns_properties ->> 'HostedZoneId' as HostedZoneId, dns_properties -> 'SOA' ->> 'TTL' as ttlfrom aws_service_discovery_namespacewhere type = 'DNS_PRIVATE';
select name, id, json_extract(dns_properties, '$.HostedZoneId') as HostedZoneId, json_extract(json_extract(dns_properties, '$.SOA'), '$.TTL') as ttlfrom aws_service_discovery_namespacewhere type = 'DNS_PRIVATE';
Count namespaces by type
Analyze the distribution of different types of namespaces within AWS service discovery to understand their usage and prevalence.
select type, count(type)from aws_service_discovery_namespacegroup by type;
select type, count(type)from aws_service_discovery_namespacegroup by type;
Schema for aws_service_discovery_namespace
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
account_id | text | =, !=, ~~, ~~*, !~~, !~~* | The AWS Account ID in which the resource is located. |
akas | jsonb | Array of globally unique identifier strings (also known as) for the resource. | |
arn | text | The Amazon Resource Name (ARN) that Cloud Map assigns to the namespace when you create it. | |
create_date | timestamp with time zone | The date and time that the namespace was created. | |
description | text | A description for the namespace. | |
dns_properties | jsonb | A complex type that contains the ID for the Route 53 hosted zone that Cloud Map creates when you create a namespace. | |
http_properties | jsonb | A complex type that contains the name of an HTTP namespace. | |
id | text | = | The ID of the namespace. |
name | text | = | The name of the namespace. |
partition | text | The AWS partition in which the resource is located (aws, aws-cn, or aws-us-gov). | |
region | text | The AWS Region in which the resource is located. | |
service_count | bigint | The number of services that were created using the namespace. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
tags | jsonb | A map of tags for the resource. | |
tags_src | jsonb | Information about the tags associated with the namespace. | |
title | text | Title of the resource. | |
type | text | = | The type of the namespace, either public or private. |
Export
This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- aws
You can pass the configuration to the command with the --config
argument:
steampipe_export_aws --config '<your_config>' aws_service_discovery_namespace