aws-cdk icon indicating copy to clipboard operation
aws-cdk copied to clipboard

RDS: Create multiple databases

Open vanniktech opened this issue 5 years ago • 12 comments

Use Case

I have a Postgres instance with multiple databases. Ideally, I'd like to create the databases directly within the CDK.

Proposed Solution

new DatabaseInstanceProps.builder()
   .database(listOf("database_1", "database_2")
   // Some more properties
   .build()

Other

As far as looking at the API, I don't see a way. I can just use the databaseName("database_table_1") function to create one database, but not a second.

Is there any workaround / other solution to create multiple database tables within the CDK?

  • [ ] :wave: I may be able to implement this feature request
  • [ ] :warning: This feature might incur a breaking change

This is a :rocket: Feature Request

vanniktech avatar Mar 14 '21 15:03 vanniktech

Just FYI... databaseName("database_table_1") creates a database... not a table. I'm not sure if there is a SAR that can be used to create multiple DBs and tables within these DBs.

robertd avatar Mar 15 '21 17:03 robertd

Thanks for opening the issue @robertd . Right now, CDK only creates the Database itself, and we expect you to use tools like FlywayDB, or Liquibase for the actual schema.

I'm not saying we'd never do anything in this space, but we don't have any plans for that in the immediate future.

skinny85 avatar Mar 15 '21 20:03 skinny85

@skinny85 & @robertd I mixed up the terms. I want to create different databases. For now, I can only create one database using the databaseName function - however I'd like to supply a list of databases.

Also, I am using Flyway and it can't create databases since it's always operating within one database. I do use Flyway to create tables + schema's within a database.

vanniktech avatar Mar 16 '21 07:03 vanniktech

@vanniktech so the problem is you want more than one database (not table) to be created?

skinny85 avatar Mar 16 '21 15:03 skinny85

One Postgres RDS instance with 2 different databases, yes.

vanniktech avatar Mar 16 '21 15:03 vanniktech

Gotcha.

Perhaps this should be a feature request to the RDS team, to make it possible to create multiple databases using CloudFormation?

skinny85 avatar Mar 16 '21 22:03 skinny85

@skinny85 it seems like it. Where can I do that?

vanniktech avatar Mar 20 '21 10:03 vanniktech

If you have premium support, opening an issue through there is probably best.

If you don't, the CloudFormation public coverage roadmap is probably your second-best bet.

skinny85 avatar Mar 22 '21 22:03 skinny85

This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

github-actions[bot] avatar Jun 17 '22 16:06 github-actions[bot]

Leaving a comment

vanniktech avatar Jun 17 '22 19:06 vanniktech

Is there any update regarding that? It would be really helpful to be able to create multiple databases on a single RDS instance.

sleter avatar Jul 27 '22 09:07 sleter

As as a workaround, have you considered adding a custom resource lambda that creates the remaining databases?

mikevoets avatar Aug 07 '22 20:08 mikevoets

I found redshift-alpha module already supports this feature with custom resources.

https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-redshift-alpha.Table.html

maybe we can use a similar way to implement it for the rds module?

tmokmss avatar Nov 13 '23 05:11 tmokmss

Any progress on this? thanks!

emmamoinat avatar Nov 21 '23 19:11 emmamoinat

Any update on this ticket ? Thanks.

dilshad17 avatar Jan 23 '24 20:01 dilshad17

Any update on this ticket ? We need this feature in cdktf.

Thanks.

shriduttkothari avatar Jan 30 '24 09:01 shriduttkothari

Any update on this ticket? We need this feature in cdk.

Cheers.

rae004 avatar Feb 28 '24 14:02 rae004