NEW: simple aws inventory script

This commit is contained in:
xpk 2021-11-29 16:16:51 +08:00
parent 4d0c692bf0
commit 607f5631ae
Signed by: xpk
GPG Key ID: CD4FF6793F09AB86

30
aws/aws-inventory.sh Executable file
View File

@ -0,0 +1,30 @@
#!/bin/bash
# Generate inventory of ec2, rds, lb, and s3 buckets.
echo "# EC2"
aws ec2 describe-instances --query 'Reservations[*].Instances[*].[InstanceId, Tags[?Key==`Name`].Value[] | [0], Platform, InstanceType]' --output text | nl
echo "# RDS"
aws rds describe-db-instances --query 'DBInstances[*].[DBInstanceIdentifier, DBInstanceClass, Engine, AllocatedStorage]' --output text | nl
echo "# elasticache"
aws elasticache describe-cache-clusters --query 'CacheClusters[*].[CacheClusterId, CacheNodeType, Engine, EngineVersion]' --output text | nl
echo "# LB"
aws elb describe-load-balancers --query 'LoadBalancerDescriptions[*].[LoadBalancerName,Scheme]' --output text | nl
echo "# VPC"
aws ec2 describe-vpcs --query 'Vpcs[*].[VpcId, CidrBlock]' --output text | nl
echo "# S3buckets"
aws s3api list-buckets --output text | awk '{print $NF}' | nl
echo "# ECS"
aws ecs list-clusters | jq -cr '.[][]' | awk -F/ '{print $NF}' | nl
echo "# EKS"
aws eks list-clusters | jq '.[][]' | awk -F/ '{print $NF}' | nl
echo "# CloudFront"
aws cloudfront list-distributions --query 'DistributionList.Items[*].[DomainName]' --output text | nl