EC2 instances in VPC and access to the Internet

amazon ec2amazon-vpcnetworking

I am playing a bit with AWS. I created one VPC (with 10.1.0.0./24 net) and two EC2 instances attached to it. One EC2 has 10.1.0.4, second 10.1.0.5 . I allocated one Elastic IP to VPC and associated it to Network Interface which belongs to 10.1.0.4 EC2 instance. The VPC is a custom one created by me. One of the most importand thing for me is, that public IP must retain (payment provider requires this).
The problem is, that from first EC2 (10.1.0.4) I can access Internet but from second one (10.1.0.5) it's totally impossible. It must be said, that first EC2 (.0.4) should be WebServer while second one (.0.5) is a database server.

What am I doing wrong? Is above configuration good for what I want to achieve?

Thank you in advance for any tip.

Piotr

Best Answer

Instances in a VPC only have access to the public internet if they have an Elastic IP or if their subnet is routed through a NAT instance. Assign an Elastic IP (if you like, you can have this done automatically on launch so you don't have to worry about associating/deassociating) and it'll have access.

Related Topic