Skip to content

Instantly share code, notes, and snippets.

@paulstakem
Created July 17, 2019 14:48
Show Gist options
  • Save paulstakem/1d10a8fed0e7d9b7c8ef2f8ae009e44e to your computer and use it in GitHub Desktop.
Save paulstakem/1d10a8fed0e7d9b7c8ef2f8ae009e44e to your computer and use it in GitHub Desktop.

Revisions

  1. paulstakem created this gist Jul 17, 2019.
    28 changes: 28 additions & 0 deletions simple_aws_resource_list.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    #!/usr/bin/env bash
    export AWS_REGION=eu-west-2

    # VPCs
    echo "### VPCs"
    aws ec2 describe-vpcs --region $AWS_REGION | jq -r '.Vpcs[] | "\(.VpcId) - \(.CidrBlock) - \(.IsDefault)"' | sort
    echo ""
    # Subnets
    echo "### Subnets"
    aws ec2 describe-subnets --region $AWS_REGION | jq -r '.Subnets[] | "\(.SubnetId) - \(.CidrBlock) - \(.AvailabilityZone)"' | sort
    echo ""
    # ELB/ALB/NLB
    echo "### ELB/ALB/NLB"
    aws elb describe-load-balancers --region $AWS_REGION | jq -r '.LoadBalancerDescriptions[] | "\(.LoadBalancerName) - \(.DNSName)"'
    aws elbv2 describe-load-balancers --region $AWS_REGION | jq -r '.LoadBalancers[] | "\(.LoadBalancerName) - \(.DNSName)"'
    echo ""
    # S3 Buckets
    echo "### S3"
    aws s3 ls | awk '{print $(NF)}'
    echo ""
    # EC2 Instances
    echo "### EC2"
    aws ec2 describe-instances --region $AWS_REGION | jq -r '.Reservations[] |.Instances[] | "\(.InstanceId) - \(.InstanceType) - \(.ImageId) - \(.PrivateIpAddress)"'
    echo ""
    # RDS
    echo "### RDS"
    aws rds describe-db-clusters --region $AWS_REGION | jq -r '.DBClusters[] | "\(.DatabaseName) - \(.Engine) - \(.EngineVersion)"'
    echo ""