Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't delete AWS internet Gateway

I created an internet gateway in AWS VPC dashboard, I attached it to a VPC then I want to detach it but I keep getting this error:

Network vpc-xxxx has some mapped public adresses, Please unmap those public addresses before detaching the gateway. ( Service: AmazonEC2; Status Code: 400; Error Code: DependencyViolation; Request ID: qfdqsdf) 

What to do to detache this IGW ? Why exactly do I get this error?

I need to get rid of this IGW without deleting extra resources. please any ideas?

For information, the route table of the VPC does contain public addresses but they are routed to other targets. This IGW is not set as target anywhere.

like image 692
Souad Avatar asked Jul 11 '17 07:07

Souad


People also ask

Can I delete Internet gateway in AWS?

To delete an internet gatewayOpen the Amazon VPC console at https://console.aws.amazon.com/vpc/ . In the navigation pane, choose Internet gateways. Select the internet gateway and choose Actions, Delete internet gateway.

How do I force delete AWS network interface?

In the navigation pane, under Network Interfaces, search for the VPC ID of the Amazon VPC that you're deleting. Select the network interface and choose the Details tab. Review the Description to see which resources the network interface is attached to. Delete the associated resources.

How do I get rid of a failed NAT gateway?

NAT gateway creation fails A failed NAT gateway is automatically deleted, usually in about an hour. There was an error when the NAT gateway was created. The returned state message provides the reason for the error. To view the error message, open the Amazon VPC console, and then choose NAT Gateways.


1 Answers

You have some resources in the VPC that have been assigned a Public IP address, such as:

  • Amazon EC2 instances
  • Amazon RDS instances
  • Amazon Redshift cluster
  • VPC NAT Gateways
  • etc.

These IP addresses might have been assigned as an Elastic IP address or as an "auto-assign Public IP address" no instance creation.

You will need to delete these Elastic IP addresses before the Internet Gateway can be removed. If they were auto-assigned IP addresses, then Stop the instances to remove the public IP addresses.

You might also need to edit your Route Tables so that they do not refer to the Internet Gateway.

like image 100
John Rotenstein Avatar answered Sep 18 '22 07:09

John Rotenstein