Create Elastic Beanstalk Environment using RDS Instance Snapshot - amazon-web-services

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.

Related

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

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.

Add encrypted database to elastic beanstalk

You can add an RDS instance to an Elastic Beanstalk environment, but there is no option when you do this to have the RDS instance be encrypted. You can modify the RDS instance after it's launched, but you can't modify whether or not it's encrypted.
The amazon docs discuss creating an independent RDS instance and modifying security groups but this seems antithetical to Elastic Beanstalk.
Is there a way to get an encrypted RDS instance that is attached to an Elastic Beanstalk environment?
I do not recommend to create RDS instances from EB configuration panel. For most of the cases that may happen on your setup, it may won't be an issue, but when it comes to serious production setup, it may become a serious problem. RDS instances created from EB config panel are kind of merged to EB environment they were created in. It means that every time you delete your environment, system forces you to remove RDS instance as well. And that's not the way you want it to be, as environment should be the part you're not afraid to delete at any time.
Let's say you want to update your Multicontainer Docker setup, because there's an update going on. You would just clone current environment, then switch url and you're done. With RDS instances created as described above, you simply can't.
My advise is to create separate RDS instance, then add specific security group for this instance, and finally, add this security group in Configuration -> Instances -> EC2 security groups for EB environment, so it have access there. With that you can create encrypted instance of database and you can easily switch environment with no risk your database will be thrown away.
And if you're ok with standard environment variables for RDS, like RDS_DB_NAME etc. you can add the same in Configuration -> Software Configuration -> Environment Properties. That's how we do this for each production and serious server we're taking care of at work.
Yes. There is currently the following workaround:
Create a new encrypted RDS instance
Take a snapshot of this instance
Add an RDS instance to your Elastic Beanstalk environment based on this snapshot. The snapshot is encrypted, and thus the database created based on it is encrypted as well

Can't Access DB - Elastic Beanstalk + RDS + VPC (Virtual Private Cloud)

In trying to move a website to operate via Elastic Beanstalk (ELB), I chose the t2 series of EC2 instances, and in doing so, was forced to create a Virtual Private Cloud (VPC). This site connects to a MySQL database via RDS, and I'm not having any luck getting the ELB site to access the database.
I've tried reviewing this:
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/AWSHowTo.RDS.html?icmpid=docs_elasticbeanstalk_console
The above link starts by saying "works great for development and testing environments, but is not ideal for a production environment", which confuses me as it doesn't say what would be better in its place - I need a database connected to the site!
It has all sorts of information and I tried several of the things it suggested regarding connecting to an existing database (not creating a new one). It mentions on step 6 of the "To modify the ingress rules on your RDS instance's security group" section to access the ingress tab, which doesn't exist for me.
I've tried editing the security group associated with the database via the RDS dashboard under "security groups", but it does not list the security groups that are associated with the VPC or the EC2 instance launched by ELB. I tried pushing the IP addresses, elastic IPs, and still can't get the site to see the database.
I'm at a loss. Can anyone explain how to connect an ELB distributed EC2 instance with an RDS database through the VPC required by t2 instances?
The statement that "This works great for development and testing environments, but is not ideal for a production environment" is just referring to having ElasticBeanstalk create the RDS instance for you. This can be done by configuring the "Database" section when creating a new EB environment.
The downside of letting EB create the RDS instance for you is that your web instance and database instance will be strongly connected, and if you ever terminate your web instance, your database will also be terminated, including all of your snapshots.
However, I think you're taking the "external" part of "external database" too literally. Your RDS instance should definitely be within the same VPC as your web instance. However, you should create it and connect your web instance to it manually. Connecting to the database involves setting five environment variables (listed below) and configuring the security group to allow connections from the web instance to the database.
The environment variables you'll need to set on your web instance are as follows:
RDS_HOSTNAME=instancename.region.rds.amazonaws.com
RDS_DB_NAME=databasename
RDS_PASSWORD=databasepassword
RDS_USERNAME=databaseuser
RDS_PORT=5432

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.