feat(ecs): add L2 support for service monitoring configuration - #38402
Open
kawaaaas wants to merge 3 commits into
Open
feat(ecs): add L2 support for service monitoring configuration#38402kawaaaas wants to merge 3 commits into
kawaaaas wants to merge 3 commits into
Conversation
Contributor
|
👋 It looks like your PR description follows the template but is missing a valid issue number in the first section. PRs without a linked issue will receive lower priority for review and merging. Please update the description to include a reference like |
aws-cdk-automation
temporarily deployed
to
automation
July 25, 2026 09:55 — with
GitHub Actions
Inactive
aws-cdk-automation
temporarily deployed
to
automation
July 25, 2026 09:55 — with
GitHub Actions
Inactive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue # (if applicable)
N/A
Reason for this change
AWS::ECS::Servicerecently added aMonitoringproperty that lets a service publish itsCPUUtilizationandMemoryUtilizationCloudWatch metrics at 20-second resolution instead of the default 60 seconds, enabling faster-reacting auto scaling. The L1 (CfnService.monitoring) was already generated, but there was no L2 surface for it, so users had no typed way to configure this.Description of changes
Added
monitoringtoBaseServiceOptions(available on bothEc2ServiceandFargateService), backed by two new strongly-typed constructs instead of exposing the raw CFN shape directly:ServiceMetricName(enum)CPU_UTILIZATION|MEMORY_UTILIZATION— mirrors the CFNMetricNamesallowed values.MetricResolution(enum-like class)TWENTY_SECONDS|SIXTY_SECONDS— mirrors the CFNResolutionSecondsallowed values (20|60). ADuration-based API was considered and rejected because it would accept arbitrary values that only fail at deploy time; the enum-like class rejects invalid values at compile time instead.ServiceMetricConfiguration/ServiceMonitoringConfiguration(structs)Group these into the same one-resolution-to-many-metric-names shape CFN uses.
Validation added. Cross-referencing the ECS API reference and the high-resolution metrics guide surfaced constraints not captured in the generated L1 types, so synth-time
ValidationErrors were added:metricNamesmust have 1–5 entries (the API requires at least one).metricConfigurationsmust have at most 5 entries.TWENTY_SECONDS) monitoring is not supported with theCODE_DEPLOYorEXTERNALdeployment controller (documented AWS limitation) — mirrors the existingisEcsDeploymentControllercheck already used fordeploymentAlarms.metricConfigurationsarray is normalized toundefined(omitsMonitoringfrom the template entirely), for consistency with howloadBalancershandles empty arrays elsewhere in this file.Confirmed with AWS documentation that service-level monitoring metrics (and this configuration) are supported on both EC2 and Fargate launch types.
Describe any new or updated permissions being added
None
Description of how you validated changes
Add both unit and integ tests
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license