NEW: new inventory scripts for eks, rds, elasticsearch, elasticache

This commit is contained in:
xpk 2024-04-18 09:11:00 +08:00
parent fba726847c
commit cc01a5449c
Signed by: xpk
GPG Key ID: CD4FF6793F09AB86
4 changed files with 66 additions and 0 deletions

18
aws/aws-eks-inventory.sh Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash
function listRes() {
aws --region $1 eks list-clusters --query clusters[] --output text | sed -e 's/\t/\n/g' | while read i; do
aws --region $1 eks describe-cluster --name $i | jq -cr '.cluster | [.name, .version] | @csv' | tr -d \"
done
}
export -f listRes
# Generate inventory of ec2 in all regions
echo "ClusterName,ClusterVersion"
aws --region=us-east-1 ec2 describe-regions --query Regions[].RegionName --output text | sed -e 's/\t/\n/g' | while read r; do
sem -j6 listRes $r
done
sem --wait

View File

@ -0,0 +1,16 @@
#!/bin/bash
function listRes() {
aws elasticache --region $1 describe-cache-clusters | jq -cr '.CacheClusters[] | [.CacheClusterId, .CacheNodeType, .Engine, .PreferredAvailabilityZone] | @csv' | tr -d \"
}
export -f listRes
# Generate inventory of ec2 in all regions
echo "ClusterId,NodeType,Engine,AZ"
aws --region=us-east-1 ec2 describe-regions --query Regions[].RegionName --output text | sed -e 's/\t/\n/g' | while read r; do
sem -j6 listRes $r
done
sem --wait

View File

@ -0,0 +1,16 @@
#!/bin/bash
function listRes() {
aws --region $1 opensearch list-domain-names | jq -cr '.DomainNames[] | [.DomainName, .EngineType] | @csv' | tr -d \"
}
export -f listRes
# Generate inventory of ec2 in all regions
echo "DomainName, EngineType"
aws --region=us-east-1 ec2 describe-regions --query Regions[].RegionName --output text | sed -e 's/\t/\n/g' | while read r; do
sem -j6 listRes $r
done
sem --wait

16
aws/aws-rds-inventory.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
function listRes() {
aws rds describe-db-instances --region $1 | jq -cr '.DBInstances[] | [.DBInstanceIdentifier, .DBInstanceClass, .Engine, .AvailabilityZone, .MultiAZ] | @csv' | tr -d \"
}
export -f listRes
# Generate inventory of ec2 in all regions
echo "InstanceId,InstanceClass,Engine,AZ,MultiAz"
aws --region=us-east-1 ec2 describe-regions --query Regions[].RegionName --output text | sed -e 's/\t/\n/g' | while read r; do
sem -j6 listRes $r
done
sem --wait