Open garysassano opened 8 months ago
Voting for Prioritization
Volunteering to Work on This Issue
Despite being displayed in the CloudWatch Container Insights dashboard for user convenience, the ECS lifecycle events actually stand as an independent feature, not directly part of Container Insights.
What adds to the confusion is that upon activating Container Insights for an ECS cluster, AWS automatically sets up an EventBridge Rule named EventsToLogs-ecs-cl-{randomId}
, directing EventBridge events to a CloudWatch log group at /aws/events/ecs/containerinsights/{clusterName}/performance
.
The official docs is misleading, since it labels these events as "Container Insights performance log events," which just isn't true. In reality, these are the same ECS lifecycle events that could be independently enabled, as detailed here.
I believe ECS lifecycle events should not be automatically turned on along with Container Insights. Instead, they should have their own toggle and a better name for the CloudWatch log group.
Currently, enabling Container Insights for an ECS Cluster leads to the creation of two distinct CloudWatch log groups:
/aws/events/ecs/containerinsights/{clusterName}/performance
- Utilized for showcasing the ECS lifecycle events within the Container Insights dashboard, this log group misleadingly includes containerinsights
in its name, even though it is not an intrinsic part of Container Insights and can be enabled separately via this CloudFormation template.
/aws/ecs/containerinsights/{clusterName}/performance
- Represents the genuine "Container Insights performance log events," accessible solely when Container Insights is enabled for your ECS Cluster.
Deciphering this setup was far from straightforward, proving to be anything but intuitive.
I've just his this exact same confusion today. I'm trying to enable this programatically but struggling as it appears Lifecycle events picks up events from the /aws/events log group but that can only be created when manually clicking "configure lifecycle events" within the container insights panel.
That log group cannot be created programatically as /aws is reserved.
Terraform Core Version
1.7.5
AWS Provider Version
5.43.0
Affected Resource(s)
aws_ecs_cluster
Expected Behavior
I expected that specifying the ECS Cluster
containerInsights
setting asdisabled
would always work.Actual Behavior
I've discovered that you can bypass the setting and still have the Container Insights working whatever your ECS Cluster setting is.
Relevant Error/Panic Output Snippet
No response
Terraform Configuration Files
Essentially, there two ways you can enable CloudWatch Container Insights:
containerinsights
toenabled
in youraws_ecs_cluster
resource.aws_ecs_cluster
setting by manually creating thecontainerinsights
resources, so it keeps working even when specifically set todisabled
.Approach 1
Approach 2
Steps to Reproduce
Deploy the CDKTF stacks.
Debug Output
No response
Panic Output
No response
Important Factoids
No response
References
No response
Would you like to implement a fix?
None