I'm trying to run a python script every 2 minutes in an amazon EC2 ubuntu instance and i've tried a lot of things that just aren't working.
Could someone help me?
What you want to use is cron, a Unix service that allows you to schedule commands to be executed at certain times or intervals.
It is base on a simple configuration text file, the crontab (from "cron table", as in, the table with scheduled commands), which coincidentally is also the name of the tool to edit the file.
Three things you will want to keep in mind about cron:
You should specify the full path to your scripts, otherwise cron will not know where to find them.
There's a crontab for each user and the scheduled commands are executed as the user who owns the crontab file.
Cron's resolution doesn't go below the minutes, i.e., you can't execute something every X seconds.
This should work for you:
*/2 * * * * /usr/bin/python /path/to/your/script.py
I suggest you have a look here: http://corntab.com/ Look at the syntax and the examples, it should be enough to get you going, as well as help you create more crontabs.