Difference between revisions of "Aws ec2 describe-vpcs"

From wikieduonline
Jump to navigation Jump to search
 
(23 intermediate revisions by 4 users not shown)
Line 2: Line 2:
 
https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-vpcs.html
 
https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-vpcs.html
  
 +
* <code>[[aws ec2]] describe-vpcs --output=text | [[egrep -w]] "Name|VPCS"</code>
 +
* <code>aws ec2 describe-vpcs --output table</code>
 +
 +
 +
aws ec2 describe-vpcs --output table | egrep "[[Name]]|VpcId"
 +
aws ec2 describe-vpcs | grep [[VpcId]]
 +
aws ec2 describe-vpcs | grep -w [[CidrBlock]]
 +
 +
[[aws ec2]] describe-vpcs | grep [[IsDefault]]
 +
 +
 +
== Examples --output=text ==
 
  [[aws ec2]] describe-vpcs --output=text
 
  [[aws ec2]] describe-vpcs --output=text
  VPCS    172.31.0.0/16  dopt-74d4af1f  default True    688850446548    available      vpc-2e452445
+
  VPCS    [[172.31]].0.0/16  dopt-74d4af1f  default True    688850446548    available      vpc-2e452445
 
  CIDRBLOCKASSOCIATIONSET vpc-cidr-assoc-a74320cc 172.31.0.0/16
 
  CIDRBLOCKASSOCIATIONSET vpc-cidr-assoc-a74320cc 172.31.0.0/16
 
  CIDRBLOCKSTATE  associated
 
  CIDRBLOCKSTATE  associated
  
[[aws ec2]] describe-vpcs --output=text | [[grep -w]] VPCS
+
 
 +
[[Terraform EKS]]
 +
aws ec2 describe-vpcs --output=text
 +
VPCS 172.31.0.0/16 dopt-05fc539d5638b77c0 default True 293903531442 available vpc-0d1aa2c72e8379754
 +
CIDRBLOCKASSOCIATIONSET vpc-cidr-assoc-0e746aeae08276b7b 172.31.0.0/16
 +
CIDRBLOCKSTATE associated
 +
VPCS 10.0.0.0/16 dopt-05fc539d5638b77c0 default False 293903531442 available vpc-0770c78924d952f80
 +
CIDRBLOCKASSOCIATIONSET vpc-cidr-assoc-0eaf64cde6dbefdf2 10.0.0.0/16
 +
CIDRBLOCKSTATE associated
 +
TAGS kubernetes.io/cluster/education-eks-LZIQaQdP shared
 +
TAGS Name education-vpc
  
 
== Example ==
 
== Example ==
Line 17: Line 39:
 
             "DhcpOptionsId": "dopt-74d4af1f",
 
             "DhcpOptionsId": "dopt-74d4af1f",
 
             "State": "available",
 
             "State": "available",
             "VpcId": "vpc-2e452445",
+
             "[[VpcId]]": "vpc-2e452445",
 
             "OwnerId": "688850446548",
 
             "OwnerId": "688850446548",
             "InstanceTenancy": "default",
+
             "[[InstanceTenancy]]": "default",
 
             "CidrBlockAssociationSet": [
 
             "CidrBlockAssociationSet": [
 
                 {
 
                 {
Line 33: Line 55:
 
     ]
 
     ]
 
  }
 
  }
 +
 +
 +
=== Amazon doc example ===
 +
<pre>
 +
{
 +
    "Vpcs": [
 +
        {
 +
            "CidrBlock": "10.0.0.0/16",
 +
            "DhcpOptionsId": "dopt-19edf471",
 +
            "State": "available",
 +
            "VpcId": "vpc-06e4ab6c6cEXAMPLE",
 +
            "OwnerId": "111122223333",
 +
            "InstanceTenancy": "default",
 +
            "CidrBlockAssociationSet": [
 +
                {
 +
                    "AssociationId": "vpc-cidr-assoc-00b17b4eddEXAMPLE",
 +
                    "CidrBlock": "10.0.0.0/16",
 +
                    "CidrBlockState": {
 +
                        "State": "associated"
 +
                    }
 +
                }
 +
            ],
 +
            "IsDefault": false,
 +
            "Tags": [
 +
                {
 +
                    "Key": "Name",
 +
                    "Value": "Shared VPC"
 +
                }
 +
            ]
 +
        }
 +
    ]
 +
}
 +
