Which of the following services are used during the creation of an ECS cluster?

If you are using a different name for the cluster than EcsSpotWorkshop, please make sure you update the Launch template ecs agent bootstrapping. Learn more about ECS agent bootstrapping [here] (#ecs-agent-bootstrapping)

  • Click Create
  • Click View Cluster
  • Click Capacity Providers tab

The new ECS cluster will appear as below in the AWS Console.

CloudWatch Container Insights collects, aggregates, and summarizes metrics and logs from your containerized applications and microservices. It collects metrics for many resources, such as CPU, memory, disk, and network. Container Insights is available for Amazon Elastic Container Service (Amazon ECS), Amazon Elastic Kubernetes Service (Amazon EKS), and Kubernetes platforms on Amazon EC2. Amazon ECS support includes support for Fargate. You can read more about CloudWatch Container Insights here.

EC2 launch templates reduce the number of steps required to create an instance by capturing all launch parameters within one resource. For example, a launch template can contain the ECS optimized AMI, instance type, User data section, Instance Profile / Role, and network settings that you typically used to launch instances. When you launch an instance using the Amazon EC2 console, an AWS SDK, a CLI tool, or an EC2 Auto Scaling group (like we will use in this workshop), you can specify the launch template to use.

In this case we have pre-created an EC2 launch template when we deployed the CloudFormation stack. You can use the AWS Management Console to see the configuration. Please note that launch templates are necessary in order to use EC2 Auto Scaling groups with mixed instances policy (to allow for mixing On-Demand and Spot Instances in an Auto Scaling group, and diversifying the instance type selection).

Select launch template and navigate to Advanced Details tab. Review the user data section of the EC2 launch template to see ECS Container agent configuration.

  • ECS_CLUSTER: The cluster that will be used by the ECS Agent to bootstrap against and connect. Must match a name of an ECS Cluster.

  • ECS_CONTAINER_STOP_TIMEOUT: Time to wait from when a task is stopped before its containers are forcefully stopped if they do not exit normally on their own

  • ECS_ENABLE_SPOT_INSTANCE_DRAINING: Whether to enable Spot Instance draining for the container instance. When true, if the container instance receives a Spot interruption notice, then the agent sets the instance status to DRAINING, which gracefully shuts down and replaces all tasks running on the instance that are part of a service.

  • ECS_ENABLE_CONTAINER_METADATA: When true, the agent creates a file describing the container’s metadata. The file can be located and consumed by using the container environment variable $ECS_CONTAINER_METADATA_FILE

    You can create an Amazon ECS cluster using the new Amazon Web Services Management Console, as described in this topic. Before you begin, be sure that you've completed the steps in Set up to use Amazon ECS. The new console provides a simple way to create the resources that are needed by an Amazon ECS cluster by creating a Amazon CloudFormation stack.

    You can register Amazon EC2 instances during cluster creation or register additional instances with the cluster after creating it.

    To make the cluster creation process as easy as possible, the console has default selections for many choices which we describe below. There are also help panels available for most of the sections in the console which provide further context.

    You can modify the following default options:

    • Change the subnets where tasks and services launch into by default.

    • Turn on Container Insights.

      CloudWatch Container Insights collects, aggregates, and summarizes metrics and logs from your containerized applications and microservices. Container Insights also provides diagnostic information, such as container restart failures, that you use to isolate issues and resolve them quickly. For more information, see Amazon ECS CloudWatch Container Insights.

    • Add tags to help you identify your clusters.

    Auto Scaling group options

    If you want to use Spot Instances in your Auto Scaling group, you must use the classic console to create the cluster. For more information, see Creating a cluster using the classic console.

    When you use Amazon EC2 instances, you must specify an Auto Scaling group to manage the infrastructure that your tasks and services run on.

    When you choose to create a new Auto Scaling group, it is automatically configured for the following behavior:

    • Amazon ECS manages the scale-in and scale-out actions of the Auto Scaling group.

    • Amazon ECS will not prevent Amazon EC2 instances that contain tasks and that are in an Auto Scaling group from being terminated during a scale-in action. For more information, see Instance Protection in the Amazon Auto Scaling User Guide.

    You configure the following Auto Scaling group properties which determine the type and number of instances to launch for the group:

    • The Amazon ECS-optimized AMI.

    • The instance type.

    • The SSH key pair that proves your identity when you connect to the instance. For information about how to create SSH keys, see Amazon EC2 key pairs and Linux instances in the Amazon EC2 User Guide for Linux Instances.

    • The minimum number of instances to launch for the Auto Scaling group.

    • The maximum number of instances that are started for the Auto Scaling group. In order for the group to scale out, the maximum must be greater than 0.

    Amazon ECS creates an Amazon EC2 Auto Scaling launch template and Auto Scaling group on your behalf as part of the Amazon CloudFormation stack. The values that you specified for the AMI, the instance types, and the SSH key pair are in the launch template. The templates are prefixed with EC2ContainerService-<ClusterName>, which makes them easy to identify. The Auto Scaling groups are prefixed with <ClusterName>-ECS-Infra-ECSAutoScalingGroup.

    Instances launched for the Auto Scaling group use the launch template.

    To create a new cluster (New Amazon ECS console)

    Before you begin, assign the appropriate IAM permission. For more information, see Cluster examples.

    1. Open the new console at //console.amazonaws.cn/ecs/v2.

    2. From the navigation bar, select the Region to use.

    3. In the navigation pane, choose Clusters.

    4. On the Clusters page, choose Create cluster.

    5. Under Cluster configuration, for Cluster name, enter a unique name.

      The name can contain up to 255 letters (uppercase and lowercase), numbers, and hyphens.

    6. (Optional) To change the VPC and subnets where your tasks and services launch, under Networking, perform any of the following operations:

      • To remove a subnet, under Subnets, choose X for each subnet that you want to remove.

      • To change to a VPC other than the default VPC, under VPC, choose an existing VPC, and then under Subnets, select each subnet.

    7. (Optional) To add Amazon EC2 instances to your cluster, expand Infrastructure, and then select Amazon EC2 instances. Next, configure the Auto Scaling group which acts as the capacity provider:

      1. To using an existing Auto Scaling group, from Auto Scaling group (ASG), select the group.

      2. To create a Auto Scaling group, from Auto Scaling group (ASG), select Create new group, and then provide the following details about the group:

        • For Operating system/Architecture, choose the Amazon ECS-optimized AMI for the Auto Scaling group instances.

        • For EC2 instance type, choose the instance type for your workloads.

          Managed scaling works best if your Auto Scaling group uses the same or similar instance types.

        • For SSH key pair, choose the pair that proves your identity when you connect to the instance.

        • For Capacity, enter the minimum number and the maximum number of instances to launch in the Auto Scaling group.

    8. (Optional) To turn on Container Insights, expand Monitoring, and then turn on Use Container Insights.

    9. (Optional) To manage the cluster tags, expand Tags, and then perform one of the following operations:

      Which of the following is used to manage the infrastructure that the tasks in ECS clusters use?

      In most cases, Amazon ECS capacity providers can be used to manage the infrastructure that the tasks in your clusters use.

      What are the main components of ECS?

      Amazon ECS components.
      Clusters. An Amazon ECS cluster is a logical grouping of tasks or services. ... .
      Containers and images. To deploy applications on Amazon ECS, your application components must be configured to run in containers. ... .
      Task definitions. ... .
      Tasks. ... .
      Services. ... .
      Container agent. ... .
      Fargate architecture overview..

      How many services can run in a ECS cluster?

      Amazon ECS service quotas.

      Which component of AWS ECS is responsible for placing tasks within your cluster?

      AWS built the task placement engine, which removes the need for you to build, run, and manage your own scheduling and placement services. There are several new features that provide you with more control over how applications run across clusters through custom attributes.

Chủ đề