steampipe plugin install aws

Table: aws_ecs_cluster - Query AWS ECS Clusters using SQL

The AWS ECS Cluster is a regional, logical grouping of services in Amazon Elastic Container Service (ECS). It allows you to manage and scale a group of tasks or services, and determine their placement across a set of Amazon EC2 instances. ECS Clusters help in running applications and services on a managed cluster of EC2 instances, eliminating the need to install, operate, and scale your own cluster management infrastructure.

Table Usage Guide

The aws_ecs_cluster table in Steampipe provides you with information about clusters within AWS Elastic Container Service (ECS). This table allows you, as a DevOps engineer, to query cluster-specific details, including its configuration, status, and associated resources. You can utilize this table to gather insights on clusters, such as cluster capacity providers, default capacity provider strategy, and more. The schema outlines for you the various attributes of the ECS cluster, including the cluster ARN, cluster name, status, and associated tags.

Examples

Basic info

Analyze the settings to understand the overall status and active services of your AWS ECS clusters. This is useful for maintaining optimal cluster performance and identifying any potential issues.

select
cluster_arn,
cluster_name,
active_services_count,
attachments,
attachments_status,
status
from
aws_ecs_cluster;
select
cluster_arn,
cluster_name,
active_services_count,
attachments,
attachments_status,
status
from
aws_ecs_cluster;

List clusters that have failed to provision resources

Identify instances where resource provisioning has failed in certain clusters. This can be useful in troubleshooting and understanding the reasons for failure in resource allocation.

select
cluster_arn,
status
from
aws_ecs_cluster
where
status = 'FAILED';
select
cluster_arn,
status
from
aws_ecs_cluster
where
status = 'FAILED';

Get details of resources attached to each cluster

Explore the status and type of resources linked to each cluster in your AWS ECS setup. This helps you monitor the health and functionality of various components within your clusters.

select
cluster_arn,
attachment ->> 'id' as attachment_id,
attachment ->> 'status' as attachment_status,
attachment ->> 'type' as attachment_type
from
aws_ecs_cluster,
jsonb_array_elements(attachments) as attachment;
select
cluster_arn,
json_extract(attachment.value, '$.id') as attachment_id,
json_extract(attachment.value, '$.status') as attachment_status,
json_extract(attachment.value, '$.type') as attachment_type
from
aws_ecs_cluster,
json_each(attachments) as attachment;

List clusters with CloudWatch Container Insights disabled

Determine the areas in your AWS ECS clusters where CloudWatch Container Insights is disabled. This is beneficial in understanding and managing the monitoring capabilities of your clusters.

select
cluster_arn,
setting ->> 'Name' as name,
setting ->> 'Value' as value
from
aws_ecs_cluster,
jsonb_array_elements(settings) as setting
where
setting ->> 'Value' = 'disabled';
select
cluster_arn,
json_extract(setting.value, '$.Name') as name,
json_extract(setting.value, '$.Value') as value
from
aws_ecs_cluster,
json_each(settings) as setting
where
json_extract(setting, '$.Value') = 'disabled';

Schema for aws_ecs_cluster

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form, e.g. connection_name.
account_idtextThe AWS Account ID in which the resource is located.
active_services_countbigintThe number of services that are running on the cluster in an ACTIVE state.
akasjsonbArray of globally unique identifier strings (also known as) for the resource.
attachmentsjsonbThe resources attached to a cluster. When using a capacity provider with a cluster, the Auto Scaling plan that is created will be returned as a cluster attachment.
attachments_statustextThe status of the capacity providers associated with the cluster.
capacity_providersjsonbThe capacity providers associated with the cluster.
cluster_arntext=The Amazon Resource Name (ARN) that identifies the cluster.
cluster_nametextA user-generated string that you use to identify your cluster.
default_capacity_provider_strategyjsonbThe default capacity provider strategy for the cluster.
partitiontextThe AWS partition in which the resource is located (aws, aws-cn, or aws-us-gov).
pending_tasks_countbigintThe number of tasks in the cluster that are in the PENDING state.
regiontextThe AWS Region in which the resource is located.
registered_container_instances_countbigintThe number of container instances registered into the cluster. This includes container instances in both ACTIVE and DRAINING status.
running_tasks_countbigintThe number of tasks in the cluster that are in the RUNNING state.
settingsjsonbThe settings for the cluster. This parameter indicates whether CloudWatch Container Insights is enabled or disabled for a cluster.
statisticsjsonbAdditional information about your clusters that are separated by launch type.
statustextThe status of the cluster.
tagsjsonbA map of tags for the resource.
tags_srcjsonbA list of tags attached to the cluster.
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_ecs_cluster