-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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(aws): Add new RDS check to ensure db clusters are configured for multiple availability zones #4781
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4781 +/- ##
==========================================
- Coverage 89.13% 89.06% -0.08%
==========================================
Files 921 927 +6
Lines 28157 28383 +226
==========================================
+ Hits 25099 25278 +179
- Misses 3058 3105 +47 ☔ View full report in Codecov by Sentry. |
class rds_cluster_multi_az(Check): | ||
def execute(self): | ||
findings = [] | ||
for db_cluster in rds_client.db_clusters: |
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.
To iterate over a dict in Python I recommend you to use items()
it will retrieve the key and the value in the same iteration.
for db_cluster in rds_client.db_clusters: | |
for db_cluster_arn, db_cluster in rds_client.db_clusters.items(): |
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.
Thanks for your advice! 😄
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.
Please, revert this.
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.
Please, revert this.
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.
Please, revert this.
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.
Please, revert the changes in the instances checks since we want all the resources to appear in the check.
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.
👏🏼
Context
This new check verifies that Amazon RDS DB clusters are configured to operate across multiple Availability Zones (AZs), enhancing high availability and resilience.
Since the Multi-AZ attribute is heritable from clusters to instances, I've modified the instance check to only scan instances that are not part of a cluster. Instances that are clustered are already covered by this new check.
For testing, while Moto supports the creation of instances with MultiAZ, it does not support MultiAZ on clusters. Therefore, I've had to use MagicMock for the cluster tests.
Description
I added
rds_cluster_multi_az
with its respective unit test and modifiedrds_instance_multi_az
and its respective unit test.License
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.