PF-05 · Multi-cloud · Python
Multi-cloud asset and audit automation
A Python tool that collects assets, permissions, and audit logs from AWS, GCP, and Tencent Cloud into one schema, and alerts on risky events.
- Role
- Design and implementation
- Period
- Personal project · released Nov 2026
- Cloud
- AWS · GCP · Tencent
- Scale
- 3 clouds · 7 collectors · 49 audit actions
- Key tech
- Python · boto3 · Google Cloud SDK · Tencent Cloud SDK · Google Sheets · Slack · Telegram
- 3
- Clouds covered by the public code
- 7
- Collectors by resource type
- 49
- Audit actions tracked (16 alert immediately)
At a glance
Problem
Each cloud returns the same concept in a different shape. Comparing permissions or firewalls meant reading three formats by hand.
Approach
Each account is reached through a cross-account role such as STS AssumeRole. Seven collectors, one per resource type, feed a single data class per resource. Output goes to Google Sheets and CSV, and 16 critical events alert Slack and Telegram immediately based on critical_events.yaml.
Result
The production tool behind this code checked four clouds including Azure every day before dawn, removed several days of manual month-end review, and together with Terraform defaults and CI gates helped raise the remediation rate from 60% to over 85%. Those figures are production results and were not measured in this repository.
Up close
One schema per resource
What this code does: Normalizes IAM data from all three clouds into the same fields.
@dataclass(frozen=True)
class IamRecord(Record):
sheet: ClassVar[str] = "IAM"
cloud: str
project: str
project_id: str
user_name: str
user_id: str
user_group: str = ""
permission: str = ""
user_creation_time: str = ""
access_key: str = ""
access_key_creation_time: str = ""
last_login: str = ""
password_last_changed: str = ""
Critical events as data
What this code does: Keeps the events that alert immediately in a list outside the code.
aws:
- AttachUserPolicy
- CreateAccessKey
- StopInstances
- TerminateInstances
- ModifyInstanceAttribute
gcp:
- SetIamPolicy
- CreateServiceAccountKey
- v1.compute.instances.stop
- v1.compute.instances.delete
- v1.compute.instances.setMachineType
tencent:
- AttachUserPolicy
- AttachUserPolicies
- CreateApiKey
- StopInstances
- TerminateInstancesWhat I learned
Keeping the critical event list as data lets a security reviewer read and change the rules without reading Python.
What I would improve
GCP and Tencent paths are tested with mocks, not live accounts. Tencent multi-account access needs one CAM role per account.