Table: aws_ecs_service - Query AWS Elastic Container Service using SQL
The AWS Elastic Container Service (ECS) is a highly scalable, high-performance container orchestration service that supports Docker containers and allows you to easily run and scale containerized applications on AWS. ECS eliminates the need for you to install, operate, and scale your own cluster management infrastructure. With simple API calls, you can launch and stop Docker-enabled applications, query the complete state of your application, and access many familiar features like security groups, Elastic Load Balancing, EBS volumes, and IAM roles.
Table Usage Guide
The aws_ecs_service
table in Steampipe provides you with information about the services within the AWS Elastic Container Service (ECS) clusters. This table lets you, as a DevOps engineer, query service-specific details, including service status, task definitions, and associated metadata. You can utilize this table to gather insights on services, such as service health status, task definitions being used, and more. The schema outlines the various attributes of the ECS service for you, including the service ARN, cluster ARN, task definition, desired count, running count, and associated tags.
Examples
Basic info
Explore the status and details of various tasks within your AWS ECS service. This can help you understand the state of your tasks and identify any potential issues or anomalies.
select service_name, arn, cluster_arn, task_definition, statusfrom aws_ecs_service;
select service_name, arn, cluster_arn, task_definition, statusfrom aws_ecs_service;
List services not using the latest version of AWS Fargate platform
Determine the areas in which your services are not utilizing the latest version of the AWS Fargate platform. This can be useful in identifying outdated services that may potentially benefit from an upgrade for enhanced performance and security.
select service_name, arn, launch_type, platform_versionfrom aws_ecs_servicewhere launch_type = 'FARGATE' and platform_version is not null;
select service_name, arn, launch_type, platform_versionfrom aws_ecs_servicewhere launch_type = 'FARGATE' and platform_version is not null;
List inactive services
Discover the segments that are inactive within your AWS ECS services. This can be particularly useful when cleaning up or troubleshooting your environment.
select service_name, arn, statusfrom aws_ecs_servicewhere status = 'INACTIVE';
select service_name, arn, statusfrom aws_ecs_servicewhere status = 'INACTIVE';
Query examples
- ec2_target_groups_for_ecs_service
- ecs_clusters_for_ecs_service
- ecs_container_instances_for_ecs_service
- ecs_service_input
- ecs_service_launch_type
- ecs_service_overview
- ecs_service_tags
- ecs_service_tasks
- ecs_services_for_ecs_cluster
- ecs_services_for_ecs_task_definition
- ecs_task_definitions_for_ecs_cluster
- ecs_task_definitions_for_ecs_service
- ecs_tasks_for_ecs_service
- iam_roles_for_ecs_service
- vpc_security_group_assoc
- vpc_security_groups_for_ecs_service
- vpc_subnets_for_ecs_service
- vpc_vpcs_for_ecs_service
Control examples
- All Controls > ECS > AWS ECS services should not have public IP addresses assigned to them automatically
- All Controls > ECS > ECS services should be attached to a load balancer
- AWS Foundational Security Best Practices > Elastic Container Service > 10 Fargate services should run on the latest Fargate platform version
- AWS Foundational Security Best Practices > Elastic Container Service > 2 Amazon ECS services should not have public IP addresses assigned to them automatically
- ECS fargate services should run on the latest fargate platform version
Schema for aws_ecs_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) specifying the service. | |
capacity_provider_strategy | jsonb | The capacity provider strategy associated with the service. | |
cluster_arn | text | The Amazon Resource Name (ARN) of the cluster that hosts the service. | |
created_at | timestamp with time zone | The date and time when the service was created. | |
created_by | text | The principal that created the service. | |
deployment_configuration | jsonb | Optional deployment parameters that control how many tasks run during the deployment and the ordering of stopping and starting tasks. | |
deployment_controller_type | text | The deployment controller type to use. Possible values are: ECS, CODE_DEPLOY, and EXTERNAL. | |
deployments | jsonb | The current state of deployments for the service. | |
desired_count | bigint | The desired number of instantiations of the task definition to keep running on the service. | |
enable_ecs_managed_tags | boolean | Specifies whether to enable Amazon ECS managed tags for the tasks in the service. | |
enable_execute_command | boolean | Indicates whether or not the execute command functionality is enabled for the service. | |
events | jsonb | The event stream for your service. A maximum of 100 of the latest events are displayed. | |
health_check_grace_period_seconds | bigint | The period of time, in seconds, that the Amazon ECS service scheduler ignores unhealthy Elastic Load Balancing target health checks after a task has first started. | |
launch_type | text | The launch type on which your service is running. If no value is specified, it will default to EC2. | |
load_balancers | jsonb | A list of Elastic Load Balancing load balancer objects, containing the load balancer name, the container name (as it appears in a container definition), and the container port to access from the load balancer. | |
network_configuration | jsonb | The VPC subnet and security group configuration for tasks that receive their own elastic network interface by using the awsvpc networking mode. | |
partition | text | The AWS partition in which the resource is located (aws, aws-cn, or aws-us-gov). | |
pending_count | bigint | The number of tasks in the cluster that are in the PENDING state. | |
placement_constraints | jsonb | The placement constraints for the tasks in the service. | |
placement_strategy | jsonb | The placement strategy that determines how tasks for the service are placed. | |
platform_family | text | The operating system that your tasks in the service run on. | |
platform_version | text | The platform version on which to run your service. | |
propagate_tags | text | Specifies whether to propagate the tags from the task definition or the service to the task. If no value is specified, the tags are not propagated. | |
region | text | The AWS Region in which the resource is located. | |
role_arn | text | The ARN of the IAM role associated with the service that allows the Amazon ECS container agent to register container instances with an Elastic Load Balancing load balancer. | |
running_count | bigint | The number of tasks in the cluster that are in the RUNNING state. | |
scheduling_strategy | text | The scheduling strategy to use for the service. | |
service_name | text | The name of the service. | |
service_registries | jsonb | The details of the service discovery registries to assign to this service. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
status | text | The status of the service. Valid values are: ACTIVE, DRAINING, or INACTIVE. | |
tags | jsonb | A map of tags for the resource. | |
tags_src | jsonb | The metadata that you apply to the service to help you categorize and organize them. | |
task_definition | text | The task definition to use for tasks in the service. | |
task_sets | jsonb | Information about a set of Amazon ECS tasks in either an AWS CodeDeploy or an EXTERNAL deployment. | |
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_service