I built my own Tweet scheduler which costs less than 1$ per month

Dinesh S - Oct 29 '22 - - Dev Community

I wanted a simple scheduler that will post tweets from my Notion database to Twitter.

I wanted an app without any bells & whistles, just a dumb scheduler. I did not want to pay 10$/mo just for that. So as any developer would do, I decided to write my own scheduler 😂.

Here's how I did it.

I wrote a script tweeter.js which does the following

  • Fetch content from a Notion database.
  • Prepare the tweet
  • Send it to Twitter based on the scheduled time slot
  • Mark the tweet as posted in Notion.

I have hosted the scheduler in AWS and it runs as a container in ECS.

I use Amazon EventBridge rule to create a new container every 30 minutes. This container when started executes tweeter.js and terminates. This way, I don't have a server running all the time, which in turn results in reduced costs.

It costs less than 1$ a month and I can schedule as many tweets/threads I want.

One caveat is that the tweets schedule time is not accurate to the specific minute. It depends on the frequency at which a new container is created. I have set it to 30 minutes, so if you schedule a tweet between 10:00 & 10:30 all of them would be tweeted at the same time.

References

ECS infrastructure setup - https://github.com/vthub/scheduled-ecs-task

. . . . . . . . . . . . .
Terabox Video Player