Table: aws_service_discovery_service - Query AWS Service Discovery Service using SQL
The AWS Service Discovery Service is a managed solution that makes it easy for microservices and containerized applications to connect with each other over the network. It automatically manages the registration and health checks of services on your behalf, making it easier to discover and connect services across multiple AWS accounts and AWS Regions. Thus, it simplifies the process of building and scaling microservices, service-oriented, and containerized applications.
Table Usage Guide
The aws_service_discovery_service
table in Steampipe provides you with information about AWS resources that are registered with AWS Cloud Map. This table enables you, as a DevOps engineer, to query service-specific details, including service ID, ARN, name, and associated metadata. You can utilize this table to gather insights on services, such as service configurations, health check configurations, and more. The schema outlines the various attributes of the service for you, including the service ID, ARN, name, description, DNS configurations, health check configurations, and associated tags.
Examples
Basic info
Analyze the settings to understand the fundamental details of your AWS Service Discovery resources, such as their names, identifiers, and regions. This can help manage and organize your resources effectively, ensuring optimal utilization and control.
select name, id, arn, type, regionfrom aws_service_discovery_service;
select name, id, arn, type, regionfrom aws_service_discovery_service;
List DNS services
Determine the areas in which DNS services are being utilized within your AWS environment. This analysis can help you manage and optimize your cloud resources effectively.
select name, id, arn, type, create_datefrom aws_service_discovery_servicewhere type ilike '%dns%';
select name, id, arn, type, create_datefrom aws_service_discovery_servicewhere type like '%dns%';
List HTTP type services
Explore the services in your AWS environment that are configured for HTTP type communication. This can help in understanding the network communication setup and identifying potential areas for security improvement.
select name, id, arn, type, descriptionfrom aws_service_discovery_servicewhere type = 'HTTP';
select name, id, arn, type, descriptionfrom aws_service_discovery_servicewhere type = 'HTTP';
List services created in the last 30 days
Determine the areas in which new services have been added to your AWS environment in the past month. This is useful for tracking recent changes and understanding the evolution of your service architecture.
select name, id, description, create_datefrom aws_service_discovery_servicewhere create_date >= now() - interval '30' day;
select name, id, description, create_datefrom aws_service_discovery_servicewhere create_date >= datetime('now', '-30 day');
Count services by type
Explore the distribution of different service types within your AWS Service Discovery to better manage and optimize your resources.
select type, count(type)from aws_service_discovery_servicegroup by type;
select type, count(type)from aws_service_discovery_servicegroup by type;
Get health check config details of services
Determine the areas in which the health check configurations of services are failing. This query is useful in identifying problematic services that might need attention or adjustment.
select name, id, health_check_config ->> 'Type' as health_check_type, health_check_config ->> 'FailureThreshold' as failure_threshold, health_check_config ->> 'ResourcePath' as resource_pathfrom aws_service_discovery_service;
select name, id, json_extract(health_check_config, '$.Type') as health_check_type, json_extract(health_check_config, '$.FailureThreshold') as failure_threshold, json_extract(health_check_config, '$.ResourcePath') as resource_pathfrom aws_service_discovery_service;
Get custom health check config details of services
Analyze the configuration of services to understand the custom health check details. This information could be useful in identifying services that may have a higher failure threshold, thus requiring more attention or adjustment.
select name, id, health_check_custom_config ->> 'FailureThreshold' as failure_thresholdfrom aws_service_discovery_service;
select name, id, json_extract(health_check_custom_config, '$.FailureThreshold') as failure_thresholdfrom aws_service_discovery_service;
Get namespace details of services
Identify the details of specific services within a namespace to understand the number and type of services running, along with their DNS properties. This can be useful in managing and optimizing your AWS service discovery.
select s.name, s.id, s.namespace_id, n.service_count, n.type as namespace_type, n.dns_propertiesfrom aws_service_discovery_service as s, aws_service_discovery_namespace as n;
select s.name, s.id, s.namespace_id, n.service_count, n.type as namespace_type, n.dns_propertiesfrom aws_service_discovery_service as s, aws_service_discovery_namespace as n;
Schema for aws_service_discovery_service
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 service when you create it. | |
create_date | timestamp with time zone | The date and time that the service was created. | |
description | text | A description for the service. | |
dns_records | jsonb | An array that contains one DnsRecord object for each Route 53 DNS record that you want Cloud Map to create when you register an instance. | |
health_check_config | jsonb | Public DNS and HTTP namespaces only. Settings for an optional health check. If you specify settings for a health check, Cloud Map associates the health check with the records that you specify in DnsConfig. | |
health_check_custom_config | jsonb | Information about an optional custom health check. | |
id | text | = | The ID that Cloud Map assigned to the service when you created it. |
instance_count | bigint | The number of instances that are currently associated with the service. | |
name | text | The name of the service. | |
namespace_id | text | = | The ID 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. | |
routing_policy | text | The routing policy that you want to apply to all Route 53 DNS records that Cloud Map creates when you register an instance and specify this service. | |
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 | Describes the systems that can be used to discover the service instances. DNS_HTTP The service instances can be discovered using either DNS queries or the DiscoverInstances API operation. HTTP The service instances can only be discovered using the DiscoverInstances API operation. DNS Reserved. |
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_service