0

I'm trying to enable SSH for my AWS Elastic Beanstalk application and have run eb ssh --setup (as a user with what seem to be suitable privileges, ElasticBeanstalkFullAccess; using AWS CLI 3.x); but my attempt fails with the following (GUIDs changed to protect the innocent):

INFO: Environment update is starting.
INFO: Updating environment sitetest-develop-env's configuration settings.
INFO: Created Auto Scaling launch configuration named: awseb-e-notrea1nUm-stack-AWSEBAutoScalingLaunchConfiguration-MAdUpa2bCrCx
ERROR: Updating Auto Scaling group failed Reason: Template error: DBInstance bxzumnil42x11w doesn't exist
ERROR: Service:AmazonCloudFormation, Message:Stack named 'awseb-e-notrea1nUm-stack' aborted operation. Current state: 'UPDATE_ROLLBACK_IN_PROGRESS'  Reason: The following resource(s) failed to update: [AWSEBAutoScalingGroup]. 
ERROR: Failed to deploy configuration.
INFO: Created Auto Scaling launch configuration named: awseb-e-myjrm7xr9n-stack-AWSEBAutoScalingLaunchConfiguration-5uKixPQCM71K
INFO: Deleted Auto Scaling launch configuration named: awseb-e-notrea1nUm-stack-AWSEBAutoScalingLaunchConfiguration-MAdUpa2bCrCx
INFO: The environment was reverted to the previous configuration setting.

What is causing this to happen? Is there something I need to do in the AWS Console to prevent this error?

Community
  • 1
  • 1
orome
  • 45,163
  • 57
  • 202
  • 418
  • isn't this a duplicate of http://stackoverflow.com/questions/27927555/ – Tal Jan 14 '15 at 22:08
  • Not at all. That's about permission. This is after the permission issue has been resolved; a totally different problem. Isn't it? – orome Jan 14 '15 at 22:08
  • indeed. seems like you lost your db. I've answered below. – Tal Jan 14 '15 at 22:26

1 Answers1

1

the relevant error message i see here is DBInstance bxzumnil42x11w doesn't exist. You have probably opted into letting Elastic Beanstalk create an RDS server as part of the environment creation process. Now it seems the db is no longer there. Did you kill it manually?
In any case, I would recommend NOT to let EB manage your RDS. it's best practice to create one yourself and manually assign the following environment variables: RDS_HOSTNAME, RDS_PORT, RDS_DB_NAME, RDS_USERNAME, RDS_PASSWORD.
At this point I would recommend terminating this env and creating a new one, only this time don't check the checkbox named Create an RDS DB Instance with this environment.

Tal
  • 7,827
  • 6
  • 38
  • 61
  • I added it in the "Data tier" panel for the environment by selecting "add new RDS database". Is that not the way to add an RDS database to an environment? – orome Jan 14 '15 at 22:30
  • well, it is how Amazon planned for it to work, but I wouldn't recommend doing that. This gives Elastic Beanstalk control over your database, especially the ability to kill it at will (which is not what you want when you terminate your servers). go to AWS RDS and setup a new db. Then go back to EB and in the software configuration section fill in the RDS_* environment variables I mentioned above. – Tal Jan 14 '15 at 22:33
  • So EB is killing it as part of the process of setting up SSH, and then can't find it when it's recreating the EB instance? – orome Jan 14 '15 at 22:35
  • The attached RDS is supposed to be terminated only when you terminate the env so I can't tell what killed your managed db but I can tell you it happened to me as well. I consulted with Amazon support and they recommended against letting EB control the RDS. "Too fragile" he said and recommended I attach an existing db using env variables. – Tal Jan 14 '15 at 22:41
  • Weird: They need to fix their docs (and their Console UI). So I: create a new RDS, make sure it's in the right security groups and VPC (same as the existing one); delete the existing one (from the RDS console?); then set the environment variables manually (in my EB's software configuration)? – orome Jan 14 '15 at 22:46
  • yes. this works perfectly for me and the up side is that I am now able to attach this db to different environments as I see fit. I let EB handle the app servers and nothing more. – Tal Jan 15 '15 at 06:59
  • Following [these instructions](http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_Python.rds.html)? – orome Jan 15 '15 at 13:23
  • 1
    yes. the "Using an Existing Amazon RDS DB Instance with Python" part – Tal Jan 15 '15 at 14:17
  • This worked great (despite the complexity of deleting an EB instance; everything has to happen in a peculiar order). I've made a [gist of my notes](https://gist.github.com/orome/b87444e710e196076b31) on how to set up a Web EB instance with a DB, and wonder if you could have a look (esp. regrading the terminology: EB v EB2; instances, groups, etc.). I also have a related [question about some of the security groups](http://stackoverflow.com/q/27829620/656912) that are hanging around. Thanks! – orome Jan 15 '15 at 21:14
  • And, FWIW, your approach has the advantage of [overcoming a concern I had](http://stackoverflow.com/q/27828837/656912) about the RDS user, since I now set it myself (rather than having it set to the "Master" user by whatever makes the connection between EB and an RDS added with "add new RDS database". – orome Jan 15 '15 at 21:20
  • And (sorry) [yet another question](http://stackoverflow.com/q/27973619/656912) about where my Web application is when I SSH. – orome Jan 15 '15 at 21:49