0

I can delete aws transit gateway attachment via UI, but not via aws cli:

% /usr/local/bin/aws ec2 describe-transit-gateway-attachments --region ca-central-1 --transit-gateway-attachment-ids tgw-attach-00f7dc90293fb83a3  
{
    "TransitGatewayAttachments": [
        {
            "TransitGatewayAttachmentId": "tgw-attach-00f7dc90293fb83a3",
            "TransitGatewayId": "tgw-0d86b5d260027d803",
            "TransitGatewayOwnerId": "478397617193",
            "ResourceOwnerId": "478397617193",
            "ResourceType": "peering",
            "ResourceId": "tgw-04de1919be2d38d6d",
            "State": "available",
            "Association": {
                "TransitGatewayRouteTableId": "tgw-rtb-03d7c372b2f126709",
                "State": "associated"
            },
            "CreationTime": "2022-11-04T09:44:45+00:00",
        }
    ]
}

% aws ec2 delete-transit-gateway-vpc-attachment --transit-gateway-attachment-id tgw-attach-00f7dc90293fb83a3 --region ca-central-1                

An error occurred (InvalidTransitGatewayAttachmentID.NotFound) when calling the DeleteTransitGatewayVpcAttachment operation: Transit Gateway VPC Attachment tgw-attach-00f7dc90293fb83a3 was deleted or does not exist.

Why do i get this error ? It clearly exists (we can see it via aws cli and console UI). I can also delete it from UI. I have full admin right when using aws cli.

Thanks,

user2913139
  • 557
  • 2
  • 5
  • 13
  • Try https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-transit-gateway-vpc-attachments.html `describe-transit-gateway-vpc-attachments` - note the `vpc` as part of the operation name. – luk2302 Nov 07 '22 at 13:36
  • Thanks, but it's not clear . It's only describe, to delete you do not need to provide vpc, only vpc-attachment. So not sure what your suggestion is. – user2913139 Nov 07 '22 at 17:58
  • As the attachment tgw-attach-00f7dc90293fb83a3 seems to be a DXGW attachment, I'm wondering if TGW tgw-0d86b5d260027d803 has to be disassociated firstly from the Direct Connect console, following the steps listed here - https://docs.aws.amazon.com/directconnect/latest/UserGuide/direct-connect-transit-gateways.html#associate-tgw-with-direct-connect-gateway – APartha77 Jul 20 '23 at 12:56

1 Answers1

0

As the attachment tgw-attach-00f7dc90293fb83a3 seems to be a DXGW attachment, I'm wondering if TGW tgw-0d86b5d260027d803 has to be disassociated firstly from the Direct Connect console, following the steps listed here - https://docs.aws.amazon.com/directconnect/latest/UserGuide/direct-connect-transit-gateways.html#associate-tgw-with-direct-connect-gateway

APartha77
  • 89
  • 1
  • 2