25

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
richersoon
  • 4,682
  • 13
  • 44
  • 74

3 Answers3

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).

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 :)

Patty
  • 451
  • 1
  • 4
  • 11
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.

thanos.a
  • 2,246
  • 3
  • 33
  • 29