How to create a 30min timer for each session under serverless

0

Hi all, I am a beginner in serverless. My project requires creating a 30-minute timer for each user's session. How should I implement this in a serverless architecture? Thank you.

I have tried chaining lambda functions, but there is a large margin of error and it's very troublesome. Step functions also require chaining.

profile picture
asked 22 days ago185 views
2 Answers
0

Use EventBridge Scheduler. When you have a new user session create a schedule for 30 minutes from now. When it fires, invoke a Lambda that clears the session.

profile pictureAWS
EXPERT
Uri
answered 22 days ago
profile pictureAWS
EXPERT
SriniV
reviewed 21 days ago
0

I second the solution provided by Uri of using EventBridge Scheduler. I would like to add in addition you can maintain user session in DynamoDB. When the user starts a new session, create a record in DynamoDB table with appropriate startTime, expirationTime , userId, sessionId values. When the user ends the session or when the session expires, you can delete the corresponding record from the table.

profile pictureAWS
EXPERT
SriniV
answered 21 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions