CDKでVPCを使う場合のメモ
基本
・デフォルトではリージョンごとに最大5個のVPCが作成できます。 6個以上必要な場合はAWSに申請して認められなければなりません。
・VPCはリージョン全体をまたぎますが、サブネットはAZ(アベイラビリティゾーン)ごとで、 1つのサブネットが複数のAZに属することはできません。
・VPCに割り当てるIPアドレスはプライベートIPアドレスのみになり、あとから変更することはできません。 また、パブリックIPアドレスを Private subnet に割り当ててもルーティングしないので、割り当てる意味はありません。
Subnet Type
VPCのSubnet Typeについては、以下のCDKのソースに説明があります。
参考
Public (SubnetType.PUBLIC) - public subnets connect directly to the Internet using an Internet Gateway. If you want your instances to have a public IP address and be directly reachable from the Internet, you must place them in a public subnet. Private with Internet Access (SubnetType.PRIVATE_WITH_EGRESS) - instances in private subnets are not directly routable from the Internet, and you must provide a way to connect out to the Internet. By default, a NAT gateway is created in every public subnet for maximum availability. Be aware that you will be charged for NAT gateways. Alternatively you can set natGateways:0 and provide your own egress configuration (i.e through Transit Gateway) Isolated (SubnetType.PRIVATE_ISOLATED) - isolated subnets do not route from or to the Internet, and as such do not require NAT gateways. They can only connect to or be connected to from other instances in the same VPC. A default VPC configuration will not include isolated subnets,