Softwr

Cloud · head to head

AWS CloudFormation vs AWS Lambda

AWS CloudFormation logo

AWS CloudFormation

Cloud

Declarative infrastructure as code for AWS, free for AWS resources

From
Free
Free plan
Yes
AWS Lambda logo

AWS Lambda

Cloud

Run code without thinking about servers

From
Free
Free plan
Yes

The short version

  • AWS Lambda is a serverless compute service.
  • Both are free.
  • Only AWS CloudFormation lists stacks and templates; only AWS Lambda lists event-driven execution.
  • Where AWS CloudFormation falls short: it only manages AWS, so multi-cloud estates need Terraform or Pulumi alongside it.
  • 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 AWS CloudFormation and AWS Lambda differ?

AWS CloudFormation and AWS Lambda differ on pricing model and platforms. Only the attributes on which AWS CloudFormation and AWS Lambda actually diverge.

Attributes where AWS CloudFormation and AWS Lambda differ
AttributeAWS CloudFormationAWS Lambda
Pricing modelNo charge for AWS resource types; extensions per handler operationUsage-based
PlatformsWeb, Linux, macOS, WindowsWeb, API

Identical on both: starting price (Free), free tier (Yes).

Not yet recorded: category for AWS CloudFormation, founded for AWS CloudFormation.

Which features does each one have?

They share no listed features; 6 appear only for AWS CloudFormation 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 AWS CloudFormation

  • Stacks and templates
  • Change sets
  • Drift detection
  • StackSets
  • Rollback
  • Registry extensions

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?

AWS CloudFormation is most often brought in for recreating identical dev, staging and production environments on AWS; AWS Lambda for event-driven functions without managing servers. The jobs each tool is most often brought in to do.

AWS CloudFormation

  • Recreating identical dev, staging and production environments on AWSnot AWS Lambda
  • Deploying one baseline of security resources across many accounts with StackSetsnot AWS Lambda
  • Serverless applications packaged with AWS SAMnot AWS Lambda
  • Previewing and auditing infrastructure changes through change setsnot AWS Lambda

AWS Lambda

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

Where do AWS CloudFormation and AWS Lambda fall short?

AWS CloudFormation's most cited limit: it only manages AWS, so multi-cloud estates need Terraform or Pulumi alongside it. 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.

AWS CloudFormation

  • It only manages AWS, so multi-cloud estates need Terraform or Pulumi alongside it
  • Raw templates are verbose and hard to reuse, which is why many teams add CDK on top
  • A failed update can leave a stack in a stuck state such as UPDATE_ROLLBACK_FAILED that needs manual intervention
  • New AWS features sometimes arrive in CloudFormation after the console and API, so you wait or script around the gap
  • Deleting a stack deletes its resources, so a mistaken delete of a stack with data needs DeletionPolicy discipline

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 AWS CloudFormation and AWS Lambda cost?

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

AWS CloudFormation

Free
  • AWS resource typesFree
    • No additional charge for using CloudFormation with AWS resources
    • You pay for the resources the stack creates
  • Third-party extensionsOn request
    • $0.0009 per handler operation, first 1,000 per month free
    • $0.00008 per second of handler duration beyond 30 seconds

AWS Lambda

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

Which should you pick?

Choose AWS CloudFormation if

  • You need stacks and templates.
  • You want to start without paying.
  • You work on Web, Linux, macOS, Windows.
  • You also want change sets.

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 AWS CloudFormation or AWS Lambda better?
It depends on the job. AWS CloudFormation fits recreating identical dev, staging and production environments on AWS; AWS Lambda fits event-driven functions without managing servers. AWS CloudFormation starts at Free and AWS Lambda at Free.
Which is cheaper, AWS CloudFormation or AWS Lambda?
AWS CloudFormation starts at Free and AWS Lambda at Free.
Does AWS CloudFormation or AWS Lambda run on more platforms?
AWS CloudFormation runs on Web, Linux, macOS, Windows. AWS Lambda runs on Web, API.
Can I use AWS CloudFormation for free?
Both have a free tier, so you can try either at no cost before committing.
What is AWS CloudFormation best used for?
AWS CloudFormation is most often used for recreating identical dev, staging and production environments on aws, deploying one baseline of security resources across many accounts with stacksets, serverless applications packaged with aws sam, previewing and auditing infrastructure changes through change sets. Of those, recreating identical dev, staging and production environments on aws and deploying one baseline of security resources across many accounts with stacksets are not what AWS Lambda is typically brought in for.
What can AWS CloudFormation do that AWS Lambda cannot?
AWS CloudFormation covers Stacks and templates, Change sets, Drift detection, StackSets. AWS Lambda covers Function-as-a-Service, Event-driven execution, Auto-scaling, Pay-per-use.

Answered from the vendors’ own pages

AWS CloudFormation: Does CloudFormation cost money?

Not for AWS resource types. You pay for the resources it creates; third-party extensions are billed at $0.0009 per handler operation after 1,000 free.

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
AWS CloudFormation: CloudFormation or Terraform?

CloudFormation is AWS-only with state managed by AWS; Terraform spans many providers and keeps its own state.

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
AWS CloudFormation: How does CDK relate?

CDK lets you write infrastructure in a programming language and synthesises CloudFormation templates.

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
Share

Related pages

Other head to heads