Amazon Web Services (AWS) - List Transit Gateway Attachements using the AWS CLI

by
Jeremy Canfield |
Updated: May 19 2024
| Amazon Web Services (AWS) articles
If you are not familiar with Transit Gateways, check out my article Amazon Web Services (AWS) - Getting Started with Transit Gateway.
The aws ec2 describe-transit-gateway-attachments command can be used to list the Virtual Private Clouds (VPCs), Virtual Private Networks (VPNs), VPC Peering Connections that are associated with your Transit Gateways. In this example, two Virtual Private Clouds (foo-vpc and bar-vpc) are associated with the Transit Gateway.
~]$ aws ec2 describe-transit-gateway-attachments
{
"TransitGatewayAttachments": [
{
"TransitGatewayAttachmentId": "tgw-attach-02454889f1d83ac46",
"TransitGatewayId": "tgw-0d92bd9f9b45070a7",
"TransitGatewayOwnerId": "123456789012",
"ResourceOwnerId": "123456789012",
"ResourceType": "vpc",
"ResourceId": "vpc-987ihg654fed321cba",
"State": "available",
"Association": {
"TransitGatewayRouteTableId": "tgw-rtb-0901a28eecf505a89",
"State": "associated"
},
"CreationTime": "2024-05-19T09:54:27+00:00",
"Tags": [
{
"Key": "Name",
"Value": "bar-vpc"
}
]
},
{
"TransitGatewayAttachmentId": "tgw-attach-03d016041bfeae2be",
"TransitGatewayId": "tgw-0d92bd9f9b45070a7",
"TransitGatewayOwnerId": "123456789012",
"ResourceOwnerId": "123456789012",
"ResourceType": "vpc",
"ResourceId": "vpc-abc123def456ghi789",
"State": "available",
"Association": {
"TransitGatewayRouteTableId": "tgw-rtb-0901a28eecf505a89",
"State": "associated"
},
"CreationTime": "2024-05-19T09:50:52+00:00",
"Tags": [
{
"Key": "Name",
"Value": "foo-vpc"
}
]
}
]
}
Did you find this article helpful?
If so, consider buying me a coffee over at