Jump to content
Sign in to follow this  
ajoo

Unable to attach an external RDS instance to Elastic Beanstalk using CLI

Recommended Posts

Hi all :happy-04:  !

 

I have been trying to achieve  the equivalent of  Adding an Amazon RDS DB Instance to Your PHP Application Environment using CLI. I have searched for it without success and now I am wondering if I should be using the console for this purpose instead. I am also wondering if it is possible to achieve the same with a CLI. :confused:  :confused:  

 

 

I tried the sample applications, using the console panel, and I was able to use it correctly. I believe that I read somewhere in the documentation that if I wanted to use GIT with EB, then I should use the CLI instead of the console since the CLI facilitates automation. Now I have successfully tried out my sample application ( bare minimum) using GIT and it works as does the functionality of GIT, but I am unable to connect the external RDS instance ( that I created before creating an EB instance) to it now from the CLI.

 

I'll be very grateful for any help on this. 

 

Thanks all !

Share this post


Link to post
Share on other sites

I forgot: do you want to make a brand-new RDS instance for each deploy, or use an existing one? If you want a new one then that's AWS CLI work...

 

Either way you end up with the important information about the instance: hostname, username, and password (the latter two you set yourself). Then you don't have to do any AWS work - just put the information into PDO or whatever and you're set.

Share this post


Link to post
Share on other sites

Hi requinix, 

 

Thanks for the reply.  I am creating an external DB so it is independent of the EB EC2 instance. The EC2 instances will be created and destroyed on each deploy but that will have no effect on the DBInstance.

 

I have yet to try out what you have suggested. Will revert once I have done it. 

 

Thanks !

Share this post


Link to post
Share on other sites

So the same database for every instance, right?

 

Then you don't have to do anything with the CLI. Set up the RDS instance however you want (UI is easier) and put the host/username/password credentials into your config or whatever. One-time thing.

Share this post


Link to post
Share on other sites

Hi requinix !

 

Ya so that makes it one time. 

 

 

 

 (UI is easier) 

???? What's that ?

 

Ok so I went and re-did the whole sample app process again and I am a bit clearer. 

 

Since the deployment erases the EC2 instance and recreates it, I will have to setup quite a few parameters some of which you have mentioned i.e. host/username etc. 

 

In fact these are the things that I need to do:

1. Set my document root.

2. Add the default VPC security group to the DBinstance auto generated security group.

3. Copy my database to the EC2 instance and into mysql.

4. And the host name and security credentials into a config file. 

 

  I would also like to save my environment into a Jason file. I think that all this would involve setting up a yml file, config file and a maybe some more. 

 

This is exactly where I am stuck. I would be glad if you could help me with these, the actual setting up or as far as possible, of these files. 

 

Thanks loads !

Share this post


Link to post
Share on other sites

The UI is what they call the "console"... and that ambiguity is why I called it the UI. You know, the main website for managing stuff.

 

- Document root is a configuration thing. Or just say /var/www

- Auto-generated security group? Don't. Make a standalone security group for these instances and have each use it.

- Copy database is a configuration thing. Should be just a matter of a post-installation command to dump the RDS data into the local MySQL like

mysqldump --options... and -h -u -p for the rds instance | mysql -h -u -p for the local instance
- Hostname and credentials are also a configuration thing

 

The CodeDeploy settings go into their own file, your application settings go into their own file(s) however they're supposed to work.

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.