How to add existing PostgresDB to ElasticBeanstalk

I’m using a Postgres DB for Metabse internal DB. Currently I’m using a local installation, but I would like to use ElasticBeanstalk for running Metabase.
How can I tell Metabase that runs on EB to use my Postgress DB for its internal DB?

There was a suggestion in the forum (attached below) to migrate my db to the postgres db that EB creates. But the problem with this solution is that, the db that EB creates is terminated when the environment is terminated.

Do we need to modify the docker image or there is an easier way?

Hi @King_Edward
You can decouple the EBS and RDS, if you let EBS create the RDS.
Or if you create the RDS before creating the EBS, then they’re decoupled and deleting the EBS should not delete the RDS.
Have a look here: Best practice for having RDS as part of EB environment
Or am I misunderstanding your question?

Thanks for the quick reply.
I don’t see where in EB settings I can select my previously created Postgres DB to be used as the internal DB of Metabase.

I don’t use AWS, so I’m not sure. I guess you create the EBS without the RDS, which means Metabase will be using H2, and then you define the environment variable to point to your Postgres.

I think I found it. I’ll update this when I make sure everything works fine. Thanks

The environment variables for connecting to external DB can be set in Configuration>Sofrtware.
But even after setting that, still it wasn’t working for me. The problem was that I had followed the pre-configured launch url and in it it was necessary to allow EB to create an RDS instance. And apparently it was producing conflicts. The resolution was that I created a new application without following the pre-configured launch url.