Amazon ECS clusters - Amazon Elastic Container Service

Amazon ECS clusters

An Amazon ECS cluster is a logical grouping of tasks or services. In addition to tasks and services, a cluster consists of the following resources:

  • The infrastructure capacity which can be a combination of the following:

    • Amazon EC2 instances in the AWS cloud

    • Serverless (AWS Fargate (Fargate)) in the AWS cloud

    • On-premises virtual machines (VM) or servers

  • The network (VPC and subnet) where your tasks and services run

    When you use Amazon EC2 instances for the capacity, the subnet can be in Availability Zones, Local Zones, Wavelength Zones or AWS Outposts.

  • An optional namespace

    The namespace is used for service-to-service communication with Service Connect.

  • A monitoring option

    CloudWatch Container Insights comes at an additional cost and is a fully managed service. It automatically collects, aggregates, and summarizes Amazon ECS metrics and logs.

The following are general concepts about Amazon ECS clusters.

  • Amazon ECS creates a default cluster. You can create additional clusters to separate your resources.

  • Clusters are AWS Region specific.

  • Cluster can be in any of the following states.

    ACTIVE

    The cluster is ready to accept tasks and, if applicable, you can register container instances with the cluster.

    PROVISIONING

    The cluster has capacity providers associated with it and the resources needed for the capacity provider are being created.

    DEPROVISIONING

    The cluster has capacity providers associated with it and the resources needed for the capacity provider are being deleted.

    FAILED

    The cluster has capacity providers associated with it and the resources needed for the capacity provider have failed to create.

    INACTIVE

    The cluster has been deleted. Clusters with an INACTIVE status may remain discoverable in your account for a period of time. This behavior is subject to change in the future, so make sure you do not rely on INACTIVE clusters persisting.

  • A cluster can contain a mix of tasks that are hosted on AWS Fargate, Amazon EC2 instances, or external instances. Tasks can run on Fargate or EC2 infrastructure as a launch type or a capacity provider strategy. If you use EC2 as a launch type, Amazon ECS doesn't track and scale the capacity of Amazon EC2 Auto Scaling groups. For more information about launch types, see Amazon ECS launch types.

  • A cluster can contain a mix of both Auto Scaling group capacity providers and Fargate capacity providers. A capacity provider strategycan only contain Auto Scaling group capacity providers or Fargate capacity providers.

  • You can use different instance types for the EC2 launch type or Auto Scaling group capacity providers. An instance can only be registered to one cluster at a time.

  • You can restrict access to clusters by creating custom IAM policies. For information, see Amazon ECS cluster examples section in Identity-based policy examples for Amazon Elastic Container Service.

  • You can use Service Auto Scaling to scale Fargate tasks. For more information, see Automatically scale your Amazon ECS service.

  • You can configure a default Service Connect namespace for a cluster. After you set a default Service Connect namespace, any new services created in the cluster can be added as client services in the namespace by turning on Service Connect. No additional configuration is required. For more information, see Service Connect.