Amazon Elastic Container Service (ECS) is a managed container orchestration service provided by Amazon Web Services (AWS). It allows developers to easily run and scale containerized applications in the cloud. ECS manages the underlying infrastructure, such as the container instances and the storage and networking resources, so that developers can focus on building and deploying their applications.
Developers can choose to run their containers on a fleet of EC2 instances that are managed by ECS. This allows developers to have more control over the underlying infrastructure and provides features like EC2 auto scaling.
Alternatively, developers can use ECS with Fargate, which allows them to run their containers without having to manage any EC2 instances. Fargate automatically provisions the necessary resources for running the containers and scales them as needed. This can make it easier for developers to get started with ECS and to focus on building and deploying their applications, rather than managing the underlying infrastructure.
This is part of a series of articles about AWS ECS.
In this article:
In this article
There are several ways to monitor Amazon Elastic Container Service (ECS):
When running Amazon Elastic Container Service (ECS) on Amazon Elastic Compute Cloud (EC2), there are several key metrics that you should monitor in order to ensure that your containers are running smoothly and efficiently. Some of the most important metrics to monitor include:
Monitoring Amazon Elastic Container Service (ECS) on AWS Fargate is similar to monitoring ECS on Amazon Elastic Compute Cloud (EC2), but there are some key differences to be aware of. One of the main differences is that with ECS on Fargate, you do not have direct access to the underlying EC2 instances on which your containers are running. This means that you cannot use traditional server monitoring tools, such as those that collect operating system-level metrics, to monitor your Fargate tasks and services.
Instead, when monitoring ECS on Fargate, you must use tools and services that are specifically designed to work with containers, such as the Amazon CloudWatch Container Insights service. This service provides detailed metrics and logs for your Fargate tasks and services, including CPU and memory usage, network performance, and the number of running tasks and containers. You can use these metrics to monitor the performance and health of your Fargate environment, and set alarms and react to changes in your environment using CloudWatch.
Another key difference is that with ECS on Fargate, you do not have to worry about managing the underlying EC2 instances on which your containers are running. This means that you do not need to monitor the EC2 instances themselves, and can instead focus on monitoring the performance and health of your containers and the services that they are running.
You’ll want to monitor the following metrics in your ECS clusters:
Amazon Elastic Container Service (ECS) includes a built-in tool called Container Instance Health, which allows you to monitor the health of your Amazon ECS container instances. Container Instance Health provides visibility into the state of your container instances, including any issues or errors that may be affecting their ability to run tasks.
To use Container Instance Health, you can log in to the Amazon ECS console and navigate to the Container Instances page. This page shows a list of all of the container instances in your ECS environment, along with their current health status and any associated issues or errors. You can use this information to quickly identify any container instances that may be experiencing problems, and take action to resolve the issues.
Amazon Elastic Container Service (ECS) integrates with Amazon CloudWatch, which is a monitoring service provided by AWS. With CloudWatch, you can collect and track metrics, set alarms, and automatically react to changes in your environment. You can use CloudWatch to monitor a variety of metrics for ECS, including CPU and memory usage, and the number of running tasks and containers.
To use CloudWatch to monitor your Amazon ECS environment, you can log in to the AWS Management Console and navigate to the CloudWatch dashboard. From here, you can view pre-configured dashboard widgets that show the key metrics for your ECS environment, such as the number of running tasks and containers, and the CPU and memory usage of your EC2 instances.
In addition to viewing these metrics on the dashboard, you can also use CloudWatch to create custom metrics and alarms. For example, you could create a metric that tracks the number of failed tasks in your ECS environment, and set up an alarm to notify you if the number of failed tasks exceeds a certain threshold. This can help you identify and respond to potential issues in your ECS environment in real-time.
Amazon Elastic Container Service (ECS) integrates with Amazon CloudWatch Container Insights, which is a monitoring service that provides detailed metrics and logs for your Amazon ECS tasks and services. With CloudWatch Container Insights, you can monitor the performance and health of your containers in real-time, and gain valuable insights into how your containers are running.
To use CloudWatch Container Insights to monitor your Amazon ECS environment, you can log in to the AWS Management Console and navigate to the CloudWatch dashboard. From here, you can view pre-configured dashboard widgets that show the key metrics for your ECS environment, such as the number of running tasks and containers, and the CPU and memory usage of your EC2 instances.
In addition to viewing these metrics on the dashboard, you can also use CloudWatch Container Insights to collect and view detailed logs for your ECS tasks and services. This can be helpful for troubleshooting issues with your containers, and for gaining a better understanding of how your containers are interacting with other services and resources in your environment.
Amazon Elastic Container Service (ECS) integrates with Amazon EventBridge, which is a serverless event bus service provided by AWS. With EventBridge, you can create rules that automatically trigger when certain events occur in your ECS environment. You can use these rules to create custom responses to events, such as sending an email or triggering a Lambda function.
To use EventBridge to monitor your Amazon ECS environment, you can log in to the AWS Management Console and navigate to the EventBridge dashboard. From here, you can create new rules that are triggered by events in your ECS environment, such as when a task is started or stopped, or when a task fails to run.
Once you have created your rules, EventBridge will automatically trigger the specified actions when the relevant events occur in your ECS environment. This can be helpful for responding to events in real-time, and for automating tasks and processes within your ECS environment.
Amazon Elastic Container Service (ECS) integrates with AWS CloudTrail, which is a service that logs and records all API calls made to your AWS account. With CloudTrail, you can track changes and actions taken within your ECS environment, and gain valuable insights into how your environment is being used.
To use CloudTrail to monitor your Amazon ECS environment, you can log in to the AWS Management Console and navigate to the CloudTrail dashboard. From here, you can view the log files generated by CloudTrail, which contain detailed information about the API calls made to your ECS environment.
You can use these log files to track changes and actions taken within your ECS environment, such as when tasks are started or stopped, or when new container instances are launched. This can be helpful for understanding how your environment is being used, and for troubleshooting any issues that may arise.
In addition to viewing the log files generated by CloudTrail, you can also use the service to set up alerts and notifications for specific events within your ECS environment. For example, you could create an alert that is triggered when a task fails to run, or when a container instance is terminated. This can help you stay informed about important events within your ECS environment and respond quickly to any potential issues.
For all the benefits that AWS ECS brings to developing and running containers, these distributed applications still need observability to ensure they run at the highest performance, with the greatest reliability to deliver seamless customer experiences.
Lumigo is a cloud native observability platform purpose-built for microservice applications that provides deep visibility into applications and infrastructure, enabling users to easily monitor and troubleshoot their applications running on Amazon ECS.