-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(cloudwatch): add accountId
property to support Cross-Account visibility for Logs and Metric Widgets
#31512
base: main
Are you sure you want to change the base?
Conversation
… prop in LogQueryWidget and the 4 Metrics Widgets (AlarmWidget, GaugeWidget, GraphWidget, and SingleValueSidget ) Signed-off-by: Sumu <sumughan@amazon.com>
… prop in LogQueryWidget and the 4 Metrics Widgets (AlarmWidget, GaugeWidget, GraphWidget, and SingleValueSidget )cd Signed-off-by: Sumu <sumughan@amazon.com>
…tests for each Widget type Signed-off-by: Sumu <sumughan@amazon.com>
Signed-off-by: Sumu <sumughan@amazon.com>
Signed-off-by: Sumu <sumughan@amazon.com>
Signed-off-by: Sumu <sumughan@amazon.com>
(integ.alarm-and-dashboard.ts) Signed-off-by: Sumu <sumughan@amazon.com>
Signed-off-by: Sumu <sumughan@amazon.com>
Signed-off-by: Sumu <sumughan@amazon.com>
accountId
property to support Cross-Account/Cross-region with Logs and Metric WidgetsaccountId
property to support Cross-Account with Logs and Metric Widgets
accountId
property to support Cross-Account with Logs and Metric WidgetsaccountId
property to support Cross-Account visibility for Logs and Metric Widgets
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sumupitchayan i've got a couple of questions before i give my approval
@@ -61,6 +61,8 @@ dashboard.addWidgets(new cloudwatch.SingleValueWidget({ | |||
})); | |||
dashboard.addWidgets(new cloudwatch.LogQueryWidget({ | |||
title: 'Errors in my log group', | |||
// Setting an account ID just for this LogQueryWidget | |||
accountId: '123456789', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have specific accountIds that won't get flagged by security. is this one of them? also, account ids are 12 numbers long
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh that's good to know - I just put in a random number here, will update it 👍
* | ||
* @default - None | ||
*/ | ||
readonly accountId?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the default really none? or is the default that the accountid is the same as the account doing the cfn deploy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good callout - the property is not required, but it uses the current account by default (docs)
I'll update the comment
})); | ||
|
||
dashboard.addWidgets(new cloudwatch.GraphWidget({ | ||
title: 'Percentage of messages in each queue as pie chart', | ||
left: [metricA, metricB], | ||
view: cloudwatch.GraphWidgetView.PIE, | ||
setPeriodToTimeRange: true, | ||
accountId: '123456789', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how are any of these integ tests passing if this isn't a real account?
Signed-off-by: Sumu <sumughan@amazon.com>
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Closes #26105
Reason for this change
Support cross-account visibility on Metric and Log Widget Objects by allowing customers to specify the AWS Account ID that the data (logs or metrics) originates from. For more information, see Cross-Account Cross-Region CloudWatch Console.
CloudWatch docs shows that
accountId
is supported in CloudFormation for Logs Widget Objects and Metric Widget Objects.Description of changes
Added an optional
accountId
property toLogQueryWidgetProps
andMetricWidgetProps
. This allows you to set an Account ID onLogQueryWidget
and the four different metric widgets:AlarmWidget
GaugeWidget
GraphWidget
SingleValueWidget
Description of how you validated changes
Unit Tests
In
graph.test.ts
, I added theaccountId
property to existing tests on each of the five Widget types mentioned above, validating that they appear in the synthesized stack.Integ Tests
Same as above, I added
accountId
property to existing integ tests (integ.math-alarm-and-dashboard.ts
andinteg.alarm-and-dashboard.ts
) on each of the five Widget types, updated the snapshots and successfully deployed the integ tests.Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license