Will pay someone to help me turn my python script into a lambda function

I have a python script that monitors twitter for specific keywords, and I would like it to run every minute and scan twitter. Right now I have it on a virtual machine in AWS and it’s scheduled every minute but because the machine is always running it’s costing me a lot monthly. I am very new to this sort of stuff, but from my research it looks like converting it to a lambda function would be better. If interested DM me

I’m going to tell you right now, that it’s going to be expensive. Even if you get it down to 100ms

Why is that? It only looks at one twitter user, and when he says a specific keyword I get an alert. In case you were thinking I was scanning the entirety of twitter

Every second you spend in lambda doing processing, is a charge. There are 1,440 minutes in a day. How long does that single query take?

You can calculate estimated cost here: https://calculator.aws/. If you have 43,200 requests a month and duration of your lambda is 5s (I suppose your code takes less time than that) and you provision it with minium memory of 128 MB then it costs you only 0.46 USD (+ taxes) a month. I don’t know how much your EC2 is costing you though…

I’m not sure exactly how long it takes, it seems very quick so if I’m being conservative and say the average execution time is 5000ms, the total price is $0 per month for 43,200 executions. Even if I enter a 10 second per execution time it’s still $0. That’s including the free tier. If I uncheck the free tier it’s $3 a month (assuming 10 seconds per request, which it’s really fast in my experience I just don’t know the exact time)

Did everyone forget about lambda free tier?

What do you need help with?

Is it on Github? Happy to take a look

If you invoke a lambda 43800 times a month, for 60000ms (1 minute), the price for lambda will be around 5.5$/Month (including cloudwatch events that invokes the function)

I assume the lambda will run for much less than 60000ms, so eventually, you will save money. (unless you use t2/t3/t3a nano instances)

I’m not a programmer, would have no idea how to do that. Someone wrote this script for me and it’s a private twitter user so I couldn’t use IFTTT

Is this something related to this solution: https://github.com/awslabs/aws-serverless-twitter-event-source that you’re looking for?

This should be able to run on a nano instance. Odds are pretty good unless OP gets someone to do this for OP he should just switch to that.

Savings would be at most like $30 a year switching it to lambda compare dto the cheapest EC2 instance.

You can run a test execution in Lambda to see how long your code takes to run and what resources it needs.

You can try heroku. Their free dyno should be enough for you.

You’ll pay 0.

Seems like a simple task. You can use CloudWatch to invoke your lambda function every minute. There’s not a lot of work to make it run on Lambda either. You just need to make sure that the lambda function has the same library and dependencies as the instance it currently runs on.

1 year reserved T3.micro instance can probably do all this for $4.75 per month. T3.small can handle a LOT a would cost you only $9.49 (us-east). What instance size and region are you using right now?

I’m still new to all this. Roughly how much is it costing you to run the VPC monthly?

Are you sure you’re using the correct size EC2 instance if this is a script that completes itself in less than a minute? Free tier t2.micro gives you 750 hours per month, which is more hours than there are in a month (sounds like you’re only using one instance). Otherwise you have plenty of other suggestions here :slight_smile:

EDIT: just read your use case in a comment. You definitely fit in a free tier instance, or a nano if you’re out of your first 12 months, ~$5 per month.

Lightsail is $3.50 per month, maybe $5 for more RAM. And it comes with no surprises for the transfer costs.