Elastic Beanstalk - Delete environment failed - amazon-web-services

In AWS Elastic Beanstalk, I created an environment and through it a database.
I went to RDS and renamed the instance name and then delete the RDS instance
Now I am trying to delete the environment and the procedure fails:
ERROR Stack deletion failed: The following resource(s) failed to delete: [AWSEBRDSDatabase].
What can I do in order to detach the environment from the RDS?
Any ideas?
Thank you very much

#Andreas What you can do is rename the RDS instance back to the original one and takes a Snapshot of it.
if you don't rename and try to delete the beanstalk what happens is beanstalk will keep on looking for the RDS Instance.
Now you can delete the Beanstalk, after successful deletion of the environment you can again create the RDS Instance via that Snapshot (which you have created previously)
What else you can try is go to the Configuration tab of the beanstalk and change the configuration of Database and update the beanstalk. This will preserve your beanstalk env also and changes the RDS configuration also.

For me helped to going to Cloud Formation and deleting stack there
https://aws.amazon.com/premiumsupport/knowledge-center/elastic-beanstalk-deleted-rds-database/

Related

ERROR : Stack Deletion Failed: AWSEBRDSDatabase

I wanted to delete an ASP.NET MVC application on the Elastic Beanstalk. But before deleting the app I first deleted the RDS server instance linked to the application. The RDS instance got deleted succesfully but now when I try to delete the Elastic Beanstalk application I get the following error message in the console -
Stack deletion failed: The following resources failed to delete AWSEBRDSDatabase
How do I proceed to delete this? I am not able to find any help regarding this issue!
ran across the same issue myself today.. there doesn't appear to be a way to delink the deleted RDS instance in the Elastic Beanstalk configuration sadly. I did however manage to delete the application though by first recreating the RDS instance using the same name as before.
Go to AWS RDS > Intances > Launch DB Instance
recreate the deleted instance using the exact name that was previously used. Once successfully created, go back to Elastic Beanstalk and it allows you to terminate the environment. Bit of a pain but works none the less.
Thanks
TJ
It happened to me and the way I was able to resume the removal of Elasticbeanstalk sucked on this status was to go through CloudFormation panel and remove the stack with failed status as described on: https://aws.amazon.com/premiumsupport/knowledge-center/cloudformation-stack-delete-failed/
After that I was able to remove the Environment and Application under Elasticbeanstalk.
I had this error "The following resource(s) failed to delete: [AWSEBRDSDatabase]" this helped me to resolve the problem.
Open the AWS CloudFormation console.
Choose the stack that's stuck in DELETE_FAILED status.
Choose Delete.
Note: A window opens and lists the resources that failed to delete.
4. In the window, select all the resources that you want to retain, and then choose Delete stack.
I checked to retain resource, even though the resource that was retained didn't exist but it helped me to delete it, if I didn't check it it was not deleted
https://aws.amazon.com/premiumsupport/knowledge-center/cloudformation-stack-delete-failed/
https://aws.amazon.com/premiumsupport/knowledge-center/elastic-beanstalk-deleted-rds-database/

Elastic Beanstalk went to invalid state with t1

The Elastic Beanstalk environment is running on t1.micro & db.t1.micro, where we tried to update the rds to db.m1.small instance. This configuration change has been made on the Elastic Beanstalk and it is on updating state for around 4 hours, we thought AWS stuck somewhere internally. In this meantime, the AWS has not updated the Trace information. In order to retain the environment back (rollback of configuration update operation), we have aborted the environment configuration update. This has ended up on invalid state with the health turned to grey. This because AWS will not allow creating t1 environment nowadays, however, the rollback is trying to bring back the older t1 setup with an error--> RDS does not support creating a DB instance with the following combination: DBInstanceClass=db.t1.micro, Engine=mysql, EngineVersion=5.6.37, LicenseModel=general-public-license. For supported combinations of instance class and database engine version.
Any suggestion to bring back the environment to green would be really helpful.
Yes, with the source of the snapshot we could able to create a new EBS instance. The only problem we faced during the snapshot to clone an instance is the application level configuration file change not done. BTW there is no proper root cause for the AWS DB upgrade failure from AWS.

Amazon Web Service can't delete an Elastic Beanstalk environment

