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, statusfrom aws_ecs_cluster;
select cluster_arn, cluster_name, active_services_count, attachments, attachments_status, statusfrom 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, statusfrom aws_ecs_clusterwhere status = 'FAILED';
select cluster_arn, statusfrom aws_ecs_clusterwhere 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_typefrom 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_typefrom 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 valuefrom aws_ecs_cluster, jsonb_array_elements(settings) as settingwhere setting ->> 'Value' = 'disabled';
select cluster_arn, json_extract(setting.value, '$.Name') as name, json_extract(setting.value, '$.Value') as valuefrom aws_ecs_cluster, json_each(settings) as settingwhere json_extract(setting, '$.Value') = 'disabled';
Schema for aws_ecs_cluster
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
account_id | text | =, !=, ~~, ~~*, !~~, !~~* | The AWS Account ID in which the resource is located. |
active_services_count | bigint | The number of services that are running on the cluster in an ACTIVE state. | |
akas | jsonb | Array of globally unique identifier strings (also known as) for the resource. | |
attachments | jsonb | The 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_status | text | The status of the capacity providers associated with the cluster. | |
capacity_providers | jsonb | The capacity providers associated with the cluster. | |
cluster_arn | text | = | The Amazon Resource Name (ARN) that identifies the cluster. |
cluster_name | text | A user-generated string that you use to identify your cluster. | |
default_capacity_provider_strategy | jsonb | The default capacity provider strategy for the cluster. | |
execute_command_configuration | jsonb | The execute command configuration for the cluster. | |
partition | text | The AWS partition in which the resource is located (aws, aws-cn, or aws-us-gov). | |
pending_tasks_count | bigint | The number of tasks in the cluster that are in the PENDING state. | |
region | text | The AWS Region in which the resource is located. | |
registered_container_instances_count | bigint | The number of container instances registered into the cluster. This includes container instances in both ACTIVE and DRAINING status. | |
running_tasks_count | bigint | The number of tasks in the cluster that are in the RUNNING state. | |
service_connect_defaults_namespace | text | The namespace name or full Amazon Resource Name (ARN) of the Cloud Map namespace. When you create a service and don't specify a Service Connect configuration, this namespace is used. | |
settings | jsonb | The settings for the cluster. This parameter indicates whether CloudWatch Container Insights is enabled or disabled for a cluster. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
statistics | jsonb | Additional information about your clusters that are separated by launch type. | |
status | text | The status of the cluster. | |
tags | jsonb | A map of tags for the resource. | |
tags_src | jsonb | A list of tags attached to the cluster. | |
title | text | Title 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