15 lines
567 B
Bash
15 lines
567 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
function formatprint() {
|
||
|
cat - > /tmp/formatprint.tmp
|
||
|
echo "# $1 ($(cat /tmp/formatprint.tmp | wc -l))"
|
||
|
#cat /tmp/formatprint.tmp | sed -e 's/^/ /g'
|
||
|
cat /tmp/formatprint.tmp | column -t -s, | sed -e 's/^/ /g'
|
||
|
rm -f /tmp/formatprint.tmp
|
||
|
}
|
||
|
|
||
|
# Generate inventory of ec2, rds, lb, and s3 buckets.
|
||
|
|
||
|
aws ec2 describe-instances --query 'Reservations[*].Instances[*].[InstanceId, Tags[?Key==`Name`].Value[] | [0], PlatformDetails, InstanceType,PrivateIpAddress, PublicIpAddress]' --output json | jq -cr '.[][] | @csv' | tr -d '[\" ' | formatprint EC2
|
||
|
|