-
Notifications
You must be signed in to change notification settings - Fork 4.2k
feat(cloudwatch): add account id field for log query and metric widgets to support cross account visibility #34793
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
Conversation
…ts to support cross-account visibility
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.
Can you update the title to something that will better inform users in the changelog ? The current title doesn't really reflect that this adds support for cross account widget support
Done |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
This pull request has been removed from the queue for the following reason: The pull request can't be updated. You should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again. |
@Mergifyio requeue |
✅ The queue state of this pull request has been cleaned. It can be re-embarked automatically |
This pull request has been removed from the queue for the following reason: The pull request can't be updated. You should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again. |
@Mergifyio requeue |
✅ The queue state of this pull request has been cleaned. It can be re-embarked automatically |
This pull request has been removed from the queue for the following reason: The pull request can't be updated. You should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again. |
@Mergifyio update |
❌ Mergify doesn't have permission to updateFor security reasons, Mergify can't update this pull request. Try updating locally. |
@Mergifyio rebase |
❌ Unable to rebase: user
|
@Mergifyio rebase |
❌ Unable to rebase: user
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
This pull request has been removed from the queue for the following reason: The pull request can't be updated. You should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again. |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Comments on closed issues and PRs are hard for our team to see. |
Issue # (if applicable)
Closes #26105
Reason for this change
CloudWatch supports cross-account visibility for dashboards, allowing users to view metrics and logs from multiple AWS accounts in a single dashboard. However, the CDK CloudWatch construct library was missing the ability to specify the account ID for widgets, preventing users from creating cross-account dashboards using CDK.
Description of changes
I've added an optional accountId property to the following interfaces and classes:
• MetricWidgetProps interface in graph.ts (base interface for metric widgets)
• LogQueryWidgetProps interface in log-query.ts
This property is then passed through to the CloudWatch dashboard JSON for each widget type:
• AlarmWidget
• GraphWidget
• SingleValueWidget
• GaugeWidget
• TableWidget
• LogQueryWidget
I've also:
• Added comprehensive JSDoc documentation explaining the cross-account functionality
• Updated the README.md with a new section on cross-account visibility
• Updated unit tests to verify the accountId is properly included in the widget JSON
• Updated integration tests to demonstrate the feature
Design decisions:
• Made accountId optional to maintain backward compatibility
• Added the property to the base interfaces to ensure consistent implementation across widget types
• Provided clear documentation on prerequisites for cross-account functionality
Describe any new or updated permissions being added
No new IAM permissions are added by this change in the CDK code itself. However, users implementing cross-account CloudWatch dashboards will need to configure appropriate permissions between their accounts:
Description of how you validated changes
• Added unit tests for all widget types to verify the accountId property is correctly passed to the CloudWatch dashboard JSON
• Updated integration tests to include accountId in various widget configurations
Checklist
• [x] My code adheres to the CONTRIBUTING GUIDE and DESIGN GUIDELINES