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?
I had this same question a few months back, and ended up contacting AWS (I have Enterprise support). This was the result:
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.
The following steps can be performed to change the subnet group within VPC,
Convert the prod DB instance to a Single Availability Zone (if multi-AZ enabled)
Modify the subnet group by choosing any default/other VPC subnet groups and continue with Apply immediately
After, again modify the subnet group by choosing the new one that you want to
Also, choose relevant Security Groups and continue with Apply immediately
Check connectivity from servers
Then convert it back to a Multi-AZ
Note: Time to perform the above steps takes around 40 mins to 50 mins
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.
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
I have an Amazon Relational Database Service (Amazon RDS) DB instance that is in a public subnet. I want to move my DB instance from a public to a private subnet within the same VPC, and make my DB instance completely private. How can I do this?
Short description
Amazon RDS does not provide an option to change the subnet group of your DB instance, with the same VPC. However, you can use the workaround method in this article to move your DB instance from a public subnet to a private subnet, and make your DB instance private.
The advantages of using this method include:
Resolution
Disable Multi-AZ deployments and public accessibility on your DB instance
If your DB instance is already set to Single-AZ with the Public accessibility parameter set to No, you can skip this step and proceed to the next step to discover your IP address.
To modify your DB instance to disable Multi-AZ deployments, follow these steps:
Discover the IP address of your DB instance
After your DB instance has returned to the Available state, run dig on the DB instance's endpoint to find its underlying IP address:
Output:
From the private IP, you can find which subnet it is using. This is the subnet that your primary instance uses.
In this example, the list of subnet CIDR is as follows:
Because the IP is falling under 179.39.5.0/24, you can conclude that the instance is placed in subnet1.
Remove the public subnets and add private subnets on your DB instance
Add all required private subnets in the subnet group. Also, delete all public subnets from the subnet group except for the one that is used by your primary. In the example above, you delete everything except subnet1 because it is being used by your DB instance.
Note: A private subnet is a subnet that is associated with a route table that has no route for an Internet gateway.
Enable Multi-AZ on your DB instance
Modify the DB instance to enable the Multi-AZ deployment. The new secondary launches in one of the remaining private subnets.
Reboot your DB instance with failover and disable Multi-AZ deployment
When your DB instance fails over, the secondary, which is using the private IP, becomes the primary and the public subnet becomes the secondary.
After you have rebooted your DB instance with failover, you need to remove the secondary which is now in the public subnet. To do this, modify your DB instance to disable Multi-AZ, again. You can do this by setting Multi-AZ deployment to No.
Remove the public subnet
Note:Removing subnets from the subnet group is a configuration from the RDS side. It does not involve deleting any subnets from the VPC.
Check that there are only private subnets present in the subnet group.
If your DB instance was previously in Multi-AZ deployment, enable it again.
This solution involves failover and disabling/enabling Multi-AZ so there are few things to consider. For more information, see Modify a DB instance to be a Multi-AZ deployment.
Note: This method is very specific for RDS DB instances. If your DB instance is part of Aurora cluster, you can use the clone option. Or you can follow the steps in this article, but instead of disabling Multi-AZ, you should delete and recreate the readers.