When building robust backend applications, leveraging a managed database service like AWS RDS can offer significant advantages in terms of scalability, reliability, and ease of maintenance. AWS RDS supports various database engines such as MySQL, PostgreSQL, MariaDB, Oracle, and SQL Server. In this guide, we’ll focus on how to integrate RDS (PostgreSQL) with a Strapi application.
1. Create an RDS Instance:
– Log in to the AWS Management Console.
– Navigate to RDS and select “Create database.”
– Choose your preferred database engine (e.g., PostgreSQL).
– Select an instance class, storage, and set up the database settings such as DB instance identifier, master username, and password.
– Configure advanced settings, such as network options (VPC, subnet group, security group), backup, monitoring, and maintenance preferences.
– Launch the RDS instance.
2. Configure Parameter Groups:
– Adjust the Parameter group associated with your RDS instance to allow inbound connections from your server hosting the strapi application.
by default, RDS data transmissions happens over SSL, which is not required in my case as i host the application in my AWS EC2 machine and AWS RDS DB is also under the same VPC. and i have made sure that the DB is only accessible from the IP of my EC2 machine. so i will create a new parameter group named ‘cg-app-rds-parameter-grp’ in the RDS console.
add this parameter group into the rds instance
search for the new parameter group created. click on edit and edit the value of ‘rds.force_ssl’ as 0 to allow connecting to DB without SSL.
now you can connect to the DB created in AWS RDS by configuring the database credentials and host in the .env file