Skip to content
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

Fixed RDS Snapshot remove public access remediation job #120

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def remediate(self, client, snapshot_identifier):
# is shared publicly
logging.info("executing client.describe_db_snapshot_attributes")
logging.info(f"RDS instance={snapshot_identifier}")
snapshot_attrs_result = client.describe_db_snapshot_attributes(DBInstanceIdentifier=snapshot_identifier).get('DBSnapshotAttributesResult')
snapshot_attrs_result = client.describe_db_snapshot_attributes(DBSnapshotIdentifier=snapshot_identifier).get('DBSnapshotAttributesResult')
snapshot_attrs = snapshot_attrs_result.get("DBSnapshotAttributes")
snapshot_restore_attr = next(snapshot_attr for snapshot_attr in snapshot_attrs if snapshot_attr["AttributeName"] == "restore")
is_public = True if "all" in snapshot_restore_attr["AttributeValues"] else False
Expand All @@ -92,7 +92,7 @@ def remediate(self, client, snapshot_identifier):
logging.info("executing client.modify_db_snapshot_attribute and apply immediately")
logging.info("Attribute=Restore,Remove all AttributeValue")
client.modify_db_snapshot_attribute(
DBInstanceIdentifier=snapshot_identifier,
DBSnapshotIdentifier=snapshot_identifier,
AttributeName="restore",ValuesToRemove=["all"]
)
logging.info(
Expand Down