Switching from SQLite to Postgres on AWS

System Information
  • Strapi Version:
  • Operating System:
  • Database:
  • Node Version:
  • NPM Version:
  • Yarn Version:

I have successfully installed Strapi on AWS using EC2 and it loads for me when I go to the public IP, however I am now trying to get it working on RDS Postgres but to no avail…

    module.exports = ({ env }) => ({
      defaultConnection: "default",
      connections: {
        default: {
          connector: "bookshelf",
          settings: {
            client: "postgres",
            host: env("DATABASE_HOST", "strapi-database.c9dgemomevss.ap-southeast-1.rds.amazonaws.com"),
            port: env.int("DATABASE_PORT", 5432),
            database: env("DATABASE_NAME", "strapi"),
            username: env("DATABASE_USERNAME", "..."),
            password: env("DATABASE_PASSWORD", "...<J"),
          },
          options: {
        ssl: false,
},
        },
      },
    });

^ As per the above /config/database.js, any idea why I am getting the following?

ubuntu@ip-172-31-2-54:~/strapi-aws$ npm run start

> strapi-aws@0.1.0 start /home/ubuntu/strapi-aws
> strapi start

[2021-11-25T08:06:26.556Z] debug ⛔️ Server wasn't able to start properly.
[2021-11-25T08:06:26.558Z] error error: database "strapi" does not exist
    at Parser.parseErrorMessage (/home/ubuntu/strapi-aws/node_modules/pg-protocol/dist/parser.js:287:98)
    at Parser.handlePacket (/home/ubuntu/strapi-aws/node_modules/pg-protocol/dist/parser.js:126:29)
    at Parser.parse (/home/ubuntu/strapi-aws/node_modules/pg-protocol/dist/parser.js:39:38)
    at Socket.<anonymous> (/home/ubuntu/strapi-aws/node_modules/pg-protocol/dist/index.js:11:42)
    at Socket.emit (events.js:314:20)
    at addChunk (_stream_readable.js:297:12)
    at readableAddChunk (_stream_readable.js:272:9)
    at Socket.Readable.push (_stream_readable.js:213:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:188:23)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! strapi-aws@0.1.0 start: `strapi start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the strapi-aws@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ubuntu/.npm/_logs/2021-11-25T08_06_26_584Z-debug.log

It says that the database “strapi” does not exist, but it does

I am switching from SQlite on Ubuntu Server 20 to RDS Postgres on AWS btw, so maybe it’s still trying to connect to SQlite on Ubuntu?

Would /config/server.js have anything to do with it?

module.exports = ({ env }) => ({
  host: env('HOST', '0.0.0.0'),
  port: env.int('PORT', 1337),
  admin: {
    auth: {
      secret: env('ADMIN_JWT_SECRET', '...'),
    },
  },
});