how to delete Elastic Beanstalk app while keeping the amazon RDS database? - amazon-web-services

I have an Elastic Beanstalk app and an amazon RDS database associated with it. But now, I want to delete my app from Elastic Beanstalk while keeping the database as exactly it is. As far as I read in documentation when you terminate your app in the elastic beanstalk other associated resources will also be terminated. So is there a way to delete my app from elastic beanstalk while keeping the database? Thanks!

The doc has the answer : https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.terminating.html
If you have data from an environment that you want to preserve, create
a snapshot of your current database instance before you terminate the
environment. You can use it later as the basis for new DB instance
when you create a new environment. For more information, see Creating
a DB Snapshot in the Amazon Relational Database Service User Guide.

Related

application partition on AWS

I have lunched AWS linus2 AMI and created database and setupAjax/ LAMP through puTTY web page in browser.Now I want to partition the application so that application itself is on one instance and the database resides on a database instance on ec2?
A typical architecture on AWS is:
An Amazon EC2 instance with the application, placed in a Public Subnet
An Amazon RDS database
The application on the EC2 instance can connect to the Amazon RDS database. The benefit of this architecture is that the EC2 instance can be updated and even replaced without impacting data stored in the database. Plus, if your application later grows to multiple EC2 instances, they can all communicate with the database.
Using an Amazon RDS database is preferable to running your own database on an Amazon EC2 instance because AWS takes care of deployment, updates and backups.

What is the way to drop RDS database that is being used in Elastic Beanstalk?

While it's easy to simple delete the database and create new one. I don't want to do that because as far as I know you can't not add new database to Elastic Beanstalk.
And between IAM roles, Security groups, VPC subnets, opening ports, passing env variables, load balancing and more... I don't want to go through trouble of deleting integrated db and then doing surgery to integrate new one to EBS.
Beanstalk will run your software, and that you run RDS or not.. is optional.
RDS is a different thing. You can drop RDS databases that are inside a RDS instance.

Create Elastic Beanstalk Environment using RDS Instance Snapshot

I used Elastic Beanstalk to upload an application whilst studying, it was part of a group project. However the account got suspended when the billing details were incorrect, this discontinued the application services.
After resolving the account with Amazon the Elastic Beanstalk environment was up and running apart from the RDS instance. I then restored the most recent RDS backup but I can no longer access the MYSQL database with the previous details (Host, DBName and Password) and the application no longer works because the details to connect to the DB are wrong.
I then found out I cannot use a snapshot RDS instance with an existing EB environment, so I am doing the following steps:
Restore the database to a new RDS instance.
Make a manual backup of this new RDS instance. Create a new Beanstalk environment using your manual RDS backup.
Test to make sure everything is working as expected.
Update URLs or DNS to make sure traffic is routed to your
new environment
However I do not know how to do step two, can anybody help me on how to create a new EB environment using an RDS Instance Snapshot ?
(So I can access the DB)
This are the steps involved in creation of AWS Beanstalk.
In this step select the "create RDS" check box.
When you go to the RDS Configuration step select the snapshot of your database in the drop down and then proceed till the end.

How do you remove an RDS data layer from an Elastic Beanstalk environment

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.
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
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.
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/

Amazon Elastic Beanstalk: Can multiple applications share a single Amazon RDS database instance?

When creating an application in Amazon Elastic Beanstalk, you have the option of creating a new Amazon RDS database instance. Is it possible to associate an existing RDS database instance with an Elastic Beanstalk application?
If you want to share an RDS instance between multiple applications, the best thing to do is set that up independent of your beanstalk application.
Set up privs for each application and configure each application to use the RDS instance.
You will probably have to manually configure your application security group to access the database instance.
I was facing same issue and fixed using following steps :
1) Go to EC2 instance and note your security group example "sg-121212121212"
2) Go to RDS Security Group ad=nd inbound traffic
3) Edit rule select all traffic and add your new ebs security group "sg-121212121212"
Hope it will helpful
A single database can only be used with one Elastic Beanstalk environment. Although, it can be moved between environments.
Also important to remember that a clone operation doesn't clone the database.