Skip to content

Commit ea1792e

Browse files
committed
docs: fix broken links after sections renaming
1 parent 0145c8d commit ea1792e

File tree

1 file changed

+24
-13
lines changed

1 file changed

+24
-13
lines changed

docs/utilities/idempotency.md

+24-13
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ classDiagram
5252

5353
## Getting started
5454

55-
We use Amazon DynamoDB as the default persistence layer in the documentation. If you prefer Redis, you can learn more from [this section](#redis-as-persistent-storage-layer-provider).
55+
We use Amazon DynamoDB as the default persistence layer in the documentation. If you prefer Redis, you can learn more from [this section](#redis-cluster).
5656

5757
### IAM Permissions
5858

@@ -80,7 +80,7 @@ To start, you'll need:
8080

8181
---
8282

83-
[Amazon DynamoDB](#dynamodb-table) or [Redis](#redis-as-persistent-storage-layer-provider)
83+
[Amazon DynamoDB](#dynamodb-table) or [Redis](#redis-cluster)
8484

8585
* :simple-awslambda:{ .lg .middle } **AWS Lambda function**
8686

@@ -126,7 +126,7 @@ Note that `fn_qualified_name` means the [qualified name for classes and function
126126

127127
##### Limitations
128128

129-
* **DynamoDB restricts [item sizes to 400KB](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Limits.html#limits-items){target="_blank"}**. This means that if your annotated function's response must be smaller than 400KB, otherwise your function will fail. Consider [Redis](#redis-as-persistent-storage-layer-provider) as an alternative.
129+
* **DynamoDB restricts [item sizes to 400KB](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Limits.html#limits-items){target="_blank"}**. This means that if your annotated function's response must be smaller than 400KB, otherwise your function will fail. Consider [Redis](#redis-cluster) as an alternative.
130130

131131
* **Expect 2 WCU per non-idempotent call**. During the first invocation, we use `PutItem` for locking and `UpdateItem` for completion. Consider reviewing [DynamoDB pricing documentation](https://aws.amazon.com/dynamodb/pricing/){target="_blank"} to estimate cost.
132132

@@ -138,19 +138,34 @@ Note that `fn_qualified_name` means the [qualified name for classes and function
138138

139139
##### Constraints
140140

141-
If you'd like to use Redis, please [read here](#redis-as-persistent-storage-layer-provider) on how to setup and access secrets/SSL certs.
141+
##### Redis IaC examples
142+
143+
=== "AWS CloudFormation example"
144+
145+
!!! tip inline end "Prefer AWS Console/CLI?"
146+
147+
Follow the official tutorials for [Amazon ElastiCache for Redis](https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/LambdaRedis.html) or [Amazon MemoryDB for Redis](https://aws.amazon.com/blogs/database/access-amazon-memorydb-for-redis-from-aws-lambda/)
148+
149+
```yaml hl_lines="5 21"
150+
--8<-- "examples/idempotency/templates/cfn_redis_serverless.yaml"
151+
```
152+
153+
1. Replace the Security Group ID and Subnet ID to match your VPC settings.
154+
2. Replace the Security Group ID and Subnet ID to match your VPC settings.
155+
156+
Once setup, you can find a quick start and advanced examples for Redis in [the persistent layers section](#redispersistencelayer).
142157

143158
<!-- markdownlint-enable MD013 -->
144159

145160
### Idempotent decorator
146161

147162
For simple use cases, you can use the `idempotent` decorator on your Lambda handler function.
148163

149-
It will treat the entire event as an idempotency key. That is, the same event will return the previously stored result within a [configurable time window](#expiring-idempotency-records) _(1 hour, by default)_.
164+
It will treat the entire event as an idempotency key. That is, the same event will return the previously stored result within a [configurable time window](#adjusting-expiration-window) _(1 hour, by default)_.
150165

151166
=== "Idempotent decorator"
152167

153-
!!! tip "You can also choose [one or more fields](#choosing-a-payload-subset-for-idempotency) as an idempotency key."
168+
!!! tip "You can also choose [one or more fields](#choosing-a-payload-subset) as an idempotency key."
154169

155170
```python title="getting_started_with_idempotency.py" hl_lines="5-8 12 25"
156171
--8<-- "examples/idempotency/src/getting_started_with_idempotency.py"
@@ -337,7 +352,7 @@ You can change this expiration window with the **`expires_after_seconds`** param
337352

338353
!!! note "You can skip this section if you are using the [`@idempotent` decorator](#idempotent-decorator)"
339354

340-
By default, we protect against [concurrent executions](#handling-concurrent-executions-with-the-same-payload) with the same payload using a locking mechanism. However, if your Lambda function times out before completing the first invocation it will only accept the same request when the [idempotency record expire](#expiring-idempotency-records).
355+
By default, we protect against [concurrent executions](#handling-concurrent-executions-with-the-same-payload) with the same payload using a locking mechanism. However, if your Lambda function times out before completing the first invocation it will only accept the same request when the [idempotency record expire](#adjusting-expiration-window).
341356

342357
To prevent extended failures, use **`register_lambda_context`** function from your idempotency config to calculate and include the remaining invocation time in your idempotency record.
343358

@@ -502,7 +517,7 @@ You can can easily integrate with [Batch](batch.md){target="_blank"} using the [
502517
???+ "Choosing an unique batch record attribute"
503518
In this example, we choose `messageId` as our idempotency key since we know it'll be unique.
504519

505-
Depending on your use case, it might be more accurate [to choose another field](#choosing-a-payload-subset-for-idempotency) your producer intentionally set to define uniqueness.
520+
Depending on your use case, it might be more accurate [to choose another field](#choosing-a-payload-subset) your producer intentionally set to define uniqueness.
506521

507522
=== "Integration with Batch Processor"
508523

@@ -951,10 +966,6 @@ When using response hooks to manipulate returned data from idempotent operations
951966

952967
## Compatibility with other utilities
953968

954-
### Batch
955-
956-
See [Batch integration](#batch-integration) above.
957-
958969
### JSON Schema Validation
959970

960971
The idempotency utility can be used with the `validator` decorator. Ensure that idempotency is the innermost decorator.
@@ -965,7 +976,7 @@ The idempotency utility can be used with the `validator` decorator. Ensure that
965976

966977
Make sure to account for this behavior, if you set the `event_key_jmespath`.
967978

968-
=== "Using Idempotency with JSONSchema Validation utility"
979+
=== "Using Idempotency with validation utility"
969980

970981
```python hl_lines="16"
971982
--8<-- "examples/idempotency/src/integrate_idempotency_with_validator.py"

0 commit comments

Comments
 (0)