Storing the session token in AWS Lambda function?

社会主义新天地 提交于 2019-12-11 18:06:23

问题


I have a AWS Lambda function which need to talk to an external REST API. The external API needs a session token with every request.

I generate session token using client id and secret and then i use the session token with further requests to the external REST API.

I am currently storing the session token in mongodb (to persist data during lambda restarts) and retrieving it every time i need it. I think this is not the best way. what is the best / recommended way ?


回答1:


The approach you are using currently reasonable since its important to keep Lamda functions stateless while storing session information outside the function.

Without provisioning a MongoDB cluster, you can use Amazon DynamoDB to store the session data and retrieve for each request.

Note: If you are planning to do further performance improvements, you can consider using an in-memory database or DAX (If you use DynamoDB).



来源:https://stackoverflow.com/questions/48980066/storing-the-session-token-in-aws-lambda-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!