问题
I want to set up a VPC for my Elastic Beanstalk web app and RDS postgres db. I tried creating a VPC but ran into problems:
I went to VPC on AWS
-> Launch VPC Wizard
-> VPC with Public and Private Subnets
. I am not sure what configurations to use. For example, what should I set Elastic IP Allocation ID
? Do I need to set the VPC name?
After I create this, am I ready to just add it in EBS and RDS, or is there something else I need to do? Thanks!
回答1:
Do I need to set the VPC name?
Its optional, but you can use, e.g. MyVPCforEB
or what you want. It easier to find your vpc by name, than by cryptic vpc-id.
what should I set Elastic IP Allocation ID
You have to create EIP first. Its done in VPC -> Elastic IP addresses
menu. This is required for NAT gateway, so that instances in private subnet can access the internet.
After I create this, am I ready to just add it in EBS and RDS, or is there something else I need to do?
Not really. To do it properly, you would need to add one more private subnet. The VPC wizard will create only one private subnet. For RDS, to create a subnet group, you need to have at least two private subnets in different Availability Zones.
Thus, once you have two private subnets in two different AZs, then you can create new Subnet Group
in RDS with the subnets. Having this, you can create the RDS in these two subnets.
来源:https://stackoverflow.com/questions/62941135/how-to-set-up-a-vpc-for-elastic-beanstalk