Timedora

Developing and Deploying Serverless Applications

A practical guide to testing, deploying, and operating serverless applications, from local development to reliable event processing.

Responsibilities, Testing, and Local Development

Responsibilities in a serverless application

A serverless application combines event-driven functions with managed services such as APIs, queues, databases, and object storage. The cloud provider operates the underlying infrastructure, but that does not remove the developer’s responsibility for the application and its configuration. Developers still need to design, test, deploy, and monitor how functions and services work together.

That distinction matters because a function can be logically correct but still fail when triggered, when it lacks permission to access a resource, or when a downstream service is misconfigured. Testing only the function’s return value is therefore not enough: tests should also check the application’s observable behavior.

Test at three levels

Use unit tests for business logic in isolation, integration tests for interactions among components, and end-to-end tests for user-visible workflows. An order-processing example shows how these levels complement one another:

  1. Unit: Check whether the tax calculation produces the appropriate result for different addresses. This tests the logic without depending on a queue or database.

  2. Integration: Check that a queue delivers an order event to the function and that the function writes to a database. This tests whether components cooperate.

  3. End to end: Submit an order and confirm that its status eventually changes to processed. This checks the workflow from the user’s action to an observable outcome.

For each level, use representative event payloads. Include normal inputs as well as missing fields, malformed data, duplicate events, and boundary cases. Verify effects such as a database change or message sent—not just the function’s return value.

Use local tools, then validate in the cloud

Local tools make iteration faster. With AWS SAM, a typical local workflow can build the application, invoke a function with a saved event, and run an API locally:

sam build
sam local invoke ProcessOrderFunction --event events/order-created.json
sam local start-api

The saved event should resemble what the real trigger sends. Local invocation is useful for checking event parsing, validation, and business logic. But a local simulation cannot fully validate deployed permissions, service configuration, or behavior across managed services. For example, a successful local invocation does not by itself prove that the deployed function has permission to access a table. Run integration tests in an isolated cloud environment before promoting changes. Local feedback and cloud validation serve different purposes; neither replaces the other.

Infrastructure and Controlled Releases

Keep infrastructure reviewable

describes application resources and their configuration in version-controlled files. A serverless definition may include functions, triggers, queues or topics, databases, permissions, environment settings, and failure-handling destinations. Keeping related code, resources, and permissions together makes environments repeatable and helps reviewers understand how infrastructure changes interact with function code.

For example, an order-processing function and its event source should be defined alongside the resources and permissions they require. Review and test changes to that definition as carefully as code changes: an incorrect trigger or permission can prevent otherwise-correct function logic from working. AWS SAM provides a declarative template for serverless resources and deploys it through AWS CloudFormation.

Test before promoting a release

A typical deployment pipeline builds the application, runs automated tests, deploys to a test environment, runs cloud integration tests, and then promotes the release to production. This sequence makes testing part of the release process, rather than relying on local success alone.

Keep environment-specific configuration separate from application logic, restrict deployment credentials, and give environments appropriate resource boundaries. For a small AWS SAM project, sam deploy --guided can configure an initial deployment, with saved settings used for later deployments. In production, prefer automated, repeatable deployment steps.

Reduce change risk

Producers and consumers may be updated at different times. Preserve event and API compatibility so that an update to one side does not assume the other side has already changed. Monitor releases and plan both how to roll back code and how to handle any data changes; reverting code alone may not address changes made to data.

Where appropriate, release gradually—for example, by shifting a small portion of traffic to a new function version, watching alarms, and rolling back if errors rise. Gradual rollout is a risk-reduction option, not a requirement for every release. Together, version-controlled infrastructure, pre-promotion testing, controlled configuration, and planned monitoring and rollback make deployments more repeatable and easier to manage.

Reliable Event Processing at Runtime

Expect retries and duplicate events

Do not assume an event arrives exactly once. Retries and delivery behavior can result in the same event being processed more than once. Design side effects to be : processing the same event again should not repeat its effect. For example, use a stable event or business-operation identifier to detect a repeat and avoid charging a customer twice or creating duplicate records.

This principle is especially important when processing changes something outside the function, such as a database record or a payment. The goal is not to assume retries never happen, but to make repeated processing safe for the operation’s effects.

Make failures visible and recoverable

Configure suitable retry and failure-handling behavior. Monitor dead-letter queues or other failure destinations so that events that cannot be processed do not remain unnoticed and can be recovered. Retries address some processing failures, but they do not eliminate the need to track events that ultimately fail.

Keep durable application state in an appropriate managed service. A function instance may be reused, but its memory is not a durable store for application state. Avoid retaining user-specific information across invocations; use a managed service when state must persist.

Plan for bursts and their effects

A sudden event burst can expose concurrency limits or overwhelm a downstream dependency. Consider throughput, backpressure, timeouts, and retry volume together. These are connected concerns: when dependencies struggle, timeouts and retries can add more work, and retry volume can amplify the load. Planning for a burst therefore means considering not only incoming traffic, but also what downstream systems can handle and how failed or delayed work is managed.

Reliable event processing rests on several complementary safeguards: make repeated side effects safe, ensure failures are visible and recoverable, store durable state outside function memory, and consider limits and downstream capacity when traffic varies.

  • : A test that checks whether connected components work together.

  • : A test that follows a user-visible workflow through the application.

  • : A deployment approach that introduces a change to production in stages rather than all at once.

  • : A destination or queue used to make failed processing visible for follow-up and recovery.