21

we have to (want to..) rename our DB Subnet Groups on AWS, so i created a new DB Subnet Group with same settings as the old one. When i want to switch the Group on "Modify Tab" in AWS GUI and hit apply, aws returns:

You cannot move DB instance XXX to subnet group XXX. The specified DB subnet group and DB instance are in the same VPC. Choose a DB subnet group in different VPC than the specified DB instance and try again. (Service: AmazonRDS; Status Code: 400; Error Code: InvalidVPCNetworkStateFault; Request ID: 7d46c84c-b22a-11e6-be20-b5bb6bd6cc6d)

Any suggestions? Or is it just not possible without recreating whole instance?

27

I had this same question a few months back, and ended up contacting AWS (I have Enterprise support). This was the result:

Unfortunately, moving DB instance subnet group to another subnet group in the same VPC is not supported at this time. I realize our documentation says that it is supported, but that is an error. We are currently working on updating our documentation to reflect this and I apologize for the mis-communication.

However, I do have a workaround, you can create a new temporary VPC, update the subnet group to point to that temporary VPC, then once that process completes, change the subnet group to point back to your new subnet group.

Alternatively, another way to do it would be to create a database snapshot, and spin up a new instance from the snapshot.

You might want to look at both approaches. Both methods will probably cause you some downtime unless you are able to run your application in read only mode for a while, or have a method of replaying transactions on the restored snapshot.

4
  • I Like the temporary VPC option. The DB snapshot method works fine but carries a first touch penalty when reading blocks for the first time – tkwargs Oct 26 '17 at 17:33
  • This is a good idea. you dont really need a temporary vpc, just another vpc. – Brian Thomas Jun 21 '19 at 3:59
  • I don't see any method in which to change the VPC a subnet group points to, is there a specific place this option is located? – Kevin Danikowski Aug 22 '20 at 20:50
  • 1
    You might need to tweak the db settings first, to make it possible. For example, if it's set to multi-az, you will probably need to convert it to single-az first. It also might not be possible for all db types. I've only done this on mysql, and mssql. – KHobbits Aug 24 '20 at 12:11
4

The following steps can be performed to change the subnet group within VPC,

  1. Convert the prod DB instance to a Single Availability Zone (if multi-AZ enabled)

  2. Modify the subnet group by choosing any default/other VPC subnet groups and continue with Apply immediately

  3. After, again modify the subnet group by choosing the new one that you want to

  4. Also, choose relevant Security Groups and continue with Apply immediately

  5. Check connectivity from servers

  6. Then convert it back to a Multi-AZ

Note: Time to perform the above steps takes around 40 mins to 50 mins

3

What I did -> create a snapshot, restore snapshot and select your new subnet group that have only public or your desired subnets and ...voilá

the subnet group option for aurora can just set on instance build and you cannot change it after.

2

Seems that 2 and half years in and this problem still persists. The biggest problem is that I am updating my infrastructure through Cloudformation and from documentation the correct modifying strategy when changing DB subnet name is a resource replacement, which does not seem to be the case once I look at my stack changeset where DB subnet resource for replacement has flag "False" and afterward the stack update fails with DB subnet group having "Internal Error".

Now I essentially have to manually modify resources to have them update correctly even though that completely goes against usage of CloudFormation

1
  • Yep, it's a total joke, still persists a year after your comment – Kevin Danikowski Aug 22 '20 at 20:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.