Skip to content

docs: adding new Lambda features#7917

Open
leandrodamascena wants to merge 4 commits intodevelopfrom
docs/add-lmi-and-durable
Open

docs: adding new Lambda features#7917
leandrodamascena wants to merge 4 commits intodevelopfrom
docs/add-lmi-and-durable

Conversation

@leandrodamascena
Copy link
Copy Markdown
Contributor

Issue number: closes #7915

Summary

This PR adds documentation for two new Lambda features: Lambda Managed Instances and Durable Functions.

Changes

I created a new lambda-features section in the docs with two pages:

Lambda Managed Instances

  • Explains the multi-process concurrency model used by Python runtime
  • Shows how each Powertools utility works (Logger, Tracer, Metrics, Parameters, Idempotency, Batch)
  • FAQ addressing common questions about cache behavior, thread safety, etc.

Durable Functions

  • Documents the native integration between Powertools Logger and the Durable Execution SDK via context.set_logger()
  • Explains log deduplication during replays
  • Shows how to use Tracer, Metrics, Idempotency, Parser, and Parameters
  • Clarifies when to use Powertools Idempotency vs built-in step idempotency (ESM triggers, methods you don't want as steps)

The idea here is to create those pages as integration guides, not feature documentation. They follow a different structure than core utilities because:

1/ The focus is "how Powertools works with X" rather than "how to use Powertools feature Y"
2/ Current customers that users Powertools should find guidance on Powertools compatibility with those new features
3/ The content is more about considerations and gotchas than step-by-step tutorials

User experience

Please share what the user experience looks like before and after this change


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@leandrodamascena leandrodamascena requested a review from a team as a code owner January 7, 2026 11:19
@pull-request-size pull-request-size bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Jan 7, 2026
@boring-cyborg boring-cyborg bot added the documentation Improvements or additions to documentation label Jan 7, 2026
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Jan 7, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
2 Security Hotspots
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@codecov
Copy link
Copy Markdown

codecov bot commented Jan 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.63%. Comparing base (7af52e4) to head (d823c5b).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #7917   +/-   ##
========================================
  Coverage    96.63%   96.63%           
========================================
  Files          284      284           
  Lines        14105    14105           
  Branches      1162     1162           
========================================
  Hits         13630    13630           
  Misses         345      345           
  Partials       130      130           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.


### Parameters

Parameters utility works correctly, but be aware that **cache is per-process**.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Parameters utility works correctly, but be aware that **cache is per-process**.
Parameters utility works as expected, but be aware that **caching is per-process**.

Copy link
Copy Markdown
Contributor

@dreamorosi dreamorosi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few comments, great work so far, thanks for leading the way

@leandrodamascena
Copy link
Copy Markdown
Contributor Author

Thanks everyone for the feedback! I'm addressing all of them and need some time to finish.

@kishaningithub
Copy link
Copy Markdown

@leandrodamascena Any updates on the above? Would be great to have documentation on durable function support

@powertools-for-aws-oss-automation powertools-for-aws-oss-automation bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Apr 7, 2026
@powertools-for-aws-oss-automation powertools-for-aws-oss-automation bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Apr 7, 2026
@powertools-for-aws-oss-automation powertools-for-aws-oss-automation bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 7, 2026
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 7, 2026

@leandrodamascena
Copy link
Copy Markdown
Contributor Author

@leandrodamascena Any updates on the above? Would be great to have documentation on durable function support

Hey @kishaningithub! We are working to merge this.


### Use Idempotency for ESM triggers

When your durable function is triggered by Event Source Mappings (SQS, Kinesis, DynamoDB Streams), use the `@idempotent` decorator to protect against duplicate invocations.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think with this example it could be good to call out that the ordering of decorators matters.

We should use @idempotency always on top of @durable_exection, right?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or we add it to the FAQ?



@durable_execution
def handler(event: dict, context: DurableContext) -> str:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Do need to add @logger.inject_lambda_context here?


@tracer.capture_lambda_handler
@durable_execution
def handler(event: dict, context: DurableContext) -> str:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment regarding @logger.inject_lambda_context. Is this needed here?


The `@idempotent` decorator integrates with Durable Functions and is **replay-aware**. It's useful for protecting the Lambda handler entry point, especially for Event Source Mapping (ESM) invocations like SQS, Kinesis, or DynamoDB Streams.

```python hl_lines="9 15" title="Using Idempotency with Durable Functions"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```python hl_lines="9 15" title="Using Idempotency with Durable Functions"
```python hl_lines="8 15" title="Using Idempotency with Durable Functions"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docs: Add documentation for Durable functions & Lambda Managed Instances

6 participants