Like what we’re doing? Star us on GitHub!

Can I use AWS DocumentDB instead of MongoDB?

prove-ability
9 months ago
2 2

mongodb://bard:<passwrd>@docdb-2022-06-13-02-18-07.cluster-c6wqayu9kx2t.ap-northeast-2.docdb.amazonaws.com:27017/?ssl=true&ssl_ca_certs=rds-combined-ca-bundle.pem&replicaSet=rs0&retryWrites=false

I want to link AWS DocumentDB.
I want help.

스크린샷 2022-06-13 오전 11 29 52

  • denolfe
    Payload Team
    9 months ago

    Hey @prove-ability, this error indicates that you are not passing the pem file contents into the Mongo options. You will need to have your .pem file locally and pass the contents into payload.init under mongoOptions. Here is an (untested) example:

    const caContent = fs.readFileSync('/path/to/rds-combined-ca-bundle.pem');
    
    payload.init({
      // ..
      mongoOptions: {
        sslCA: caContent,
      },
    });

    Let me know if that gets you any further.

    Here are some links to SO issues that may be useful as well: link, link

    4 replies
  • prove-ability
    9 months ago

    The method that I told you didn't work.

    So I tried to proceed after watching AWS DOCS, but this also doesn't work.

    Do you have any idea?

    // Initialize Payload
    payload.init({
    
      secret: process.env.PAYLOAD_SECRET,
      mongoURL: process.env.MONGODB_URI,
      express: app,
      onInit: () => {
        payload.logger.info(`Payload Admin URL: ${payload.getAdminURL()}`)
      },
      mongoOptions: {
        tlsCAFile: `${__dirname}/rds-combined-ca-bundle.pem`
        // ssl: true,
        // sslValidate: false,
        // sslCA: `${__dirname}/rds-combined-ca-bundle.pem`
      }
    })
  • x31b
    8 months ago

    hello @prove-ability

    Besides the SSL-issue, do you think DocumentDB's MongoDB API compatibility sufficient for PayloadCMS purposes?

  • jmikrut
    Payload Team
    8 months ago

    @x31b — yes, you should be able to 100% use DocumentDB!

  • x31b
    8 months ago

    Awesome. Thanks @jmikrut

  • moltar
    3 months ago

    @prove-ability Have you gotten the DocumentDB to work?

Open the post
Continue the discussion in GitHub
Can't find what you're looking for?
Get help straight from the Payload team with an Enterprise License.Learn More