AWS Elastic IP Network vpc is not attached to any internet gateway
Asked Answered
G

4

27

I have given a limited access to a AWS account.

I already created an EC2 instance but when I try to associate an elastic ip, I got the error below:

An error occurred while attempting to associate the address
Network vpc-(security id) is not attached to any internet gateway
Gasworks answered 28/2, 2015 at 6:40 Comment(0)
M
33

You are using the new Amazon Virtual Private Cloud instead of the EC2 Classic. The cloud you are using lacks the internet gateway virtual component that is necessary for the cloud to be reachable from the public internet.

You need to add an internet gateway to your private cloud for it to be able to connect to internet; with that in place, you can use Elastic IPs (after all, they are internet addressable; your VPC instances can have static instance IPs), and add a routing entry for internet addresses (0.0.0.0/0, or a narrower space).

Merna answered 28/2, 2015 at 6:47 Comment(0)
A
5

This error occurs because the VPC is not associated with an Internet Gateway. To solve this: Go to VPC, then click on Internet Gateway. If none exists, Create one(probably will need admin permission) and then attach it to the target VPC-id. And try again associating the Elastic IP address to the EC2 instance. Hope it helps :)

Accusal answered 6/1, 2020 at 14:39 Comment(0)
D
3

You need to assign an Internet Gateway to your VPC.

  1. Go to VPC service and under VIRTUAL PRIVATE CLOUD on the left, click "Internet Gateways"
  2. To create a new one, click on "Create Internet gateway", give it a name and create it
  3. Select the Gateway on the list, click "Actions" and "Attach to VPC"
  4. Select the VPC and click on "Attach Internet gateway"

Then you will be able to Assign the Elastic IP to your EC2 instance.

Diarist answered 12/10, 2021 at 8:46 Comment(0)
H
0

Adding to the answer set here to add another case:

If you've been launching EKS clusters, EC2 may have configured the VPC that supports/supported your EKS cluster to be the default for the launch of new EC2 instances. This can be the case if you forgot to "clean up" and delete the VPC used for this purpose. EKS completes a lot of automatic actions behind the scenes, and one of those actions is to set up a new VPC.

If you've got an EKS VPC hanging around, it may be the default during the launching of new EC2 instances. Ensure you select the other VPC if you want to launch instances as you may have done prior to setting up EKS.

Ignore this answer if you haven't been setting up Kubernetes clusters through EKS on AWS!

Hydromechanics answered 28/3 at 22:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.