So when I popped back on one day to find it wasn’t there any more I was a little concerned. I managed to not notice that my blog had gone down after the EC2 outage earlier this year. SeptemRobin Osborne Amazon EC2, Cloud, Linux, Python, Twitter Leave a comment EC2 Micro Instance Instability Then follows some copying and pasting of auth keys and urls to end up with a nice script on the EC2 instance which was authorised to send tweets from my new twitter account, that was left was to link this into the startup script: sudo nano /etc/rc.d/rc.localīy adding in a new line at the end and set the status to include my own twitter account so I see it as a mention and will therefore also receive an email alert automatically: sudo python /home/ec2-user/tweepy/ec2Event.py EC2 microinstance event raised: Restarted'ĭone! Firing off this script now restarts Apache and mysql and sends the tweet below: My EC2 instance already had python installed so all I needed to do was install git, get the tweepy code from the github repo here ( the location of the github repo in the article is incorrect, so a little googling helped me find the correct location), and follow the instructions exactly!Įssentially this consisted of: sudo yum -y install git Luckily, this has all already been done by someone much cleverer than me, so I copied them! Have a look at this blog post by Jeff Miller explaining how to use the python Twitter API script Tweepy. All it consists of doing is:ġ) Register a Twitter app at Ģ) Set up a new Twitter account for your tweets to come fromģ) Authenticate your new account with your new appĤ) Configure something to use your app to send tweets from your new account I decided to try and get the alert via a tweet and doing this is actually pretty easy. Given how unstable the EC2 microinstance I use is, I wanted to be able to automatically restart the blog related services and alert me that a restart had occurred.
0 Comments
Leave a Reply. |