---
title: "Cookiecutter Django With Amazon RDS"
description: "This article will assist you in setting up your docker based Django cookiecutter app with a Postgres database on Amazon RDS, also works with other hosted databases."
canonical_url: "https://haseeburrehman.com/posts/cookiecutter-django-with-amazon-rds"
---

> Index of every page on this site: [llms.txt](https://haseeburrehman.com/llms.txt)

# Cookiecutter Django With Amazon RDS

So, we need to connect our docker based django app to our RDS instance, here are the steps to do so.

## Step 1

Remove `DATABASE_URL=postgres://postgres` from `.envs/.production/.django`

## Step 2

Update `.envs/.production/.postgres` and setup your database credentials.

```env
POSTGRES_HOST=              # db host
POSTGRES_PORT=              # db port
POSTGRES_DB=                # db name
POSTGRES_USER=              # db user
POSTGRES_PASSWORD=          # db pass
```

## Step 3

Comment or remove Postgres volumes and services from `production.yml` file.

You will have to remove the complete `postgres` service.

```yml
# Filename: /production.yml`

volumes:
    # production_postgres_data: {} ## Remove or comment this
    # production_postgres_data_backups: {} ## Remove or comment this
...
services:
  django: &django
    depends_on:
      # - postgres ## Remove or comment this

# postgres: ## Remove or comment this whole block
    ...
```

Your Django app should now connect to your RDS database in production.

Feel free to leave any feedback or queries.

## Sitemap

See the full [sitemap](https://haseeburrehman.com/sitemap.md) for all pages.
