$npx -y skills add BagelHole/DevOps-Security-Agent-Skills --skill asset-inventoryMaintain IT asset inventory and configuration management database. Track hardware, software, and cloud resources. Use when managing IT assets.
| 1 | # Asset Inventory |
| 2 | |
| 3 | Maintain comprehensive IT asset inventory using automated discovery, AWS Config rules, cloud asset discovery scripts, CMDB integration, and tagging enforcement for compliance and operational visibility. |
| 4 | |
| 5 | ## When to Use |
| 6 | |
| 7 | - Building or maintaining an IT asset inventory for compliance frameworks (ISO 27001, SOC 2, FedRAMP) |
| 8 | - Implementing automated cloud resource discovery across accounts and regions |
| 9 | - Enforcing tagging standards for cost allocation, ownership, and data classification |
| 10 | - Integrating asset data with a CMDB for operational workflows |
| 11 | - Preparing for audits that require a complete system component inventory |
| 12 | |
| 13 | ## Asset Categories and Schema |
| 14 | |
| 15 | ```yaml |
| 16 | asset_categories: |
| 17 | compute: |
| 18 | cloud: |
| 19 | - EC2 instances / Azure VMs / GCE instances |
| 20 | - Lambda functions / Azure Functions / Cloud Functions |
| 21 | - ECS/EKS clusters and tasks |
| 22 | - Container images in registries |
| 23 | on_premise: |
| 24 | - Physical servers |
| 25 | - Virtual machines (VMware, Hyper-V) |
| 26 | |
| 27 | storage: |
| 28 | - S3 buckets / Azure Storage / GCS buckets |
| 29 | - EBS volumes / Managed Disks / Persistent Disks |
| 30 | - RDS instances / Azure SQL / Cloud SQL |
| 31 | - DynamoDB tables / Cosmos DB / Firestore |
| 32 | - EFS / Azure Files / Filestore |
| 33 | |
| 34 | network: |
| 35 | - VPCs / VNets / VPC Networks |
| 36 | - Load balancers (ALB, NLB, Azure LB, GCP LB) |
| 37 | - DNS zones and records |
| 38 | - VPN gateways and connections |
| 39 | - CDN distributions |
| 40 | |
| 41 | security: |
| 42 | - IAM users, roles, and policies |
| 43 | - KMS keys / Key Vault keys |
| 44 | - Certificates (ACM, Key Vault, Certificate Manager) |
| 45 | - Security groups / NSGs / Firewall rules |
| 46 | - WAF configurations |
| 47 | |
| 48 | applications: |
| 49 | - SaaS subscriptions |
| 50 | - Licensed software |
| 51 | - Custom applications |
| 52 | - APIs and integrations |
| 53 | |
| 54 | endpoints: |
| 55 | - Laptops and desktops |
| 56 | - Mobile devices |
| 57 | - Printers and peripherals |
| 58 | |
| 59 | asset_record_schema: |
| 60 | required_fields: |
| 61 | asset_id: "Unique identifier (auto-generated)" |
| 62 | name: "Human-readable name" |
| 63 | type: "Category from above taxonomy" |
| 64 | provider: "AWS / Azure / GCP / On-Premise / SaaS" |
| 65 | account_or_subscription: "Cloud account ID" |
| 66 | region: "Deployment region/location" |
| 67 | owner: "Team or individual responsible" |
| 68 | data_classification: "Public / Internal / Confidential / Restricted" |
| 69 | environment: "Production / Staging / Development / Sandbox" |
| 70 | status: "Active / Decommissioning / Retired" |
| 71 | created_date: "When the asset was provisioned" |
| 72 | last_seen: "Last automated discovery timestamp" |
| 73 | |
| 74 | optional_fields: |
| 75 | cost_center: "For cost allocation" |
| 76 | compliance_scope: "SOC2 / HIPAA / PCI / None" |
| 77 | backup_policy: "Backup schedule reference" |
| 78 | dr_tier: "Critical / Essential / Standard / Non-essential" |
| 79 | expiration_date: "For time-limited resources" |
| 80 | tags: "Key-value pairs from cloud provider" |
| 81 | dependencies: "Upstream and downstream services" |
| 82 | ``` |
| 83 | |
| 84 | ## AWS Resource Discovery Script |
| 85 | |
| 86 | ```bash |
| 87 | #!/usr/bin/env bash |
| 88 | # aws-asset-discovery.sh - Discover and inventory all AWS resources |
| 89 | |
| 90 | OUTPUT_DIR="./asset-inventory/aws/$(date +%Y-%m-%d)" |
| 91 | mkdir -p "$OUTPUT_DIR" |
| 92 | ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text) |
| 93 | |
| 94 | echo "=== AWS Asset Discovery for Account $ACCOUNT_ID ===" |
| 95 | |
| 96 | # EC2 Instances |
| 97 | echo "--- EC2 Instances ---" |
| 98 | aws ec2 describe-instances \ |
| 99 | --query 'Reservations[*].Instances[*].{ |
| 100 | InstanceId:InstanceId, |
| 101 | Type:InstanceType, |
| 102 | State:State.Name, |
| 103 | AZ:Placement.AvailabilityZone, |
| 104 | VpcId:VpcId, |
| 105 | PrivateIP:PrivateIpAddress, |
| 106 | PublicIP:PublicIpAddress, |
| 107 | LaunchTime:LaunchTime, |
| 108 | Name:Tags[?Key==`Name`].Value|[0], |
| 109 | Owner:Tags[?Key==`Owner`].Value|[0], |
| 110 | Environment:Tags[?Key==`Environment`].Value|[0] |
| 111 | }' --output json | jq 'flatten' > "$OUTPUT_DIR/ec2-instances.json" |
| 112 | |
| 113 | # RDS Databases |
| 114 | echo "--- RDS Instances ---" |
| 115 | aws rds describe-db-instances \ |
| 116 | --query 'DBInstances[*].{ |
| 117 | DBInstanceId:DBInstanceIdentifier, |
| 118 | Engine:Engine, |
| 119 | EngineVersion:EngineVersion, |
| 120 | Class:DBInstanceClass, |
| 121 | Status:DBInstanceStatus, |
| 122 | MultiAZ:MultiAZ, |
| 123 | Encrypted:StorageEncrypted, |
| 124 | Endpoint:Endpoint.Address, |
| 125 | BackupRetention:BackupRetentionPeriod |
| 126 | }' --output json > "$OUTPUT_DIR/rds-instances.json" |
| 127 | |
| 128 | # S3 Buckets |
| 129 | echo "--- S3 Buckets ---" |
| 130 | aws s3api list-buckets --query 'Buckets[*].{Name:Name,Created:CreationDate}' --output json | \ |
| 131 | jq -c '.[]' | while read -r bucket; do |
| 132 | name=$(echo "$bucket" | jq -r '.Name') |
| 133 | region=$(aws s3api get-bucket-location --bucket "$name" --query 'LocationConstraint' --output text 2>/dev/null) |
| 134 | encryption=$(aws s3api get-bucket-encryption --bucket "$name" 2>/dev/null | jq -r '.ServerSideEncryptionConfiguration.Rules[0].ApplyServerSideEncryptionByDefault.SSEAlgorithm' 2>/dev/null) |
| 135 | versioning=$(aws s3api get-bucket-versioning --bucket "$name" |