Softwr

Cloud · head to head

AWS Lambda vs AWS WAF

AWS Lambda logo

AWS Lambda

Cloud

Run code without thinking about servers

From
Free
Free plan
Yes
AWS WAF logo

AWS WAF

Cloud

Managed web application firewall for CloudFront, load balancers and APIs on AWS

From
$5/month
Free plan
No

The short version

  • AWS Lambda is a serverless compute service.
  • AWS Lambda is free; AWS WAF starts at $5/mo.
  • Only AWS Lambda lists event-driven execution; only AWS WAF lists web ACLs and rules.
  • 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.
  • Where AWS WAF falls short: it only attaches to a fixed list of AWS resources, so applications hosted outside AWS or behind another CDN cannot use it.

How do AWS Lambda and AWS WAF differ?

AWS Lambda and AWS WAF differ on starting price (Free against $5/month), pricing model and free tier (Yes against No). Only the attributes on which AWS Lambda and AWS WAF actually diverge.

Attributes where AWS Lambda and AWS WAF differ
AttributeAWS LambdaAWS WAF
Starting priceFree$5/month
Pricing modelUsage-basedPer web ACL, per rule and per million requests
Free tierYesNo
PlatformsWeb, APIWeb

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

Which features does each one have?

They share no listed features; 20 appear only for AWS Lambda and 6 only for AWS WAF. 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 Lambda

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

Only in AWS WAF

  • Web ACLs and rules
  • Managed rule groups
  • Bot Control
  • Fraud Control
  • Rate-based rules
  • Logging

What is each one used for?

AWS Lambda is most often brought in for event-driven functions without managing servers; AWS WAF for rate limiting login and API endpoints that sit behind CloudFront. The jobs each tool is most often brought in to do.

AWS Lambda

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

AWS WAF

  • Blocking SQL injection, cross-site scripting and known bad inputs in front of an Application Load Balancernot AWS Lambda
  • Rate limiting login and API endpoints that sit behind CloudFrontnot AWS Lambda
  • Adding bot detection to a retail site already hosted on AWSnot AWS Lambda
  • Applying one set of WAF rules across many accounts through AWS Firewall Managernot AWS Lambda

Where do AWS Lambda and AWS WAF fall short?

AWS Lambda's most cited limit: 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 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

AWS WAF

  • It only attaches to a fixed list of AWS resources, so applications hosted outside AWS or behind another CDN cannot use it
  • Charges come from several meters at once (web ACL, rules, rule groups, requests, logging, and per-feature fees), so predicting a bill needs a worksheet rather than a single price
  • Account Takeover Prevention and Fraud Control start at $1,000 per million requests, so protecting a busy login endpoint can cost more than the web ACL itself
  • Managed rules ship in count-first workflows and generate false positives on unusual payloads, so someone has to review logs and tune exclusions
  • Request body inspection is capped by default, and inspecting beyond the limit or using more than the default capacity units carries extra per-request charges

How much do AWS Lambda and AWS WAF cost?

AWS Lambda is free to use; AWS WAF starts at $5/mo. Plan by plan below, from each vendor's own pricing page.

AWS Lambda

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

AWS WAF

$5/month
  • Pay-as-you-go$5/mo
    • $5.00 per web ACL per month
    • $1.00 per rule and $1.00 per rule group per month
    • $0.60 per million requests
  • Bot Control$10/mo
    • $10.00 per web ACL per month subscription
    • Common: $1.00 per million requests, first 10 million free
    • Targeted: $10.00 per million requests, first million free
  • Account Takeover and Fraud Control$10/mo
    • $10.00 per web ACL per month per rule group
    • $1,000 per million requests for the first 2 million, falling to $50 per million at the highest tier

Which should you pick?

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.

Choose AWS WAF if

  • You need web acls and rules.
  • You also want managed rule groups.

Questions people ask

Is AWS Lambda or AWS WAF better?
It depends on the job. AWS Lambda fits event-driven functions without managing servers; AWS WAF fits blocking SQL injection, cross-site scripting and known bad inputs in front of an Application Load Balancer. AWS Lambda starts at Free and AWS WAF at $5/month.
Which is cheaper, AWS Lambda or AWS WAF?
AWS Lambda has a free tier; the other does not. Paid plans start at Free for AWS Lambda and $5/month for AWS WAF.
Does AWS Lambda or AWS WAF run on more platforms?
AWS Lambda runs on Web, API. AWS WAF runs on Web.
Can I use AWS Lambda for free?
Yes. AWS Lambda has a free tier, so you can try it without paying. AWS WAF starts at $5/month.
What is AWS Lambda best used for?
AWS Lambda is most often used for event-driven functions without managing servers, api backends behind api gateway, processing s3, dynamodb, sqs and kinesis events, scheduled jobs without a always-on instance. Of those, event-driven functions without managing servers and api backends behind api gateway are not what AWS WAF is typically brought in for.
What can AWS Lambda do that AWS WAF cannot?
AWS Lambda covers Function-as-a-Service, Event-driven execution, Auto-scaling, Pay-per-use. AWS WAF covers Web ACLs and rules, Managed rule groups, Bot Control, Fraud Control.

Answered from the vendors’ own pages

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 WAF: How much does AWS WAF cost per month?

On pay-as-you-go pricing it is $5.00 per web ACL and $1.00 per rule per month, plus $0.60 per million requests, per the AWS pricing page. Bot Control, fraud rules, CAPTCHA and logging are billed on top.

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 WAF: Does AWS WAF work outside AWS?

No. It protects supported AWS resources such as CloudFront, Application Load Balancer and API Gateway. Origins elsewhere can be covered if they sit behind CloudFront.

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
AWS WAF: Is AWS WAF included with Shield Advanced?

Shield Advanced includes WAF usage for protected resources, up to 50 billion requests per month and 1,500 capacity units per web ACL, per the Shield pricing page.

Share

Related pages

Other head to heads