6

I created a VPC thinking I wouldn't need subnets. I just gave the vpc a CIDR range like 192.168.0.1/24 I then created a subnet which matches that exactly.

Low and behold RDS requires it's own subnet. What happens if I delete the existing subnet and replace it with two /25?

Will the active instances become unhappy if I delete their subnet? Will they simply not notice or care?

I can't seem to find documentation on this and I'd rather not simply try it and see what happens.

jorfus
  • 745
  • 7
  • 14
  • You can always create another VPC and try it out. It's not going to let you modify a subnet that has active clients, though. – EEAA Feb 22 '16 at 21:54
  • Back up the truck. RDS does not need it's own subnets. You can put existing subnets (with EC2 machines running on them) into an RDS subnet group. – Michael - sqlbot Feb 23 '16 at 01:12
  • Thanks Michael, perhaps I'm missing something. I'll take another look at the instance RDS launch UI. I thought it was really weird that it was requiring this. – jorfus Feb 23 '16 at 19:04

1 Answers1

8

It is not possible to change the CIDR block for a VPC. So if you have created the VPC with 192.168.0.1/24, then that's as big as the VPC can get. You'll have to re-create the VPC to get more space.

Also, it's not possible to change a VPC subnet. You can only delete it and re-create it differently.

On top of that, it's not possible to delete a VPC subnet that has any resource inside it. So you'll have to delete all RDS instances, EC2 instances, etc. that are in your subnet first, then you can delete the subnet.

Matt Houser
  • 10,053
  • 1
  • 28
  • 28
  • I had a similar requirement to create multiple subnets when I already had active instances in a single subnet that occupies the whole VPC CIDR range. I think since this answer, AWS has introduced the ability to associate new CIDR blocks to an existing VPC. I was able to add a new CIDR block and then split it into multiple subnets. Refer: https://docs.aws.amazon.com/vpc/latest/userguide/vpc-cidr-blocks.html – Michael12345 May 23 '23 at 19:37