AWS RDS PostgreSQL Instance for Django Project Django.How

Author avatar wrote on 26/05/2022

Create AWS RDS Postgres Instance

Go to AWS RDS Dashboard

Make sure you have correct region selected in the right part of top navigation. In this example it is set to Frankfurt (eu-central-1).

Click the “Create database” button.

On the creation form:

  • For “Choose a database creation method” choose “Standard Create”
  • For “Engine Options” choose “PostgreSQL”.
  • In “Templates” section let’s pick “Free tier” to avoid any costs while going over this tutorial.

In “Settings” section: – pick a name for your database instance. It should be unique for your AWS account. Let’s use djangoapplikututorial – pick master username and password that will be hard to guess

In DB instance sections we don’t have a choice for free tier, so we have db.t2.micro option available only.

In Storage section you can change the allocated storage if you plan to have a lot of data.

Pay attention to Connectivity section.

Enable Public access by selecting “Yes”.

Create new VPC security group.

New VPC secutiry group name you can set to “djangotutorialsg”.

We might need security group to limit access to our database server.

In section “Database authentication” leave option “Password Authentication” selected.

In section Additional configuration:

  • Set field “Initial Database name” to the name of your liking. For purpose of this article we’ll call it “djangoapplikututorial”
  • Make sure that “Enable automatic backups” is enabled.
  • Choose backup retention period. Every additional day will increase amount of storage used, thus might increase storage costs.
  • You can leave the rest of options as they were.
  • RDS Postgres Additional configuration and backups

  • Estimated monthly costs section should say how much it costs. SInce we picked the free tier, this section will not show any monthly cost.

    Click Create Database button. You will get to the list of your databases. Please wait until Status field will say “Available”.

    Find out connection details

    Now click on the database to see the details about DB.

    Pay attention to Endpoint and Port section. Endpoint will be your DB HOST and Port will be Port in the credentials URL.

    Edit Django settings

    in file

    #Production database
      'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'DATABASE_NAME',
        'USER': 'USERNAME',
        'HOST': 'END_POINT',
        'PORT': '3306',

    Connection error:

    Is the server running on host "" ( and accepting TCP/IP connections on port 5432?

    Change security group on AWS RDS Database Instance

    To modify the default security group simply follow the next steps

  • Go to Amazon RDS console
  • Click on the instance
  • Click on the security group
  • Add an inbound rule (PostgreSQL)
  • Failed building wheel for psycopg2

    psycopg2-binary is not a dependency of psycopg2. It is a replacement.

    So if psyocpg2 fails to install, just install psycopg2-binary instead.

    pip install psycopg2
    pip install psycopg2-binary
    python makemigrations
    python migrate

  • remove psycopg2 from the requirements.txt and keep psycopg2-binary
  • Resources

    How to create AWS RDS Postgres instance for Django Project – Appliku

    Creating and Configuring RDS With the Django Application | Tutorial With Project

    Change security group on AWS RDS Database Instance

    ERROR: Failed building wheel for psycopg2