In the guide Provision and Binding Cloud Resources and Provision a Database and Import a SQL File for initialization, We create an RDS instance and a database together. However, you can create an RDS instance and more than one database on it. This pattern is useful when you want to save costs of creating multiple instances.
This guide will take Alibaba Cloud RDS as an example to show how to create an RDS instance more than one database separately.
terraformaddon has been enabled
terraform-alibabaaddon has been enabled, version >= 1.0.3
- Credentials have been configured using
vela provider add terraform-alibabaIf you have problems, you can follow to this instruction to setup.
Provision the RDS instance
Using the following Application to create an RDS instance.
- name: rds-instance
Now you can get the RDS instance ID by running the following command:
kubectl get configuration -n default rds-instance -ojson | jq -r .status.apply.outputs.instance_id.value
The result will be like
Provision the RDS database
Using the following Application to create an RDS database. Remember to replace
<your-instance-id> with the real values.
- name: demo-database-1
About 2 minutes later, you can check the app status by running
vela status app-db-1 -n default
You have learnt how to create an RDS instance and a database with different applications. As a platform engineer, you can use this pattern to provide database sharing the same instance to your users. When the business is growing, you can migrate database to an exclusive instance.