aws / aws/aws-cdk

aws-applicationautoscaling: Target Tracking Scaling Policy does not support account for custom metric

Open
#36,401 2 comments 0 reactions 0 assignees View on GitHub
@aws-cdk/aws-applicationautoscaling effort/small feature-request good first issue p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

Target Scaling Policy does not return the account information from the metric so cross account metric cannot be used.

https://github.com/aws/aws-cdk/blob/244c02de488a9dfe7dad9eca1e9bb301863216bc/packages/aws-cdk-lib/aws-applicationautoscaling/lib/target-tracking-scaling-policy.ts#L170

### Regression Issue

- [ ] Select this option if this issue appears to be a regression.

### Last Known Working CDK Library Version

_No response_

### Expected Behavior

The renderCustomMetric function the target tracking policy should return the account from the metric as well

https://github.com/aws/aws-cdk/blob/244c02de488a9dfe7dad9eca1e9bb301863216bc/packages/aws-cdk-lib/aws-applicationautoscaling/lib/target-tracking-scaling-policy.ts#L162C10-L162C28

### Current Behavior

The account information is never fetched from the metric so it default to the current account when creating it

### Reproduction Steps

Create a Target Tracking Policy using a Custom Metric and specify the a different account for the metric and it will be ignored

### Possible Solution

_No response_

### Additional Information/Context

_No response_

### AWS CDK Library version (aws-cdk-lib)

2.223.0

### AWS CDK CLI version

2.1031.2

### Node.js Version

22.9.0

### OS

Amazon Linux 2023

### Language

Python

### Language Version

3.11

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start in packages/aws-cdk-lib/aws-applicationautoscaling/lib/target-tracking-scaling-policy.ts at renderCustomMetric and inspect how the custom metric account is handled. Reproduce the cross-account metric case and run the relevant aws-applicationautoscaling tests; done means the synthesized target tracking policy preserves the metric's specified account instead of defaulting to the current account.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.