AWS SNS and Slack Integration

Slack is an awesome tool. Rich set of integrations with AWS and popular APIs make IFTT use cases a breeze. I had recently integrated our JIRA installation to slack for production release notifications to create a timeline of releases plus prodops tasks.

Looking at AWS Lambda today i thought of integrating our production alerts into our Slack prodops channel. Amazon SNS has an HTTP payload that is not compatible with the Slack Webhooks so i needed a transformer in between.

Here is the node.js and AWS Lambda hello world. Select AWS Lamba function as a subscription in the SNS Topic and you are good to go.

Look Ma, no servers.

console.log('Loading function');
var https = require('https');
var async = require('async');

exports.handler = function(event, context) {
	event.Records.forEach(function(record) {
		var notification = record.Sns
		var postData = "payload=" + JSON.stringify({ 
				"text" : notification.TopicArn + ":" + notification.Subject +":" + notification.Timestamp + notification.Message

		var options = {
			host: '',
			path: 'SLACK API PATH',
			port: '443',
			method: 'POST',
			headers: {
				'Content-Type': 'application/x-www-form-urlencoded',
				'Content-Length': postData.length
			function(next) {
				var req = https.get(options, function(res) {
				}).on('error', function(e) {
					console.log("Got error: ", e);
			function completed(d) {

Flying a S107G with your android

I recently bought a S107G RC Copter for my daughter :-). I would say this is an incredible piece of work, super stable and robust. These are the best spent 20$.

I had plans to fly the copter outside then i realized that it was an IR controlled copter so it can flown indoors only. So what next.. Lets try to write an app which can fly the copter. Doing some research led me to this blog on decoding the IR protocol for S107G. It is very interesting how the protocols are reverse engineered (worried about keyless entry to your car now).

I do not have an IR transmitter for arduino so i had to use my S5 for this.

After struggling for a weekend i was able to understand the blog , how IR works and write my first Android app. App is able to control the copter but i am guessing that the phone is not realtime enough to sustain the IR transmission (or my code is buggy). Sometimes copter does not respond to the app, it loses throttle as well( so it is best to use the supplied controller). This POC is just for fun and keeping your mind of work during the weekends.

AWS IAM : Too complicated for your own good

AWS IAM Framework is very flexible and extensible. But it defeats the purpose when you cannot figure out what permissions are required for an operations role like deployment using Beanstalk.

AWS introduced managed policies to ease the pain. “AWSElasticBeanstalkFullAccess” seems like you are giving beanstalk access to an ops guy but behind the scene you give all access and make him/her a power user.

    "Statement": [
            "Action": [
            "Effect": "Allow",
            "Resource": "*"
    "Version": "2012-10-17"

A Facebook and Google App Engine mashup app

It was Friday evening, eve of Cricket World Cup 2011, all the news channels are picking up their favorites for the next match. It is then that i thought of “Paul the Octpus” (may his soul rest in peace) and his predictions. So i took upon the task to build a Facebook app using Google APP Engine (GAE) as the backend.

The Motive behind this app is to compare winners chosen by careful analysis (use feedback) and some sort of random pick (team on left) and see how much the two differ at end of the world cup (i app has only two users 😦 and predictions are 100% till date). GAE gave a free hosting and moreover i do not know a thing about Facebook app or GAE so it should be good learning.

Continue reading

Disabling services in Ubuntu

I install quite a few things on my laptop and some softwares start as services. E.g Mysql , apache. I donot want these applications all the time, they slow down my laptop.

One option is to stop them everytime using
sudo initctl stop jobname

Or go to /etc/init and rename the job conf to something job.conf.noexec (anything other than .conf).
To disable old style jobs that are non upstart use following utility and mark the job to not start in runlevel 3.

XML vs JSON : What does google insight say?

Just stumbled upon Google insights. A very interesting perspective on search statistics.

It shows the decline of XML and rise of JSON.

Update: As per one of the comments on HN, the scales of two graphs are not same, so xml enjoys the bigger volume but is on decline.  The intent is to show the relative search trends ( which kind of reflect the popularity, you may argue not always, but mostly it does)

XML Trends:

JSON Trends:

So it is Google who writes history now.