Reputation: 1670
How do you remove an RDS database from an Elastic Beanstalk environment?
There doesn't appear to be an option to do this. I understand I can create an EB environment and have it create an RDS server with it, which we did. Now we just want to get raid of the RDS server by itself but leave the app servers running. I don't see how we're suppose to do this unless I just delete it from the RDS GUI, but I'd think the proper way to do it is remove it from the EB environment.
Upvotes: 36
Views: 8161
Reputation: 31
You can decouple the RDS which will not impact the health of the EB environment and then you can do the application change to not use the RDS!
Upvotes: 0
Reputation: 324
I found a way to do this using the EB CLI that does not involve creating a replacement EB environment. For my use case, it was much more practical to modify the existing EB Environment and not have to go through the extra steps (and wait time) associated with creating a new environment and making sure all the settings propagated correctly.
TL;DR: Using the eb config
feature, you can modify the settings for your existing environment and it will apply the change correctly.
Steps:
eb config
to open an editor. In the aws:rds:dbinstance
section (for me, it was at the bottom), change DBDeletionPolicy
to Retain
eb config
to open an editor. In the aws:rds:dbinstance
section, change HasCoupledDatabase
to 'false'
Original post for this solution: https://repost.aws/knowledge-center/decouple-rds-from-beanstalk#COG3pCkfJlRKa9_W9f6Bd7Xw
Upvotes: 0
Reputation: 983
Now you can decouple the database from your environment.
Then it will follow the data retention policy you have set for it.
https://aws.amazon.com/premiumsupport/knowledge-center/decouple-rds-from-beanstalk/
Upvotes: 0
Reputation: 4640
It's 2019 and still not possible to remove an RDS database from an Elastic Beanstalk environment. I wish I had known this earlier.
Anyway ... here are the general steps necessary to create a new environment without a managed RDS DB (based on the same thread from the AWS forum):
Create a snapshot of your RDS DB and create a new RDS DB from it. This does not retain the security group, parameter group, or options of your DB. So it might be preferable to create a new empty RDS DB where you can configure everything and then restore the contents from a DB dump like mysqldump
.
Save a configuration of your Elastic Beanstalk env and download it from your S3 EBS bucket under resources/templates/<your-app-name>/
.
Modify the config to remove all references to RDS, and upload the modified file to your S3 bucket.
Create a new environment from the saved configuration. You should now have an env without a managed RDS DB. Some settings might not be carried over in this process. For example, I had to reconfigure the load balancer for my new env.
Once everything is working in the new env you can use "Swap Environment URLs" or point your DNS record to the new load balancer.
Upvotes: 7
Reputation: 3902
According to this answer on Amazon aws forums:
There is currently no way to remove RDS from an Elastic Beanstalk configuration. You would need to create a new Elastic Beanstalk application configuration that excludes the RDS configuration, launch your app in this new environment, and then change DNS to point to the new environment.
https://forums.aws.amazon.com/message.jspa?messageID=469364
Upvotes: 22