aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.34k stars 3.76k forks source link

RDS: Create multiple databases #13588

Open vanniktech opened 3 years ago

vanniktech commented 3 years ago

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?


This is a :rocket: Feature Request

robertd commented 3 years ago

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.

skinny85 commented 3 years ago

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.

vanniktech commented 3 years ago

@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.

skinny85 commented 3 years ago

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

vanniktech commented 3 years ago

One Postgres RDS instance with 2 different databases, yes.

skinny85 commented 3 years ago

Gotcha.

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

vanniktech commented 3 years ago

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

skinny85 commented 3 years ago

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.

github-actions[bot] commented 2 years ago

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.

vanniktech commented 2 years ago

Leaving a comment

sleter commented 1 year ago

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

mikevoets commented 1 year ago

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

tmokmss commented 7 months ago

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?

emmapatterson commented 7 months ago

Any progress on this? thanks!

dilshad17 commented 5 months ago

Any update on this ticket ? Thanks.

shriduttkothari commented 5 months ago

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

Thanks.

rae004 commented 4 months ago

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

Cheers.

cadence-mathieu-beliveau commented 3 weeks ago

same, resorting to https://github.com/aws-samples/amazon-rds-init-cdk/tree/main is less than ideal.