Skip to content

Is VPC required for an EC2 instance? It just seems to add unnecessary cost.

0

I have a number of EC2 instances, each of which is essentially a public web server. They have public IP addresses assigned per EC2 instance. However, there is also a VPC, which does what? Why would I need isolation from the public internet, when all these instances are intended to be public? This isn't a multi-tier structure.

If I delete the VPC, will the EC2 instances be disconnected from the public internet? I don't remember actually creating a VPC instance....

Any help would be appreciated - these are live instances, so don't really want to experiment.

-Dave

asked 2 years ago1.5K views

1 Answer
0
Accepted Answer

Dave, I understand your concern about the necessity of a VPC for your EC2 instances, but I need to clarify a few important points:

  1. VPC is indeed required for EC2 instances. It's not an optional component that adds unnecessary cost. In fact, every EC2 instance must be launched into a VPC.

  2. You mentioned not remembering creating a VPC. This is because AWS automatically creates a default VPC in each region when you start using Amazon EC2. This default VPC comes pre-configured with a public subnet in each Availability Zone, an internet gateway, and settings to enable DNS resolution. This allows you to immediately start launching EC2 instances without additional network configuration.

  3. The VPC isn't just for isolation from the public internet. It provides the fundamental networking framework for your EC2 instances, even if they're public web servers. The VPC manages IP addressing, routing, and network access control for your instances.

  4. For your public web servers, the VPC is still playing a crucial role. It's providing the network infrastructure that allows your instances to have public IP addresses and connect to the internet through the internet gateway.

  5. Deleting the VPC would indeed disconnect your EC2 instances from the internet and render them inaccessible. It's not recommended to delete the VPC your instances are running in, especially for live instances.

  6. Even though your current setup doesn't require complex multi-tier isolation, the VPC still provides important security features. For example, you can use security groups within the VPC to control inbound and outbound traffic to your instances at a granular level.

In summary, while it might seem unnecessary for your current use case, the VPC is an essential component of EC2 networking. It's not adding extra cost (the VPC itself is free; you only pay for resources like NAT gateways if you use them), and it's providing the necessary network infrastructure for your instances to function as public web servers. My recommendation would be to leave the VPC in place and not attempt to delete it, as doing so would disrupt your live instances.
Sources
Default VPCs - Amazon Virtual Private Cloud
Mastering AWS VPC: A Comprehensive Guide to Building Secure and Scalable Networks | AWS re:Post
Infrastructure security in Amazon EC2 - Amazon Elastic Compute Cloud

answered 2 years ago

EXPERT

reviewed 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.