Ravindra BagaleCourses & study guides English Track your progress

Serverless Cost Modelling, Quotas आणि Service Limits सोप्या भाषेत

Serverless स्वस्त वाटते — loop/fan-out/log retention महाग. 1x व 10x cost (USD+INR), quotas, concurrency headroom — launch आधी.

या chapter मध्ये तुम्ही काय शिकाल

  • Cost model
  • Quotas
  • Budget alarm
  • Runaway
  • Pricing links

1. रोजचे: Rohan bill

Rohan (INR) webhook. Partner retry loop + fat logs = Monday bill.

Logs/metrics: CloudWatch; compute: Lambda; bills: Cost Explorer.

2. का model?

हे का लागतं?

Pay-per-use = चांगले design. Quotas = soft walls. Model = honest traffic.

हे काय आहे?

Cost = units x price. Quotas = limits. Reserved concurrency = critical protect.

3. Vertical diagram

Traffic -> price -> quotas -> headroom -> alarmFree tier blind नाही
Alarm first
Traffic estimate (1x and 10x) Service pricing lines (Lambda, API, DDB) Account quotas in ap-south-1 Concurrency and burst headroom Budget alarm + Cost Explorer habit Model before launch day
Cost and quotas before traffic.

4. How: model

कसं करायचं (step by step)

LineUnitWatch
InvokeReq/moRetry double
DurationGB-sMemory high
APIHTTPChatty
DDBRCU/WCUHot+scan
LogsGBDebug prod
X-RaySegments100% sample

5. Commands

Lambda account

aws lambda get-account-settings --region ap-south-1

अर्थ: Unreserved concurrency पाहा.

Quotas

aws service-quotas list-service-quotas --region ap-south-1 \
  --service-code lambda --query 'Quotas[?contains(QuotaName, `Concurrent`)].{N:QuotaName,V:Value}' --output table

अर्थ: Black Friday आधी concurrent quota.

CE get-cost

aws ce get-cost-and-usage --time-period Start=2026-10-01,End=2026-11-01 \
  --granularity MONTHLY --metrics UnblendedCost \
  --group-by Type=DIMENSION,Key=SERVICE --query 'ResultsByTime[0].Groups[:5]' 

अर्थ: CE एकदा enable — मग CLI.

Log retention

aws logs describe-log-groups --region ap-south-1 \
  --query 'logGroups[?retentionInDays==`null`].logGroupName' --output text | head

अर्थ: null retention = forever bill.

6. Runaways

  • Self-trigger loop.
  • Visibility storm.
  • No backoff.
  • Fat DEBUG.
  • Idle provisioned.

7. Industries

  • Fintech budget.
  • Ecommerce 10x.
  • Media GB-s.
  • SaaS tags.
  • IoT storms.

8. Lab

9. Lab - model

Org block नसेल तर ap-south-1 (Mumbai). आधी budget alert.

कसं करायचं (step by step)

  1. 1x/10x estimate.
  2. Account settings.
  3. Null retention.
  4. Budget alert.

Cleanup (billing थांबवा)

  1. Cleanup budget.
  2. No silent prod.

10. एकाच pattern — वेगवेगळ्या industries

  • Fintech (Aisha, Lagos): payment webhooks → SQS → Lambda.
  • Ecommerce (Rohan, Pune): checkout API; inventory SNS fan-out.
  • Healthcare (Mei, Singapore): SNS SMS; PHI + fine-grained IAM.
  • EdTech (Diego, São Paulo): EventBridge nightly cleanup.
  • Logistics (Fatima, Casablanca): EventBridge + saga.
  • Media (Kenji, Osaka): S3 → Lambda thumbs + fan-out.
  • SaaS (Priya, Bengaluru): Cognito + per-tenant partition.
  • Gov (Omar, Amman): strangler fig per form route.

11. Troubleshooting checklist

  1. Region confirm करा.
  2. CloudWatch Logs + request id.
  3. Execution role permissions.
  4. DLQ + oldest message age.
  5. curl -v + CORS.
  6. SFN event history.
  7. Linked chapter पुन्हा वाचा.
  8. Cost: concurrency/retries.

12. सामान्य errors आणि fixes

प्रत्येक row = खरी चूक. Panic करण्याआधी fix वाचा.

