RDS: Create multiple databases
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
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.
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 & @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 so the problem is you want more than one database (not table) to be created?
One Postgres RDS instance with 2 different databases, yes.
Gotcha.
Perhaps this should be a feature request to the RDS team, to make it possible to create multiple databases using CloudFormation?
@skinny85 it seems like it. Where can I do that?
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.
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.
Leaving a comment
Is there any update regarding that? It would be really helpful to be able to create multiple databases on a single RDS instance.
As as a workaround, have you considered adding a custom resource lambda that creates the remaining databases?
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?
Any progress on this? thanks!
Any update on this ticket ? Thanks.
Any update on this ticket ? We need this feature in cdktf.
Thanks.
Any update on this ticket? We need this feature in cdk.
Cheers.