Skip to content

gabrielleandro0801/typescript-aws-lambda-native-idempotency

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Typescript AWS Lambda Native Idempotency

Repository with examples of AWS Lambdas using its native idempotency validation in Typescript

Setup

  1. In order to run Localstack, you will need to have Docker installed in your machine. You can follow this link to install.
  2. Then, you will need to install Localstack itself. This link may help you.
  3. After this, you should install awscli-local by following this link or just running this command:
pip3 install awscli-local

Running 💻

  1. Start Localstack
LAMBDA_REMOTE_DOCKER=0 DEBUG=1 localstack start
  1. 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
  1. Run the package.json scripts

  2. 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

Function Wrapper

SQS

SQS Full Event idempotent

Image Image

SQS Message Body idempotent

Image Image

SQS Message Body field idempotent

Image Image

SQS Message Body multiple fields idempotent

Image Image

SQS Message ID idempotent

Image Image

SQS Message Attribute idempotent

Image Image

API Gateway

API Gateway Full Path idempotent

Image Image Image Image

About

Repository with an example of AWS Lambda using its native idempotency validation in Typescript using Localstack

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published