Monday, November 18, 2019

Running Lambda more frequently than once every minute

Hi Guys,

I posted a while ago about getting some help with my first coding project to write the Bitcoin Price to AWS DynamoDB using AWS Lambda (https://www.reddit.com/r/learnprogramming/comments/dm1ldk/help_with_aws_lambda_writing_bitcoin_price_to/ ). Thanks to your help this is now up and running and I have been collecting price data for the last month or so.

My next question is how can I get the Lambda to run more frequently that every minute? It is currently limited by the minimum CloudWatch event of 1 minute, but I have worked out that I can run it every 3 seconds and still be below my 1 million monthly allowance. I have recently started collecting data from the other exchanges, and I thought it would be interesting to use this data as I learn about python numpy and pandas.

My first thought would be to include a for loop within the Lambda function so that it runs x number of times? But I did some reading and found the following article: https://aws.amazon.com/blogs/architecture/a-serverless-solution-for-invoking-aws-lambda-at-a-sub-minute-frequency/ . Is this the best way of doing it, and is the Step Function necessary? Couldn't the iterating Lambda just invoke the first one a certain number of times?

Thanks, would really appreciate any insight you guys can give.


No comments:

Post a Comment