user2913139
user2913139

Reputation: 627

can not delete transit gateway attachment via aws cli

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,

Upvotes: 0

Views: 1260

Answers (1)

APartha77
APartha77

Reputation: 109

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

Upvotes: 0

Related Questions