Skip to content

Commit 4d90a20

Browse files
committed
docs(idempotency): line editing before decorators
Signed-off-by: heitorlessa <lessa@amazon.co.uk>
1 parent 48634c1 commit 4d90a20

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

docs/utilities/idempotency.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ classDiagram
3535
status Status
3636
expiry_timestamp int
3737
in_progress_expiry_timestamp int
38-
response_data Json~str~
38+
response_data str~JSON~
3939
payload_hash str
4040
}
4141
class Status {
@@ -60,7 +60,7 @@ When using Amazon DynamoDB as the persistence layer, you will need the following
6060

6161
| IAM Permission | Operation |
6262
| ------------------------------------ | ------------------------------------------------------------------------ |
63-
| **`dynamodb:GetItem`**{: .copyMe} | Retrieve idempotent record |
63+
| **`dynamodb:GetItem`**{: .copyMe} | Retrieve idempotent record _(strong consistency)_ |
6464
| **`dynamodb:PutItem`**{: .copyMe} | New idempotent records, replace expired idempotent records |
6565
| **`dynamodb:UpdateItem`**{: .copyMe} | Complete idempotency transaction, and/or update idempotent records state |
6666
| **`dynamodb:DeleteItem`**{: .copyMe} | Delete idempotent records for unsuccessful idempotency transactions |
@@ -73,7 +73,7 @@ We provide Infrastrucure as Code examples with [AWS Serverless Application Model
7373

7474
To start, you'll need:
7575

76-
1. A persistent storage layer (DynamoDB or [Redis](#redis-as-persistent-storage-layer-provider))
76+
1. A persistent storage layer - DynamoDB or [Redis](#redis-as-persistent-storage-layer-provider)
7777
2. An AWS Lambda function with [permissions](#iam-permissions) to use your persistent storage layer
7878

7979
#### DynamoDB table
@@ -82,10 +82,10 @@ To start, you'll need:
8282

8383
Unless you're looking to use an [existing table or customize each attribute](#dynamodbpersistencelayer), you only need the following:
8484

85-
| Configuration | Value | Notes |
86-
| ------------------ | ------------ | -------------------------------------------------------------------------------------------------------- |
87-
| Partition key | `id` | Primary key looks like: <br> `{lambda_fn_name}.{module_name}.{fn_qualified_name}#{idempotency_key_hash}` |
88-
| TTL attribute name | `expiration` | This can only be configured after your table is created if you're using AWS Console |
85+
| Configuration | Value | Notes |
86+
| ------------------ | ------------ | ---------------------------------------------------------------------------------------- |
87+
| Partition key | `id` | Format: <br> `{lambda_fn_name}.{module_name}.{fn_qualified_name}#{idempotency_key_hash}` |
88+
| TTL attribute name | `expiration` | Using AWS Console? this is configurable after table creation |
8989

9090
Note that `fn_qualified_name` means the [qualified name for classes and functions](https://peps.python.org/pep-3155/){target="_blank" rel="nofollow"} defined in PEP-3155.
9191

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

113113
* **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.
114114

115-
* **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.
115+
* **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.
116116

117117
* **Old boto3 versions can increase costs**. For cost optimization, we use a conditional `PutItem` to always lock a new idempotency record. If locking fails, it means we already have an idempotency record saving us an additional `GetItem` call. However, this is only supported in boto3 `1.26.194` and higher _([June 30th 2023](https://aws.amazon.com/about-aws/whats-new/2023/06/amazon-dynamodb-cost-failed-conditional-writes/){target="_blank"})_.
118118

0 commit comments

Comments
 (0)