Softwr

Databases · head to head

Amazon DocumentDB vs AWS Lambda

Amazon DocumentDB logo

Amazon DocumentDB

Databases

Managed MongoDB-compatible document database service on AWS

From
On request
Free plan
No
AWS Lambda logo

AWS Lambda

Cloud

Run code without thinking about servers

From
Free
Free plan
Yes

The short version

  • Amazon DocumentDB is a managed document database on AWS; AWS Lambda is a serverless compute service.
  • AWS Lambda is free; Amazon DocumentDB prices on request.
  • Only Amazon DocumentDB lists MongoDB driver and tool compatibility; only AWS Lambda lists event-driven execution.
  • Where Amazon DocumentDB falls short: runs only on AWS; it cannot run on premises or across cloud providers.
  • Where AWS Lambda falls short: provisioned concurrency, used to avoid cold starts, is charged separately at $0.0000041667 per GB-second whether or not the function runs.

How do Amazon DocumentDB and AWS Lambda differ?

Amazon DocumentDB and AWS Lambda differ on starting price (On request against Free), free tier (No against Yes) and platforms (Web against Web, API). Only the attributes on which Amazon DocumentDB and AWS Lambda actually diverge.

Attributes where Amazon DocumentDB and AWS Lambda differ
AttributeAmazon DocumentDBAWS Lambda
Starting priceOn requestFree
Free tierNoYes
PlatformsWebWeb, API
CategoryDatabasesCloud

Identical on both: pricing model (Usage-based).

Not yet recorded: founded for Amazon DocumentDB.

Which features does each one have?

They share no listed features; 8 appear only for Amazon DocumentDB and 20 only for AWS Lambda. Drawn from each product's published feature list. An absence here means we hold no record of it - not that the product lacks it.

Only in Amazon DocumentDB

  • MongoDB driver and tool compatibility
  • Managed patching, backups and monitoring
  • Serverless capacity scaling
  • Elastic clusters
  • Global clusters across up to 10 AWS Regions
  • I/O-Optimized pricing configuration
  • CloudWatch, IAM and AWS Backup integration
  • Zero ETL to Amazon OpenSearch Service

Only in AWS Lambda

  • Function-as-a-Service
  • Event-driven execution
  • Auto-scaling
  • Pay-per-use
  • Multiple languages
  • Concurrency limits
  • Dead Letter Queues
  • Environment variables

What is each one used for?

Amazon DocumentDB is most often brought in for migrating MongoDB workloads to AWS; AWS Lambda for event-driven functions without managing servers. The jobs each tool is most often brought in to do.

Amazon DocumentDB

  • Migrating MongoDB workloads to AWSnot AWS Lambda
  • Content and catalogue document storesnot AWS Lambda
  • Serverless document databases for variable loadnot AWS Lambda
  • Multi region read replicas for disaster recoverynot AWS Lambda

AWS Lambda

  • Event-driven functions without managing serversnot Amazon DocumentDB
  • API backends behind API Gatewaynot Amazon DocumentDB
  • Processing S3, DynamoDB, SQS and Kinesis eventsnot Amazon DocumentDB
  • Scheduled jobs without a always-on instancenot Amazon DocumentDB
  • Edge compute through Lambda@Edgenot Amazon DocumentDB

Where do Amazon DocumentDB and AWS Lambda fall short?

Amazon DocumentDB's most cited limit: runs only on AWS; it cannot run on premises or across cloud providers. AWS Lambda's: ephemeral storage beyond the included 512 MB is metered. Documented limitations, not opinions. Every one is a constraint you would hit in normal use.

Amazon DocumentDB

  • Runs only on AWS; it cannot run on premises or across cloud providers
  • Compatible with MongoDB rather than identical, with no time series collection support
  • Cost combines instance, storage, I/O and backup charges, which are harder to forecast
  • Free tier allowance lasts 30 days for new accounts and is excluded in some regions

AWS Lambda

  • Billed on two axes at once, $0.20 per million requests plus $0.0000166667 per GB-second of duration, so memory settings change the bill as much as traffic does
  • Provisioned concurrency, used to avoid cold starts, is charged separately at $0.0000041667 per GB-second whether or not the function runs
  • Ephemeral storage beyond the included 512 MB is metered
  • Lambda@Edge costs $0.60 per million requests, three times the standard request rate
  • VPC use and cross-region data transfer carry EC2 charges on top

