segunda-feira, 31 de julho de 2017

AWS RDS: Changing the Subnet Group from a RDS Instance to same VPC

Today I run into an interesting issue. I use for one of my customers Elastic Beanstalk intensively. At some point in past a colleague created a RDS instance which was not directly created by Elastic Beanstalk, but he used the Subnet Group from one automatically managed EB stack.
Point is that the EB environment needs to be terminated, but it cannot be clean due the fact that the Subnet Group is attached to other entity, in this case, the RDS instance that was manually created.
You say, why you do not create a new Subnet Group then modify the RDS instance?
I tried that, but then the situation started to be funny. First, the option to change the Subnet Group was not even available in the Web Console, as you see in the figure below








So why it is not there? Simply because if you are running a MULTI-AZ RDS this option is NOT available, in order to proceed you need to change it, this means, disable Multi-AZ. This change does not incur in downtime as stated here: 

To change the Multi-AZ option just set the option Multi-AZ to No and mark the box to Apply changes immediately.
OK, now the option is available as I can see below:


As the title says the goal is to change the Subnet Group to the same VPC, which is NOT SUPPORTED. When you change the option and press Modify you will get the nice error below.



If you are changing this from another VPC you should succeed. But not for the same VPC. But, as usual there are workarounds.

The one I will leverage is to create a Subnet Group in another VPC, move the subnet (DOWNTIME WILL HAPPEN) and then move it back to the right Subnet Group in the VPC you need it.

It can take circa 10-15 minutes to move to the new VPC, during this time your RDS instance will become unavailable and the message “moving-to-vpc” will appear.

When it is finished and the status is marked as available again you can modify it and now select the right Subnet Group you want from the beginning. More 10-15 minutes downtime and you are done.

Important: you will need also to define the right Security Group when moving back, as it changes when you move to another VPC. 

That's it. Hope this helps someone. 


Nenhum comentário:

Postar um comentário