4545
4646_DEFAULT_MAX_AGE_DAYS : int = 90
4747
48- # Tag key prefix that indicates explicit AWS Backup management (spec § 4, § 5A.6).
48+ # Tag key prefix that indicates explicit AWS Backup management (spec 4, 5A.6).
4949# Only aws:backup: is defined by this spec. DLM is not in scope.
5050_BACKUP_TAG_PREFIX : str = "aws:backup:"
5151
@@ -95,7 +95,7 @@ def _check_external_sharing(ec2, snap_id: str) -> Tuple[bool, bool]:
9595
9696
9797def _is_backup_managed (snap : dict ) -> bool :
98- """Return True if the snapshot has an explicit aws:backup: tag (spec § 4, § 5A.6).
98+ """Return True if the snapshot has an explicit aws:backup: tag (spec 4, 5A.6).
9999
100100 Only tag-based detection; full AWS Backup API integration is not in this spec.
101101 A negative result means UNKNOWN (no tag evidence found), not confirmed non-Backup.
@@ -113,7 +113,7 @@ def find_old_ebs_snapshots(
113113) -> List [Finding ]:
114114 ec2 = session .client ("ec2" , region_name = region )
115115
116- # Build AMI snapshot index before evaluating snapshots (spec § 5A.4, § 6, § 10).
116+ # Build AMI snapshot index before evaluating snapshots (spec 5A.4, 6, 10).
117117 # If this fails, AMI linkage cannot be verified → all candidates are skipped.
118118 ami_snapshot_ids , ami_index_failed = _build_ami_snapshot_index (ec2 )
119119
@@ -127,42 +127,42 @@ def find_old_ebs_snapshots(
127127 snap_id = snap .get ("SnapshotId" )
128128 start_time = snap .get ("StartTime" )
129129
130- # EXCLUSION: malformed record (spec § 3)
130+ # EXCLUSION: malformed record (spec 3)
131131 if not snap_id or start_time is None :
132132 continue
133133
134- # EXCLUSION: status != completed (spec § 5A.1)
134+ # EXCLUSION: status != completed (spec 5A.1)
135135 if snap .get ("State" ) != "completed" :
136136 continue
137137
138- # EXCLUSION: non-standard storage tier (spec § 5A.2)
138+ # EXCLUSION: non-standard storage tier (spec 5A.2)
139139 # StorageTier absent → treated as standard per AWS default.
140140 storage_tier = snap .get ("StorageTier" , "standard" )
141141 if storage_tier != "standard" :
142142 continue
143143
144- # EXCLUSION: age threshold (spec § 5A.3)
144+ # EXCLUSION: age threshold (spec 5A.3)
145145 age_days = (now - start_time ).days
146146 if age_days < max_age_days :
147147 continue
148148
149- # EXCLUSION: AMI linkage (spec § 5A.4, § 10)
149+ # EXCLUSION: AMI linkage (spec 5A.4, 10)
150150 # If the index build failed, AMI linkage cannot be verified → SKIP.
151151 # Never treat missing visibility as "no AMI links".
152152 if ami_index_failed :
153153 continue
154154 if snap_id in ami_snapshot_ids :
155155 continue
156156
157- # EXCLUSION: external sharing (spec § 5A.5, § 10)
157+ # EXCLUSION: external sharing (spec 5A.5, 10)
158158 # Per-snapshot check. If the check fails → SKIP that snapshot.
159159 shared_externally , sharing_check_failed = _check_external_sharing (ec2 , snap_id )
160160 if sharing_check_failed :
161161 continue
162162 if shared_externally :
163163 continue
164164
165- # EXCLUSION: explicit AWS Backup-managed (spec § 5A.6)
165+ # EXCLUSION: explicit AWS Backup-managed (spec 5A.6)
166166 # Tag-based heuristic (aws:backup: prefix only). Only explicit True suppresses;
167167 # unknown (no tag evidence) does not block.
168168 if _is_backup_managed (snap ):
@@ -201,7 +201,7 @@ def find_old_ebs_snapshots(
201201 resource_type = "aws.ebs.snapshot" ,
202202 resource_id = snap_id ,
203203 region = region ,
204- estimated_monthly_cost_usd = None , # spec § 9: no cost from volumeSize
204+ estimated_monthly_cost_usd = None , # spec 9: no cost from volumeSize
205205 title = "Old EBS snapshot review candidate" ,
206206 summary = (
207207 f"EBS snapshot is { age_days } days old "
0 commit comments