leu
leu

Reputation: 125

How can I connect a docker container in AWS to a RDS

How can I --link a docker container(odoo) running on a plain EC2 instance or via EB to a RDS in AWS? I tried loading a custom config file with the location of the server but that didn't work. In EB I created an app with a postgres DB, successfully deployed my docker.aws.json but I can not connect to web interface of the the application.

When I check the docker logs of the container it says everything started fine but expects the DB on localhost.

So like I said my question is how can I tell a docker container to --link to a RDS and not an other docker container à la --link db:db?

Upvotes: 3

Views: 9398

Answers (1)

Céline Aussourd
Céline Aussourd

Reputation: 10664

If you created a database in AWS Elastic Beanstalk, you can access it using environment variables that EB set for you. See examples in the documentation: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-rds.html (Python example)

The environment variable containing the RDS DB hostname is called RDS_HOSTNAME. See example: https://github.com/awslabs/eb-demo-php-simple-app/tree/docker-apache

It's not possible to use a link as your RDS DB is not a Docker container.

Upvotes: 6

Related Questions