Repository with examples of AWS Lambdas using its native idempotency validation in Typescript
- In order to run Localstack, you will need to have Docker installed in your machine. You can follow this link to install.
- Then, you will need to install Localstack itself. This link may help you.
- After this, you should install awscli-local by following this link or just running this command:
pip3 install awscli-local
- Start Localstack
LAMBDA_REMOTE_DOCKER=0 DEBUG=1 localstack start
- Create the DynamoDB idempotency table
awslocal dynamodb create-table \
--table-name idempotency \
--attribute-definitions \
AttributeName=identifier,AttributeType=S \
AttributeName=idempotency_hash,AttributeType=S \
--key-schema \
AttributeName=identifier,KeyType=HASH \
AttributeName=idempotency_hash,KeyType=RANGE \
--billing-mode PAY_PER_REQUEST \
--region us-east-1
-
Run the package.json scripts
-
After running each of them, scan the DynamoDB table to check the idempotency records.
awslocal dynamodb scan \
--table-name idempotency
In case you want to delete the table to create it again, run the following command:
awslocal dynamodb delete-table \
--table-name idempotency