6

I have two AWS lambda functions - lambdaA and lambdaB.

The http client calls API Gateway endpoint A that invokes lambdaA which generates a uuid and returns to the client.

The client then calls API Gateway endpoint B that invokes lambdaB and passes uuid generated by lambdaA to lambdaB. How does lambdaB verify the uuid is generated by lambdaA.

I could think of using a cache - elastic cache or db - dynamodb. But I don't like elastic cache as it runs a server and dynamodb is probably a little too heavy for my simple use case.

Is there any other simpler way of caching data with AWS lambda.

5
  • No there isn't a simpler way. ElastiCache or DynamoDB would be my recommendations. Commented Aug 19, 2016 at 20:50
  • 1
    DynamoDB is actually pretty lightweight for this type of thing. However, if the two lambda functions are executed in parallel, it sounds like you may have race condition issues where function B is checking for data that has not yet been generated by function A. Commented Aug 19, 2016 at 20:51
  • 1
    Why not a S3 object? ElastiCache and DynamoDB seem overkill for what you are asking. Commented Aug 19, 2016 at 20:56
  • I think s3 would be too slow. Will try. I decided to use DynamoDB. There isn't an issue of race condition in my use case. Commented Aug 20, 2016 at 10:24
  • 1
    With DynamoDB you can use conditional writes to get around any race condition issues. Using S3 it would be more difficult to work around race conditions. S3 would also generally be slower since you would have to read the entire file contents each time, versus reading a single field value from DynamoDB. Commented Aug 20, 2016 at 14:13

1 Answer 1

2

DynamoDB and Elasticache recommended. Also, read the following article by Kenneth Falck:

Amazon AWS Lambda data caching solutions compared

and How HipChat Stores And Indexes Billions Of Messages Using ElasticSearch And Redis

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.