'How to create tables in Postgres RDS using CDK?

I created a Postgres RDS database using the CDK. I read the documentation but didn't find a way to create tables through it.

The language I'm using is TypeScript.



Solution 1:[1]

You cannot create a RDS table using the CDK or CloudFormation.

You can use the AWS SDK client to execute a CREATE TABLE... command against your database. The SDK client can be used locally or in a lambda function, for instance.

Solution 2:[2]

You can try cdk-postgresql - a 3rd party construct: https://github.com/botpress/cdk-postgresql/tree/master/cdk-postgresql

Solution 3:[3]

This post might help you. You need to use CustomResource

https://stackoverflow.com/a/62331465/6741215

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 fedonev
Solution 2 Raphael
Solution 3 shwz