Learn how to provision databases in instances running in Amazon RDS
Amazon Relational Database Service (Amazon RDS) is the AWS was of providing relational databases in the cloud. Amazon RDS is available for several engines including Amazon Aurora, PostgreSQL, MySQL, MariaDB, Oracle Database, and SQL Server. At this time, Humanitec provides out of the box support for PostgreSQL, MySQL and MariaDB types with SQL Server coming soon.
You can easily connect Humanitec to an Amazon RDS managed database instance. The following paragraph explains how.
- 2.Click on the Show all resources button. An overlay with all available resource categories and types will be presented to you.
- 3.Below Data storages click on the type of database you want to create. This will open an overlay.
- 4.Choose an ID that you will use to identify the resource definition in Humanitec later.
- 5.Select a driver, here - mariadb. Based on your resource driver, a form will be shown with the required driver parameters which will be passed to the driver on every resource creation.
- 7.Fill out the connection parameters that Humanitec will use to create/delete databases in the instance. You can find them in the RDS section of the AWS Console.
- Host is called "Endpoint" in the console.
- Username and Password are the user and password you created when you set up the RDS instance or a user with privileges to create users and databases in the instance that you subsequently created.
- 8.Click on Create.
Steps 1 - 3 of creating a resource definition for an AWS managed instance
Steps 4-8 of creating a resource definition for an AWS managed instance
Next, you can configure matching criteria for your database. This enables you to define specific environments or applications to be deployed to this resource.
By clicking on your database in the list of resources, the Matching row will expand and allow you to add or remove matching criteria. Each database resource can be matched to specific Environment Types, App IDs, Environment IDs or Resource IDs. Empty fields are automatically resolved to match all values of the given category.
Based on this Resource Definition, during the deployment on any of the matching environments, an Active Resource will be provisioned if required.
The most common configuration for an Amazon RDS instance is for it not to be publicly accessible. This is achieved by placing it in a private VPC. The RDS instance will only be accessible to AWS resources running in that VPC or in VPCs that are peered to it.
If you do not already have a bastion host set up to administer your Amazon RDS instance, you can follow this guide provided by AWS: How can I connect to a private Amazon RDS DB instance from a local machine using an Amazon EC2 instance as a bastion host?
Once the bastion host is set up, it will need to be configured to allows connections from Humanitec. This is done by adding the Humanitec public key into the
.ssh/authorized_keysfile on the bastion host.