How much do Amazon DocumentDB and AWS Lambda cost?

AWS Lambda is free to use. Plan by plan below, from each vendor's own pricing page.

Amazon DocumentDB

On request

No published plan breakdown. See the Amazon DocumentDB review.

AWS Lambda

Free
  • Free TierFree
    • 1M free requests/month
    • 400,000 GB-seconds/month
    • Always free

Which should you pick?

Choose Amazon DocumentDB if

  • You need mongodb driver and tool compatibility.
  • You also want managed patching, backups and monitoring.

Choose AWS Lambda if

  • You need function-as-a-service.
  • You want to start without paying.
  • You work on Web, API.
  • You also want event-driven execution.

Questions people ask

Is Amazon DocumentDB or AWS Lambda better?
It depends on the job. Amazon DocumentDB fits migrating MongoDB workloads to AWS; AWS Lambda fits event-driven functions without managing servers. Amazon DocumentDB starts at On request and AWS Lambda at Free.
Which is cheaper, Amazon DocumentDB or AWS Lambda?
AWS Lambda has a free tier; the other does not. Paid plans start at On request for Amazon DocumentDB and Free for AWS Lambda.
Does Amazon DocumentDB or AWS Lambda run on more platforms?
Amazon DocumentDB runs on Web. AWS Lambda runs on Web, API.
Can I use AWS Lambda for free?
Yes. AWS Lambda has a free tier, so you can try it without paying. Amazon DocumentDB starts at On request.
What is Amazon DocumentDB best used for?
Amazon DocumentDB is most often used for migrating mongodb workloads to aws, content and catalogue document stores, serverless document databases for variable load, multi region read replicas for disaster recovery. Of those, migrating mongodb workloads to aws and content and catalogue document stores are not what AWS Lambda is typically brought in for.
What can Amazon DocumentDB do that AWS Lambda cannot?
Amazon DocumentDB covers MongoDB driver and tool compatibility, Managed patching, backups and monitoring, Serverless capacity scaling, Elastic clusters. AWS Lambda covers Function-as-a-Service, Event-driven execution, Auto-scaling, Pay-per-use.

Answered from the vendors’ own pages

Amazon DocumentDB: Is DocumentDB the same as MongoDB?

No. It is MongoDB compatible: existing MongoDB drivers and tools work, but Wikipedia notes it supports MongoDB 3.6 and 4.0 with later partial 5.0 compliance and no time series collections.

Source
AWS Lambda: Is there a free tier for AWS Lambda?

Yes. AWS Lambda offers a free tier including 1 million requests per month, 400,000 GB-seconds per month, and 100 GB monthly response streaming.

Source
Amazon DocumentDB: How is DocumentDB priced?

Pay as you go. Provisioned clusters are billed for instances per second, I/O, storage and backup storage, while serverless uses DocumentDB Capacity Units billed per second.

Source
AWS Lambda: How is AWS Lambda charged?

Lambda charges $0.20 per million requests. Duration charges are $0.0000166667 per GB-second for x86 (up to 6 billion GB-seconds/month in US East Ohio with tiered pricing). Ephemeral storage over the included 512 MB costs $0.0000000309 per GB-second. Provisioned Concurrency costs $0.0000041667 per GB-second with a 5-minute minimum.

Source
Amazon DocumentDB: Is there a free tier?

New AWS accounts get one month: 750 hours a month of db.t3.medium, 30 million I/Os, 5 GB storage and 5 GB backup. It is not available in AWS GovCloud (US) or China (Ningxia).

Source
AWS Lambda: What are Lambda Durable Functions pricing?

Lambda Durable Functions include operations at $8.00 per million (start execution, steps, waits). Data written costs $0.25 per GB. Data retention is $0.15 per GB-month with configurable 1-90 day retention (default 14 days).

Source
Amazon DocumentDB: Can it run outside AWS?

No. Wikipedia says it runs only on AWS and cannot span cloud providers or run on premises.

Source
Share

Related pages

Other head to heads