steampipe plugin install aws

Table: aws_service_discovery_instance - Query AWS Cloud Map Service Instances using SQL

The AWS Cloud Map Service Instance is a component of AWS Cloud Map that allows you to register any application component, such as databases, queues, microservices, or other services, and manage their location. It provides a unified view of operational data for all your services and ensures they are connected in a reliable and scalable manner. With AWS Cloud Map, you can define custom names for your application resources, and it maintains the updated location of these dynamically changing resources.

Table Usage Guide

The aws_service_discovery_instance table in Steampipe provides you with information about service instances within AWS Cloud Map. This table allows you, as a DevOps engineer, to query instance-specific details, including instance ID, attributes, and health status. You can utilize this table to gather insights on instances, such as instances with specific attributes, health status of instances, and more. The schema outlines the various attributes of the service instance for you, including the instance ID, service ID, attributes, and health status.

Examples

Basic info

Explore the relationship between different services and instances in your AWS environment. This query helps in tracking the associations and attributes of services, which is beneficial for managing resources and troubleshooting issues.

select
id,
service_id,
ec2_instance_id,
attributes
from
aws_service_discovery_instance;
select
id,
service_id,
ec2_instance_id,
attributes
from
aws_service_discovery_instance;

List instances that are unhealthy

Identify instances where the initial health status is marked as unhealthy. This can help in quickly pinpointing problematic areas within your AWS services, enabling you to take corrective measures promptly.

select
id,
service_id,
init_health_status
from
aws_service_discovery_instance
where
init_health_status = 'UNHEALTHY';
select
id,
service_id,
init_health_status
from
aws_service_discovery_instance
where
init_health_status = 'UNHEALTHY';

Count instances by service

Gain insights into the distribution of instances across various services, allowing you to understand the service utilization patterns. This can be particularly useful for load balancing and resource allocation.

select
service_id,
count(id)
from
aws_service_discovery_instance
group by
service_id;
select
service_id,
count(id)
from
aws_service_discovery_instance
group by
service_id;

Get service details of each instance

Gain insights into the specifics of each service associated with every instance. This is useful for understanding the relationships between services and instances, and for tracking service creation dates.

select
i.id,
i.service_id,
s.name as service_name,
s.create_date as service_create_date,
s.namespace_id,
s.type
from
aws_service_discovery_instance as i,
aws_service_discovery_service as s
where
s.id = i.service_id;
select
i.id,
i.service_id,
s.name as service_name,
s.create_date as service_create_date,
s.namespace_id,
s.type
from
aws_service_discovery_instance as i,
aws_service_discovery_service as s
where
s.id = i.service_id;

Get EC2 instance details of each service discovery instance

Explore the specifics of each service discovery instance by examining the associated EC2 instance details. This allows for a comprehensive understanding of the service's operation and usage, providing valuable insights for optimization and management.

select
i.id,
i.service_id,
i.ec2_instance_id,
ei.instance_type,
ei.instance_state,
ei.launch_time
from
aws_service_discovery_instance as i,
aws_ec2_instance as ei
where
i.ec2_instance_id is not null
and ei.instance_id = i.ec2_instance_id;
select
i.id,
i.service_id,
i.ec2_instance_id,
ei.instance_type,
ei.instance_state,
ei.launch_time
from
aws_service_discovery_instance as i
join aws_ec2_instance as ei on ei.instance_id = i.ec2_instance_id
where
i.ec2_instance_id is not null;

Get the IP address configuration of service discovery instances

Determine the IP address configuration of instances within a service discovery setup to better understand networking and connectivity details. This can be helpful in troubleshooting network-related issues or planning for network expansion.

select
id,
service_id,
ec2_instance_id,
instance_ipv4,
instance_ipv6,
instance_port
from
aws_service_discovery_instance;
select
id,
service_id,
ec2_instance_id,
instance_ipv4,
instance_ipv6,
instance_port
from
aws_service_discovery_instance;

Schema for aws_service_discovery_instance

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form.
account_idtext=, !=, ~~, ~~*, !~~, !~~*The AWS Account ID in which the resource is located.
alias_dns_nametextFor an alias record that routes traffic to an Elastic Load Balancing load balancer, the DNS name that's associated with the load balancer.
attributesjsonbAttributes of the instance.
ec2_instance_idtextThe Amazon EC2 instance ID for the instance. When the AWS_EC2_INSTANCE_ID attribute is specified, then the AWS_INSTANCE_IPV4 attribute contains the primary private IPv4 address.
idtext=The ID of the instance.
init_health_statustextIf the service configuration includes HealthCheckCustomConfig, you can optionally use AWS_INIT_HEALTH_STATUS to specify the initial status of the custom health check, HEALTHY or UNHEALTHY. If you don't specify a value for AWS_INIT_HEALTH_STATUS, the initial status is HEALTHY.
instance_cnametextA CNAME record, the domain name that Route 53 returns in response to DNS queries (for example, example.com ).
instance_ipv4inetFor an A record, the IPv4 address that Route 53 returns in response to DNS queries.
instance_ipv6inetFor an AAAA record, the IPv6 address that Route 53 returns in response to DNS queries.
instance_portbigintFor an SRV record, the value that Route 53 returns for the port. In addition, if the service includes HealthCheckConfig, the port on the endpoint that Route 53 sends requests to.
partitiontextThe AWS partition in which the resource is located (aws, aws-cn, or aws-us-gov).
regiontextThe AWS Region in which the resource is located.
service_idtext=The ID of the service.
sp_connection_nametext=, !=, ~~, ~~*, !~~, !~~*Steampipe connection name.
sp_ctxjsonbSteampipe context in JSON form.
titletextTitle of the resource.

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_instance