Relational database - Amazon RDS

Amazon Relational Database Service (RDS) new tab provides managed SQL databases of several database engines. This describes how to use PostgreSQL because that is what is used in the Implementing Microservices with Akka tutorial but it would be similar for the other database engines. Once you’ve created your Cloud SQL database go back to JDBC integration to finish the setup.

Create RDS PostgreSQL database

Create a new database from Amazon RDS console new tab. Select the region you are working in.

The example in the Implementing Microservices with Akka tutorial is using PostgreSQL.

For a trial PostgreSQL you can select the following aside from defaults:

  • Standard create

  • PostgreSQL

  • Free tier (some regions don’t offer free tier)

  • DB instance identifier: shopping-cart

  • Master password: <a password>

  • Turn off storage autoscaling

  • VPC: Use the same as your EKS cluster is running in

  • Create new VPC security group: rds-shopping-cart-sg

  • Turn off Automatic Backups in the Additional Configuration section.

The security group will automatically have one role added to it which allows traffic from your current IP to the PostgreSQL port. If your IP changes then you’ll need to update the security group.

You can find more detailed instructions in the Amazon RDS PostgreSQL documentation new tab

Allow EKS security group

RDS instance is in the same VPC as the EKS cluster

When using same VPC for RDS and EKS as described above.

To allow the nodes in the EKS cluster to connect to the RDS instance you have to add a rule in the security group.

Go to the VPC console new tab. Select "Security Groups".

There are 3 security groups for the EKS cluster and you should select the one with description "EKS created security group …​". The one that has a name that doesn’t contain ControlPlaneSecurityGroup and doesn’t contain ClusterSharedNodeSecurityGroup . Make a note of this security group id for the EKS cluster.

Go back to the Amazon RDS console new tab. Select the database that you created. Click on the "VPC security groups" in the tab "Connectivity & security".

Edit inbound rules > add rule > Custom TCP > Port 5432 > Source custom. Add the security group for the EKS cluster. Save rules.

RDS instance is in a different VPC

When using different VPC for RDS and EKS.

  • Peer the two VPCs

  • Add an inbound rule to the RDS security group for the IP CIDR of the EKS VPC

After the instance has finished initializing make a note of:

  • The password you used when creating the instance

  • The default username is 'postgres'

  • The connection details from the Connectivity & security tab of the database in Amazon RDS console new tab, specifically the Endpoint (hostname).

Now that you’ve created your RDS database go back to JDBC integration to finish the setup.