Error / लक्षणFix
Free foreverModel real.
No budgetBudgets+SNS.
Concurrency wallQuota+reserve.
Forever logsSet retention.
Fat memoryRight-size.
Retry blindCount retries.
DDB surpriseWatch capacity.
Over-traceSample.
CurrencyUSD+INR.

13. FAQ

प्र. Always cheaper?

Model both.

प्र. Reserved?

Cap+protect.

प्र. Quotas where?

Service Quotas.

प्र. CW link?

CW chapter.

प्र. Provisioned?

Pay for warm.

14. Interview Q&A (Beginner / Mid / Senior + MNC)

प्र. Beginner bill

Invoke+GB-s+logs.

प्र. Quota

Limit.

प्र. Mid estimate

1x/10x.

प्र. Runaway

Spike+cycle.

प्र. Senior cost

Tags+CUR.

प्र. MNC

Budgets+quotas.

15. Tips — English, मराठी आणि हिंदी

Ravindra Bagale's Tip (EN)

Model 1x and 10x, set a budget alarm, leave concurrency headroom — then ship.

Ravindra Bagale's Tip (MR)

1x/10x model, budget alarm, concurrency headroom — मग ship.

Tip (HI)

1x/10x model, budget alarm, concurrency headroom — फिर ship।

घरी करून बघा

  1. Estimate invokes.
  2. Account settings.

थोडक्यात सांगायचं तर

  1. गोष्टी पासून सुरू, मग services.
  2. Existing chapters link — labs copy नको.
  3. Failure साठी design.
  4. Measure → मग पैसे.

16. Architecture decision checklist

  1. User journey 5 bullets, no AWS names.
  2. Sync vs async mark.
  3. Failure mode.
  4. Idempotency key.
  5. Data from access patterns.
  6. Cost 1x and 10x.
  7. Quotas ap-south-1.
  8. Auth decision.
  9. On-call + alarm.
  10. Deep chapter link.
  11. मग console/IaC.

17. Copy-paste quick commands

# Region and identity
aws configure get region
aws sts get-caller-identity

# Lambda landscape
aws lambda list-functions --region ap-south-1 --max-items 20 \
  --query 'Functions[].{N:FunctionName,R:Runtime,T:Timeout,M:MemorySize}' --output table
aws lambda get-account-settings --region ap-south-1

# API Gateway (HTTP APIs)
aws apigatewayv2 get-apis --region ap-south-1 --query 'Items[].{N:Name,Id:ApiId,Ep:ProtocolType}' --output table

# Queues and topics
aws sqs list-queues --region ap-south-1
aws sns list-topics --region ap-south-1 --query 'Topics[].TopicArn'

# Event buses and state machines
aws events list-event-buses --region ap-south-1
aws stepfunctions list-state-machines --region ap-south-1 --query 'stateMachines[].name'

# DynamoDB tables (names only)
aws dynamodb list-tables --region ap-south-1

Sandbox + read-only IAM.

18. अजून industry आणि stack stories

  • Fintech Lagos: webhook → SQS → idempotent ledger.
  • Ecommerce Pune: throttle + fan-out.
  • Healthcare SG: SNS + PHI IAM.
  • EdTech: EventBridge cleanup.
  • Logistics: bus + saga.
  • Media: avoid recursive S3.
  • SaaS: tenant partition.
  • Gov: strangler peel.
  • Startup: Function URL → HTTP API.
  • Retail: FIFO vs Standard.
  • Python: thin handlers.
  • Node: async/await.
  • Java: SnapStart.
  • .NET: package size.
  • Go: static binary.
  • PHP: hybrid.

19. Glossary

Termअर्थ
Cold startपहिल्या invoke ची init
Idempotencyदोनदा = तोच effect
DLQFail झालेले messages
ChoreographyEvents; conductor नाही
OrchestrationSFN central
Fan-outएक → अनेक
Fan-inअनेक → join
Strangler figMonolith peel
SagaSteps + compensate
Provisioned concurrencyWarm N; pay

20. Practice: मोठ्याने explain

  1. 60s: serverless cost quotas गोष्ट.
  2. 60s: sync vs async checkout.
  3. 60s: Lambda नको कधी.
  4. 60s: DLQ + idempotency.
  5. Record ×2.

21. Safe lab hygiene

  • Tag owner+expiry.
  • Budget alarm आधी.
  • Read-only first.
  • Cleanup.
  • No secrets in env/screenshots.
  • No provisioned on hello.

23. Myths

Mythखरं
Servers नाहीतServers आहेत; manage नको
नेहमी स्वस्तSteady वर EC2
No OpsIAM/data/alarms
एक LambdaBounded contexts
Queues optionalLoad leveler

24. Serverless error budget

Checkout error budget 0.1% असेल तर aggressive retries email duplicates देऊन budget जाळू शकतात. Money SLO ≠ notify SLO.

  1. दोन SLOs.
  2. Money retries bounded.
  3. Notify best-effort.
  4. Money page; notify ticket.

25. Regional notes (ap-south-1)

  • Labs Mumbai.
  • Feature availability.
  • Data residency.
  • Latency India.

26. Naming conventions

# Suggested prefixes
# Lambda:  pay-intake-prod, pay-worker-prod
# SQS:     pay-orders.fifo / pay-orders-dlq
# SNS:     pay-order-events
# EB bus:  pay.domain
# SFN:     pay-refund-saga
# DDB:     pay-orders-prod

env + domain नावात ठेवा. CloudWatch grep सोपा.

27. Pre-mortems

  1. Double charge headline.
  2. DLQ drain plan.
  3. Cognito outage mode.
  4. Runbook.

28. Currency / locale

Currencies आणि names rotate करा — global mental model.

29. Festival 10x

  1. Model 10x.
  2. Quota low.
  3. Reserve pay.
  4. Alarm 80.

30. Anti-patterns

  • No cost owner.
  • DEBUG prod.
  • Quota day-of.

उजळणी, मुलाखत आणि तुलना cards

हा lesson काही मिनिटांत revise करा. Cards phone वर save करा किंवा PNG download करा. प्रत्येक card वरचा QR हा lesson उघडतो.

उजळणी card: Model 1x and 10x. Free tier fails. Units × price. Quotas + headroom. Festival model.
उजळणी card: Model 1x and 10x · PNG download करा · Card page उघडा
उजळणी card: Stop runaway spend. Loops + logs. Budgets + retention. Right-size + sample. Money pages.
उजळणी card: Stop runaway spend · PNG download करा · Card page उघडा
तुलना: Guess free tier vs Model 1x/10x. Guess free tier: Hope. Model 1x/10x: Sheet.
तुलना: Guess free tier vs Model 1x/10x · PNG download करा · Card page उघडा
तुलना: Account pool only vs Reserved concurrency. Account pool only: Shared fight. Reserved concurrency: Cap + protect.
तुलना: Account pool only vs Reserved concurrency · PNG download करा · Card page उघडा
मुलाखत card: Lambda bill lines?. Invoke + GB-s + logs. Retries count. Two columns.
मुलाखत card: Lambda bill lines? · PNG download करा · Card page उघडा
मुलाखत card: What is a quota?. Service limit. Request + reserve. Platform + app.
मुलाखत card: What is a quota? · PNG download करा · Card page उघडा
मुलाखत card: Reserved concurrency?. Cap + protect. Critical paths. Isolation vs flexibility.
मुलाखत card: Reserved concurrency? · PNG download करा · Card page उघडा
मुलाखत card: Null log retention?. Forever = cost. Set retention. Config + ticket.
मुलाखत card: Null log retention? · PNG download करा · Card page उघडा

अजून cards: Ravi Sir's Cards.

सराव Tasks

या scenario बद्दल

Vidarbha Cotton Mills हा नागपूर मधला वस्त्रोद्योग व्यवसाय आहे. Ganesh Wankhede त्यांचं IT व cloud काम पाहतात. त्यांचे पैसे INR मध्ये मोजले जातात आणि AWS resources ap-south-1 Region मध्ये चालतात. खालच्या tasks मध्ये तुम्ही या lesson मध्ये शिकलेलं वापरून त्यांची खरी कामं करता. सगळी नावं, account IDs, IP addresses व numbers सरावासाठी काल्पनिक आहेत.

0 / 16

सोपं Inv

का: Idea.

काय करायचं: Invokes तर 1.

कसं करायचं:
  1. Task मधले numbers लिहून घ्या.
  2. कागदावर step by step काढा.
  3. Box मध्ये फक्त final उत्तर लिहा.
  4. Check answer दाबा.

सोपं GBs

का: Idea.

काय करायचं: GB-s तर 1.

कसं करायचं:
  1. Task मधले numbers लिहून घ्या.
  2. कागदावर step by step काढा.
  3. Box मध्ये फक्त final उत्तर लिहा.
  4. Check answer दाबा.

सोपं Logs

का: Idea.

काय करायचं: Logs तर 1.

कसं करायचं:
  1. Task मधले numbers लिहून घ्या.
  2. कागदावर step by step काढा.
  3. Box मध्ये फक्त final उत्तर लिहा.
  4. Check answer दाबा.

सोपं Quota

का: Idea.

काय करायचं: Quotas तर 1.

कसं करायचं:
  1. Task मधले numbers लिहून घ्या.
  2. कागदावर step by step काढा.
  3. Box मध्ये फक्त final उत्तर लिहा.
  4. Check answer दाबा.

सोपं 10x

का: Idea.

काय करायचं: 10x तर 1.

कसं करायचं:
  1. Task मधले numbers लिहून घ्या.
  2. कागदावर step by step काढा.
  3. Box मध्ये फक्त final उत्तर लिहा.
  4. Check answer दाबा.

सोपं Retry

का: Idea.

काय करायचं: Retries तर 1.

कसं करायचं:
  1. Task मधले numbers लिहून घ्या.
  2. कागदावर step by step काढा.
  3. Box मध्ये फक्त final उत्तर लिहा.
  4. Check answer दाबा.

सोपं FT

का: Idea.

काय करायचं: Free≠forever तर 1.

कसं करायचं:
  1. Task मधले numbers लिहून घ्या.
  2. कागदावर step by step काढा.
  3. Box मध्ये फक्त final उत्तर लिहा.
  4. Check answer दाबा.

मध्यम RC

का: Idea.

काय करायचं: Reserved तर 1.

कसं करायचं:
  1. Task मधले numbers लिहून घ्या.
  2. कागदावर step by step काढा.
  3. Box मध्ये फक्त final उत्तर लिहा.
  4. Check answer दाबा.

मध्यम Budget

का: Idea.

काय करायचं: Budget तर 1.

कसं करायचं:
  1. Task मधले numbers लिहून घ्या.
  2. कागदावर step by step काढा.
  3. Box मध्ये फक्त final उत्तर लिहा.
  4. Check answer दाबा.

मध्यम Loop

का: Idea.

काय करायचं: Loop तर 1.

कसं करायचं:
  1. Task मधले numbers लिहून घ्या.
  2. कागदावर step by step काढा.
  3. Box मध्ये फक्त final उत्तर लिहा.
  4. Check answer दाबा.

मध्यम PC

का: Idea.

काय करायचं: Provisioned तर 1.

कसं करायचं:
  1. Task मधले numbers लिहून घ्या.
  2. कागदावर step by step काढा.
  3. Box मध्ये फक्त final उत्तर लिहा.
  4. Check answer दाबा.

मध्यम Thr

का: Idea.

काय करायचं: Throttle तर 1.

कसं करायचं:
  1. Task मधले numbers लिहून घ्या.
  2. कागदावर step by step काढा.
  3. Box मध्ये फक्त final उत्तर लिहा.
  4. Check answer दाबा.

मध्यम Model

का: Sheet.

काय करायचं: invokes + gbs.

कसं करायचं:
  1. Task मधल्या top-level keys पासून सुरू करा.
  2. Child keys 2 spaces ने indent करा (tabs नकोत).
  3. प्रत्येक property मध्ये task मधली value भरा.
  4. Check answer दाबा. Keys चा क्रम महत्त्वाचा नाही.

मध्यम Account

का: Concurrency.

काय करायचं: account.

कसं करायचं:
  1. Task वाचा आणि ते कोणत्या AWS service बद्दल आहे ते ठरवा.
  2. aws लिहा, मग service चं नाव, मग operation (action शब्द).
  3. प्रत्येक आवश्यक flag (--name) व त्यापुढे task मधली value लिहा.
  4. Flags कोणत्याही क्रमाने चालतात. Check answer दाबा.

अवघड INR

का: Idea.

काय करायचं: USD+INR तर 1.

कसं करायचं:
  1. Task मधले numbers लिहून घ्या.
  2. कागदावर step by step काढा.
  3. Box मध्ये फक्त final उत्तर लिहा.
  4. Check answer दाबा.

अवघड Ret

का: Idea.

काय करायचं: Null=forever तर 1.

कसं करायचं:
  1. Task मधले numbers लिहून घ्या.
  2. कागदावर step by step काढा.
  3. Box मध्ये फक्त final उत्तर लिहा.
  4. Check answer दाबा.