Skip to main content

aws_ecs_clusters resource

[edit on GitHub]

Use the aws_ecs_clusters InSpec audit resource to test properties of some or all AWS ECS Clusters.


An aws_ecs_clusters resource block returns all ECS Clusters and allows the testing of that group of Clusters.

describe aws_ecs_clusters do
  its('cluster_names') { should include 'cluster-root' }


This resource does not expect any parameters.

See also the AWS documentation on ECS Clusters.


cluster_arnThe Amazon Resource Name (ARN) that identifies the cluster.
cluster_nameA user-generated string that you use to identify your cluster.
statusThe status of the cluster.
running_tasks_countThe number of tasks in the cluster that are in the RUNNING state.
pending_tasks_countThe number of tasks in the cluster that are in the PENDING state.
active_services_countThe number of services that are running on the cluster in an ACTIVE state.
registered_container_instances_countThe number of container instances registered into the cluster. This includes container instances in both ACTIVE and DRAINING status.
statisticsAdditional information about your clusters that are separated by launch type.
entriesProvides access to the raw results of the query, which can be treated as an array of hashes.


Ensure there are no Clusters in an undesired state.

  describe aws_ecs_clusters do
    it                   { should exist }
    its('statuses')      { should_not include 'UNDESIRED-STATUS'}
    its('cluster_names') { should include 'SQL-cluster' }


For a full list of available matchers, please visit our matchers page.


The control will pass if the describe returns at least one result.

Use should_not to test the entity should not exist.

describe aws_ecs_clusters.where( <property>: <value>) do
  it { should exist }

describe aws_ecs_clusters.where( <property>: <value>) do
  it { should_not exist }

AWS Permissions

Your Principal will need the ecs:ListClusters & ecs:DescribeClusters action set to allow.

Was this page helpful?


Search Results