Do I Need a VPC?
info.acloud.guru
info.acloud.guru
"Do the extra security controls of a custom vpc outweigh the increased risk+complexity of configuring them for this app?" I do not agree with this attitude of thinking.
For tiny little hobby projects, sure. For something that is production-grade and user-facing I would certainly assemble that inside of a private network.
It's not that hard. If you are building production tech you are likely doing it within the confines of a configuration tool like Terraform anyway -- so do it right.
You either use custom or the default VPC, but in both cases, you are using a VPC. You can manage them in the same way, and if you want, you can also delete the default VPC.
*There are resources that don't necessarily use any of your VPCs (e.g. Lambda, Lightsail), but the vast majority of the services require a VPC.
I disagree with them because VPCs are trivial to set up for the services that support them and they give you a barebones level of isolation with zero extra work. There are SO many guides describing how to set up a VPC correctly (it’s even covered in the Associate exam, which is basically entry-level) and deploying them is easy to do with Terraform, Pulumi or CloudFormation.
The main benefit of creating your own is that you can define your base CIDR block to be something that makes more sense to you. With subnets separated out by use cases, in a more logical and memorable way.
As an example:
A root CIDR block of 10.0.0.0/16 will give you ~65536 usable addresses - more than enough for many projects.
You can create a "public" subnet (10.0.1.0/24 - ~256 addresses available) and route all traffic in this subnet directly to an internet gateway. Things you want to put in here include load balancers, and your NAT gateway (which will be used by private subnets).
Then create a "private" subnet (10.0.2.0/24) and route all traffic in this subnet to your NAT gateway (which lives in the public subnet). Resources in this subnet will have all internet traffic routed through the NAT gateway, preventing direct access from the internet, just like your home router is a buffer for your PC.
You can get creative here. Adding a subnet 10.0.16.0/20 will give you ~4096 addresses, which is useful for lambdas that need to scale horizontally (each one consumes a private IP address). Also, if your lambdas need internet access, to call an API for example, you must route traffic through a NAT gateway.
It may seem like a lot to setup, but once you have it up and running, you save yourself a lot of headache in the long run. You can quickly identify network configuration errors by knowing the local IP of a resource. "Why can't I ssh directly into my EC2 instance? Oh, because it's IP is 10.0.2.45, meaning it's in a my private subnet)"
However, VPC configurations are an essential defense-in-depth that can be programmatically managed. AWS-managed VPCs are certainly not hand managed.
While maintaining Cloudformation or Terraform templates is still a pain, the good news is that it is becoming increasingly easier via frameworks like AWS CDK. This allows your deployment code to programatically generate the infrastructure and VPC configuration. This decreases the likelihood of mistakes made in configuration and increases the chances of such mistakes being caught during code reviews.
Also, the new Amazon-managed firewall rules for web-apps are killer for app developers who are not security pros![0]
Lest this sound like Fanboyism, our long-term strategy is Firebase, calling AWS APIs when necessary :)
[0] https://aws.amazon.com/blogs/aws/announcing-aws-managed-rule...
DevOps pro tip: Take the time to script out your VPC configuration, and then don't think about it again. You'll thank yourself later for having a more secure, and scalable solution, that you can reuse for various projects, or on new jobs.
We do this for every commonly-used AWS resource -- S3 buckets, SQS queues, etc. It eliminates most of the risk of misconfiguration, allows our infrastructure changes to be code-reviewed and unit tested, and eliminates a lot of the fiddly crap work associated with setting up something on AWS.
I do some volunteer IT work for the nonprofit makerspace in my town, and I obviously don't have access to my employer's tool chain if I have to work in their AWS account. It really is a night-and-day difference.
> Forrest Brazeal is an AWS Serverless Hero and enterprise architect who has led cloud adoption initiatives for companies ranging from startups to the Fortune 50.
Makes sense
There are a load of serverless resources in AWS. Lambda is a place to run code without containers, VMs, etc. There is no IP address for a Lambda - it "just runs". Access is governed by the IAM of the AWS account or through an API gateway.
It is quite possible that you don't need a VPC at all. I'm having a lot of trouble understanding putting a service running "above" legacy networking into a private network.