I have a problem with AWS Elastic Beanstalk. I tried to delete an environment. It started the process, but after a few minutes the environment "health bar" went to grey and gave me the following errors:
"Deleting security group named: XXXXX failed Reason: resource YYYYY has a dependent object"
"Stack deletion failed: The following resource(s) failed to delete: [AWSEBSecurityGroup]."
I tried to delete the security group from the error message, but I got this:
"XXXXXX: resource XXXXX has a dependent object"
After this I wanted to delete the dependence from the EB environment, but because it's Grey, it didn't allow me to do that.
I browsed the internet for hours, found a possible solution, where I need to do something at the EC2's Network Interfaces page, but it doesn't say any specific option or information.
Try this, I was suggested by AWS support and it worked for me.
You need to go to your CloudFormation console and retry deletion of the CloudFormation stack which the Beanstalk environment used.
The deletion may fail, but after retrying it will prompt you if you want to skip the "AWSEBRDSDatabase" resource that failed to delete. You can just confirm that you want to skip deletion (since you have actually already deleted it).
This should remove the CloudFormation stack
Then you can retry deletion of the Beanstalk environment from the Beanstalk console.
Is the security group being referenced by RDS or something in S3? If that is the case, you'll have to delete the dependency in either RDS or S3.
The error message is saying something outside of your environment is still using the security group and it can't be deleted for this reason.
Go to EC2 under AWS console's Compute
Go to Security Groups under NETWORK & SECURITY on the sidebar
Find your misbehaving security group on the page
Check it and choose Delete Security Group from the Actions menu
You will be presented with a link that will lead you to the security group or instances it depends on.
Keep going until you get to the parent Security Group or instances and delete them.
Make sure you don't delete any important Security Groups or Instances!
In case this happens due to a similar error but due to RDS attached to this,
Stack deletion failed: The following resource(s) failed to delete: [AWSEBRDSDatabase].
This happens when you terminate the RDS instance manually from RDS listing console. I resolved this by launching another instance with the same DB instance ideIntifier name.
Once this is created, you can terminate the Elastic Beanstalk environment successfully. This works.
Use https://github.com/mingbowan/sgdeps to find your security group dependencies and then break the dependencies.
Had this happen where I was using the security group created by EB with a non-eb created RDS instance.
I modified the RDS instance to stop using the EB-created security group and was able to do a successful termination of the environment and application. I used the eb cli 3.x and eb terminate --all --force to get a fresh start on the application.
In my case i have white list EBS instance into RDS security group , so deleted from RDS solved problem.

AWS Elastic Beanstalk Backup & Recovery

I am new to AWS EB and I am trying to figure out how to backup and restore an entire EB environment. I created an AMI based on the EC2 instance generated by EB, and took a snapshot of RDS, also created by EB.
The problem I have is, how do I restore it, assuming that this is the correct approach of backup. Also, I am doing it manually, shouldn't there be an automated way of doing this within EB? By the way, when I created the AMI, it destroyed the source and the EB just created a new EC2 instance without all my changes.
How do I save & restore configuration changes to my application that impact both filesystem and database?
Unfortunately, Amazon AWS Elastic Beanstalk (EB) does not support restoring databases that contain live data, if those databases were created with EB. If you reload (AKA AWS "deploy") the EB saved configuration, you get a blank database!
I called them and they told me to create the RDS DB separately and update the application code to connect to the DB once you know it's name. If you restore the RDS DB it will have a new name too! So you have to update your code again to connect to it.
Also, if you code and environment is fine, but you want to restore your database, again it will have a new name and you will need to change your code.
How to change your code easily and automatically deploy it is a whole other question for which I don't have an answer yet.
So basically the RDS DB provisioning within Elastic Beanstalk has very limited uses, maybe coding and debugging and testing, but not live production use. :(
This is as of Jan 2015.
First go into your EB environment and save the current config. You should go to a running EC2 instance created by EB and make an Image. Then use that new AMI ID by going to the EB configuration and setting it. It will rebuild the environment tearing down all running instances and creating new ones.
For your RDS instance you should make a backup and restore with a new instance name as the docs say you will lose it if the environment is destroyed. You should probably just manually set the environment variables like RDS does and setup the proper security groups between RDS and EC2.
One option I think could work is just renaming the RDS instance name as the environment seems to break and then destroy the environment and create a new one with an attached RDS instance and then destroy that one and rename the old one to the new one's name which may work.
As always make proper backups before proceeding with any of these ideas.

AWS Elastic Beanstalk: terminate RDS then fail to update application version

I created AWS EB environments with RDS MySQL DB 1st time. But, I realized that I don't need to use MySQL so, I switched to sqlite3 and terminate RDS MySQL DB. After this, I can't update application version by using git aws.push. AWS EB shows the below error message all the time.
Service:AmazonCloudFormation, Message:Stack named 'awseb-e-xxxxxx-stack' aborted operation.
Current state: 'UPDATE_ROLLBACK_IN_PROGRESS' Reason: The following resource(s) failed to update: [AWSEBAutoScalingGroup].
Updating Auto Scaling group failed Reason: Template error: DBInstance xxxxxxx doesn't exist
How can I fix this issue? Thanks.
As some have noted, you actually cannot manually delete your RDS instance from an elasticbeanstalk environment.
Per another answer you can change this via some options using one of the aws apis:AWS Elastic Beanstalk change RDS Endpoint
My solution was to terminate the environment and just start a new one from a saved configuration.
I was unable to terminate an EB environment of mine due to previously having manually deleted the RDS instance associated with the environment.
I was able to solve this issue by creating a new RDS instance with the same identifier as the deleted instance, then terminating the environment like normal.
If you deleted your RDS instance manually, Elastic BeansTalk does not know about that change and must be updated too.
You can go to Elastic Beanstalk console, pick up your Application and your Environment, go to "Configuration" and delete your RDS instance from the Elastic Beanstalk configuration.