何时在 AWS 中设置非默认 VPC?
When to set up a nondefault VPC in AWS?
在 AWS 上创建 EC2 实例 (或其他类型的东西) 时,会出现默认 VPC。
此外,作为另一种选择,可以预先创建一个 VPC 并在创建 EC2 实例等过程中选择。
那么,在哪些用例中我们应该创建一个新的 VPC 而不是使用默认的 VPC?
AWS Documentation 很好地描述了他们如何创建默认 VPC。
When we create a default VPC, we do the following to set it up for
you:
- Create a VPC with a size /16 IPv4 CIDR block (172.31.0.0/16). This provides up to 65,536 private IPv4 addresses.
- Create a size /20 default subnet in each Availability Zone. This provides up to 4,096 addresses per subnet, a few of which are reserved
for our use.
- Create an internet gateway and connect it to your default VPC.
- Create a main route table for your default VPC with a rule that sends all IPv4 traffic destined for the internet to the internet
gateway.
- Create a default security group and associate it with your default VPC.
- Create a default network access control list (ACL) and associate it with your default VPC.
- Associate the default DHCP options set for your AWS account with your default VPC.
这非常适合简单的应用程序和概念验证,但不适用于生产部署。例如,数据库实例不应 public 仅可用,并且应该放置在私有子网中,这是默认 VPC 所没有的。然后,您将创建某种后端实例,该实例将连接到数据库并将 REST 接口公开给 public.
另一个原因可能是 运行 多个环境(DEV、QA、PROD)都是彼此的副本。在这种情况下,您可能希望它们彼此完全隔离,以免在 DEV 环境中部署不当而意外影响 PROD 环境。
这个列表可以继续列出其他原因,并且可能有一些比我今天向您介绍的更好。
如果您对 VPC 相当了解,那么您应该始终创建自己的 VPC。这是因为您可以完全控制结构。
我怀疑提供默认 VPC 的主要原因是人们无需先了解 VPC 就可以启动 Amazon EC2 实例。
在 AWS 上创建 EC2 实例 (或其他类型的东西) 时,会出现默认 VPC。
此外,作为另一种选择,可以预先创建一个 VPC 并在创建 EC2 实例等过程中选择。
那么,在哪些用例中我们应该创建一个新的 VPC 而不是使用默认的 VPC?
AWS Documentation 很好地描述了他们如何创建默认 VPC。
When we create a default VPC, we do the following to set it up for you:
- Create a VPC with a size /16 IPv4 CIDR block (172.31.0.0/16). This provides up to 65,536 private IPv4 addresses.
- Create a size /20 default subnet in each Availability Zone. This provides up to 4,096 addresses per subnet, a few of which are reserved for our use.
- Create an internet gateway and connect it to your default VPC.
- Create a main route table for your default VPC with a rule that sends all IPv4 traffic destined for the internet to the internet gateway.
- Create a default security group and associate it with your default VPC.
- Create a default network access control list (ACL) and associate it with your default VPC.
- Associate the default DHCP options set for your AWS account with your default VPC.
这非常适合简单的应用程序和概念验证,但不适用于生产部署。例如,数据库实例不应 public 仅可用,并且应该放置在私有子网中,这是默认 VPC 所没有的。然后,您将创建某种后端实例,该实例将连接到数据库并将 REST 接口公开给 public.
另一个原因可能是 运行 多个环境(DEV、QA、PROD)都是彼此的副本。在这种情况下,您可能希望它们彼此完全隔离,以免在 DEV 环境中部署不当而意外影响 PROD 环境。
这个列表可以继续列出其他原因,并且可能有一些比我今天向您介绍的更好。
如果您对 VPC 相当了解,那么您应该始终创建自己的 VPC。这是因为您可以完全控制结构。
我怀疑提供默认 VPC 的主要原因是人们无需先了解 VPC 就可以启动 Amazon EC2 实例。