Create a Database with Amazon RDS and the Mendix Database Connector

Last modified: April 18, 2024

1 Introduction

Amazon Relational Database Service (Amazon RDS) is a collection of managed services that makes it simple to set up, operate, and scale databases in the cloud. You can choose from seven popular engines — Amazon Aurora with MySQL compatibility, Amazon Aurora with PostgreSQL compatibility, MySQL, MariaDB, PostgreSQL, Oracle, and SQL Server — and deploy on-premises with Amazon RDS on AWS Outposts.

This how-to uses PostgreSQL as an example to integrate your Mendix app with Amazon RDS.

2 Configuring the Mendix Database Connector for Amazon RDS

To configure the Mendix Database Connector for Amazon RDS, follow these steps:

  1. Create a database in Amazon RDS by doing the following steps:

    1. Select PostgreSQL as the database type.

    2. Select the required template.

    3. Enter a database instance identifier.

    4. Create the Master Username and Master Password. Make sure to store the username and password in a safe location.

    5. In the Connectivity section, set Public access to yes.

    6. Make sure that Database Authentication is set to Password authentication.

      Amazon RDS database configuration
  2. Optional: If you want to limit access to the database to specific apps, do the following steps:

    1. After the database is created, access the security group rules.
    2. Select the first security group.
    3. Click Edit inbound rules.
    4. Click Add rule.
    5. Select PostgreSQL as the database type.
    6. Select the IP address of your Mendix app as the source. If your app is hosted on Mendix Cloud, see Mendix IP Addresses: Outgoing IP for a list of addresses to safe-list.
    7. Save the security group rule.
  3. Download the Database module and import it into your Mendix app. For more information, see Database.

  4. Configure the Database module to connect to AWS RDS by doing the following steps:

    1. Use one of the microflow actions provided in the Database connector in a microflow, as described in Database. For example, add the ExecuteStatement action.

      The ExecuteStatement action in a microflow
    2. In the AWS console, in the RDS Database dashboard, find and copy the Connectivity & Security endpoint.

    3. In the microflow that you created, in the ExecuteStatement microflow action, configure the jdbcUrl parameter in the following way: jdbc:postgresql://{endpoint copied from the AWS console}:5432/

    4. In the User name and Password parameters, enter the Master Username and Master Password that you configured in AWS RDS in step 1d above, or other credentials with equivalent access rights for AWS RDS.

    5. In the Sql parameter, enter your SQL statement. For example, to create a table, you can use the following statement:

      CREATE TABLE employee (
          emp_id INT PRIMARY KEY,
          first_name VARCHAR(50) NOT NULL,
          last_name VARCHAR(50) NOT NULL)
      
    The Execute Statement configuration dialog
  5. Run your Mendix application and trigger the microflow that you configured.

  6. Verify that your Amazon RDS PostgreSQL database contains a new employee table.