Skip to main content

DocumentDB

Lambda can connect to a DocumentDB Cluster:

Connection
  • Connection Types:
    • read-write - Lambda can read from the DB and write to the DB.
    • read-only - Lambda can only read from the DB.
Connect

After adding the connection, you can see generated environment variables that are now accessible for the Lambdas:

Connect

You'll need to use these variables in your code to connect to MongoDB:

  • DOC_DB_DOCUMENTDB01 - the endpoint of the cluster (host and port).
  • DB_SECRET_DOCUMENTDB01 - the secret IDs of user name and password of the cluster.

When we added the connection, we got the following recommendation:

Connect
  • Follow the recommendation in order to gain access to the DB - make sure that the Lambda Function and the Document DB Cluster are in the same VPC.

To learn more about accessing the DB from a Lambda go to: How to use AWS DocumentDB in your Altostra projects.

Ready to Get Started?

Get Started for Free
© 2023 Altostra, Inc.