DEV Community

loading...
Cover image for PostgreSQL Database Instance Creation and Configuration in AWS RDS

PostgreSQL Database Instance Creation and Configuration in AWS RDS

sunilkumarmedium profile image sunilkumarmedium ・2 min read

In this article, we will see the step by step instructions for configuring the Postgres DB instance in AWS RDS.

Pre-requisites
To complete this learning, you will need:
βœ“ An AWS Account (Free Tier)

If you don't have an account visit https://aws.amazon.com and click Sign Up.

Amazon RDS is available on several database instance types - optimized for memory, performance or I/O

  • Amazon Aurora
  • PostgreSQL
  • MySQL
  • MariaDB
  • Oracle
  • SQL Server

Alt Text

PostgreSQL on EC2

You can manage your own DB instance by provisioning the EC2 instance and installing the Postgres Database.

Managed PostgreSQL on RDS

Managed RDS Service can handle the patching, backup, recovery, provisioning the resources, availability.

In this article, we focus on using the managed services AWS RDS for creating PostgreSQL Database Instance

Working with Amazon RDS via the AWS Management Console Step by Step Instructions

Step 1: Log in to AWS Management Console and search with the keyword 'RDS'. You will be redirected to the RDS Home Page
Alt Text

Step 2: Click on the Create Database and Select Postgres
Alt Text

Alt Text

Step 3: DB Instance Settings
Alt Text

Step 4: DB Instance Size and Storage. For the Free tier, you will get 'db.t2.micro' instance.
Alt Text

Step 5: Instance Connectivity
Alt Text

Step 6: Additional Configuration
Alt Text

Step 7: Backups Configuration
Alt Text

Step 8: Click On Create Database you will see the resource creation progress. It will take some time for provisioning the resources
Alt Text

Step 9: To view Connection Details click on the View Credential Details Button
Alt Text

Step 10: Connect to AWS RDS Instance from your Local and execute the DB Scripts
Alt Text

Working with the AWS Command Line Interface
To control and automate Amazon RDS resources from the command line, use the AWS Command Line Interface (CLI)

Summary
You can see the detailed implementation and connecting the API to the RDS instance in below github project

GitHub logo sunilkumarmedium / CleanArchitectureApp

Clean Architecture Application Design from Scratch using Dotnet Core 3.1 WebApi and Angular 11 FrontEnd

CleanArchitectureApp

Clean Architecture Application Design from Scratch using Dotnet Core 3.1 WebApi and Angular 11 FrontEnd

MIT license

Technologies

Pre-requisites

  1. .Net core 3.1 SDK
  2. Visual studio 2019 OR VSCode with C# extension
  3. NodeJs (Latest LTS)
  4. Microsoft SQL Server (Optional: If MS SQL server required instead of Sqlite during development)
  5. POSTGRESQL

Configuration

  1. Clone the repo: git clone https://github.com/sunilkumarmedium/CleanArchitectureApp.git
  2. Execute the sql scripts available in the folder /sql/
    • MSSQL use CleanArchitectureDB.sql
    • POSTGRES use CleanArchitectureDB-Postgres
  3. Change the database connectionstring in appsettings.json
    • Path : CleanArchitectureApp.WebApi/appsettings.Development.json or appsettings.json
    • "DBProvider": "MSSQL" , Use MSSQL to connect to Microsoft SqlServer Or POSTGRES to connect to PostgreSQL database
    • "ConnectionStrings": { "MSSQLConnection": "Data Source=DESKTOP-SUNILBO;Initial Catalog=CleanArchitectureDB;User ID=sa;Password=xxx;MultipleActiveResultSets=True", "PostgresConnection": "Server=127.0.0.1;Port=5432;Database=CleanArchitectureDB;User Id=postgres;Password=xxx;Timeout=30;TimeZone=UTC" }'
  4. cd to…

Discussion (0)

pic
Editor guide