</pre>
  
 
== Related ==
 
== Related ==
 
* <code>[[aws list all]]</code>
 
* <code>[[aws list all]]</code>
 
+
* <code>[[aws ec2 describe-subnets]]</code>
 +
* <code>[[aws ec2 describe-subnets]] | grep -w [[CidrBlock]]</code>
 +
* <code>[[aws ec2 create-vpc]]</code>
 +
* <code>[[jq -r]]</code>
 +
* <code>[[aws ec2 describe-security-groups]]</code>
 +
* <code>[[aws ec2 describe-vpc-peering-connections]]</code>
  
 
== See also ==
 
== See also ==
* {{aws ec2}}
+
* {{aws ec2 vpc}}
 
* {{AWS VPC}}
 
* {{AWS VPC}}
* {{VPC}}
+
 
  
 
[[Category:AWS]]
 
[[Category:AWS]]

Latest revision as of 11:00, 19 October 2023

https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-vpcs.html

  • aws ec2 describe-vpcs --output=text | egrep -w "Name|VPCS"
  • aws ec2 describe-vpcs --output table


aws ec2 describe-vpcs --output table | egrep "Name|VpcId"
aws ec2 describe-vpcs | grep VpcId
aws ec2 describe-vpcs | grep -w CidrBlock
aws ec2 describe-vpcs | grep IsDefault


Examples --output=text[edit]

aws ec2 describe-vpcs --output=text
VPCS    172.31.0.0/16   dopt-74d4af1f   default True    688850446548    available       vpc-2e452445
CIDRBLOCKASSOCIATIONSET vpc-cidr-assoc-a74320cc 172.31.0.0/16
CIDRBLOCKSTATE  associated


Terraform EKS

aws ec2 describe-vpcs --output=text
VPCS	172.31.0.0/16	dopt-05fc539d5638b77c0	default	True	293903531442	available	vpc-0d1aa2c72e8379754
CIDRBLOCKASSOCIATIONSET	vpc-cidr-assoc-0e746aeae08276b7b	172.31.0.0/16
CIDRBLOCKSTATE	associated
VPCS	10.0.0.0/16	dopt-05fc539d5638b77c0	default	False	293903531442	available	vpc-0770c78924d952f80
CIDRBLOCKASSOCIATIONSET	vpc-cidr-assoc-0eaf64cde6dbefdf2	10.0.0.0/16
CIDRBLOCKSTATE	associated
TAGS	kubernetes.io/cluster/education-eks-LZIQaQdP	shared
TAGS	Name	education-vpc

Example[edit]

aws ec2 describe-vpcs
{
    "Vpcs": [
        {
            "CidrBlock": "172.31.0.0/16",
            "DhcpOptionsId": "dopt-74d4af1f",
            "State": "available",
            "VpcId": "vpc-2e452445",
            "OwnerId": "688850446548",
            "InstanceTenancy": "default",
            "CidrBlockAssociationSet": [
                {
                    "AssociationId": "vpc-cidr-assoc-a74320cc",
                    "CidrBlock": "172.31.0.0/16",
                    "CidrBlockState": {
                        "State": "associated"
                    }
                }
            ],
            "IsDefault": true
        }
    ]
}


Amazon doc example[edit]

{
    "Vpcs": [
        {
            "CidrBlock": "10.0.0.0/16",
            "DhcpOptionsId": "dopt-19edf471",
            "State": "available",
            "VpcId": "vpc-06e4ab6c6cEXAMPLE",
            "OwnerId": "111122223333",
            "InstanceTenancy": "default",
            "CidrBlockAssociationSet": [
                {
                    "AssociationId": "vpc-cidr-assoc-00b17b4eddEXAMPLE",
                    "CidrBlock": "10.0.0.0/16",
                    "CidrBlockState": {
                        "State": "associated"
                    }
                }
            ],
            "IsDefault": false,
            "Tags": [
                {
                    "Key": "Name",
                    "Value": "Shared VPC"
                }
            ]
        }
    ]
}

Related[edit]

See also[edit]

Advertising: