teluzia.Cloud Engineer · Day 139
CHAPTER 20 · COST MANAGEMENT AND SECURITY

Serverless monitoring, budget and security review

4–5 hours including independent practice3 topics
LET’S MAKE THIS SIMPLE

What you’re learning today

Serverless signals is today's starting point. A function has low duration but increasing throttles when concurrency is exhausted. Graph invocations, errors, throttles and concurrency together to distinguish slow execution from rejected work. You will connect this with budget review and security boundaries. The lesson's artifact brings these decisions together: Map an API-to-function-to-queue workflow; annotate metrics, cost drivers and trust boundaries and simulate duplicate events without cloud deployment.

Think of it this way

A serverless workflow is a relay race: timing each runner separately does not reveal a dropped handoff, bottleneck or repeated lap.

TOPIC 01 / 03Step by step

Serverless signals

Monitor request counts, errors, duration, throttling and concurrency together. A function can be efficient individually but fail when downstream services or concurrency limits constrain the workflow. A function has low duration but increasing throttles when concurrency is exhausted. Graph invocations, errors, throttles and concurrency together to distinguish slow execution from rejected work.

WORKED EXAMPLE
A function has low duration but increasing throttles when concurrency is exhausted. Graph invocations, errors, throttles and concurrency together to distinguish slow execution from rejected work.

Concurrency counts simultaneous executions; throttling rejects work above applicable capacity; duration measures execution time. Imagine each event triggers a function that waits on a slow database. Duration rises, concurrent executions accumulate and new invocations may throttle even though request volume has not changed. Compare upstream arrival rate with function errors and downstream latency before increasing a concurrency setting. Distinguish rejected invocations from completed invocations reporting application errors. Instrument the whole user transaction so a successful individual function cannot conceal a failed later step. More concurrency may restore acceptance but overload the dependency. Choose an end-to-end capacity model and retry budget, then verify that restored throughput does not simply move the bottleneck to a less visible service. Track downstream saturation during the test.

Why this matters

Graph invocations, errors, throttles and concurrency together to distinguish slow execution from rejected work.

A common trap

Low function duration proves the complete workflow has no errors.

Read all topics in this lesson

A complete reference to revisit alongside the guided steps above.

Serverless signals

Monitor request counts, errors, duration, throttling and concurrency together. A function can be efficient individually but fail when downstream services or concurrency limits constrain the workflow. A function has low duration but increasing throttles when concurrency is exhausted. Graph invocations, errors, throttles and concurrency together to distinguish slow execution from rejected work.

WORKED EXAMPLE
A function has low duration but increasing throttles when concurrency is exhausted. Graph invocations, errors, throttles and concurrency together to distinguish slow execution from rejected work.

Concurrency counts simultaneous executions; throttling rejects work above applicable capacity; duration measures execution time. Imagine each event triggers a function that waits on a slow database. Duration rises, concurrent executions accumulate and new invocations may throttle even though request volume has not changed. Compare upstream arrival rate with function errors and downstream latency before increasing a concurrency setting. Distinguish rejected invocations from completed invocations reporting application errors. Instrument the whole user transaction so a successful individual function cannot conceal a failed later step. More concurrency may restore acceptance but overload the dependency. Choose an end-to-end capacity model and retry budget, then verify that restored throughput does not simply move the bottleneck to a less visible service. Track downstream saturation during the test.

Why this matters

Graph invocations, errors, throttles and concurrency together to distinguish slow execution from rejected work.

A common trap

Low function duration proves the complete workflow has no errors.

Budget review

Serverless billing depends on service-specific usage dimensions. Follow the whole request path, including logs, data transfer and retries; low idle compute does not mean zero operating cost. A retry loop generates function invocations, queue operations and log ingestion for the same event. Count the full path so an inexpensive invocation does not hide an expensive repeated workflow.

WORKED EXAMPLE
A retry loop generates function invocations, queue operations and log ingestion for the same event. Count the full path so an inexpensive invocation does not hide an expensive repeated workflow.

A request unit is a service-specific billing quantity; a retry multiplies attempted work; attribution assigns a cost driver to its workflow owner. Imagine one incoming event fans out to three functions and repeatedly queries storage. Counting only the front-door request understates the activity generated by the workflow. Model invocations, duration-related compute, queue operations, logging and transfer using clearly labeled quantities before applying any current price data. A billing total is recorded spend; a workflow estimate is a model that must be reconciled against that total. Serverless removes some idle-resource management, but retries and verbose logs can still create substantial usage. Define limits, alerts and investigation steps around the actual cost-driving dimensions rather than treating 'serverless' as equivalent to free when not actively clicked by a user.

Why this matters

Count the full path so an inexpensive invocation does not hide an expensive repeated workflow.

A common trap

Serverless has no costs whenever compute is idle.

Security boundaries

Execution roles define what a function can access, while invocation permissions define who can trigger it. Protect event inputs and avoid secrets in logs or environment screenshots. The function's role permits writing one queue, while its resource policy permits invocation from one event source. Neither permission implies the other; validate each direction of the trust relationship.

WORKED EXAMPLE
The function's role permits writing one queue, while its resource policy permits invocation from one event source. Neither permission implies the other; validate each direction of the trust relationship.

An execution role authorizes the function's outbound calls; invocation permission authorizes callers; an event payload is untrusted input crossing the trigger boundary. Imagine a storage event contains a key outside the application's intended prefix. Validate the event shape and expected resource scope before acting, even if the service generated the wrapper. Give the role only the data actions the handler needs and check trigger permissions separately. A secret in an environment setting can still leak through debug logs or screenshots, so control both storage and observation. Restrictive permissions reduce impact but can also produce legitimate failures that require clear diagnosis. Test one allowed event and one denied or malformed event with synthetic data to confirm both the permission boundary and error handling.

Why this matters

Neither permission implies the other; validate each direction of the trust relationship.

A common trap

An execution role defines who can invoke the function.

KEEP THESE WITH YOU

Today’s takeaways

Serverless signals: Monitor request counts, errors, duration, throttling and concurrency together.

Budget review: Serverless billing depends on service-specific usage dimensions.

Security boundaries: Execution roles define what a function can access, while invocation permissions define who can trigger it.

CLOSE THE LOOP

Ready to complete this day?

Verify the practical steps and pass the knowledge check (at least two thirds correct).

Lab steps verifiedKnowledge check passed