Public IP Address of Private AWS Instances?

Do you want to find out the public IP address of your private instances (those in a private VPC subnet) but don’t know how? An easy way to do this would be to just do a “whatsmyip” equivalent on the private instance such as this:

wget -O - -q ; echo

However, there’s an even easier way to figure this out, especially if AWS is your bread and butter. Every private instance communicates to the outside world via a NAT instance or a NAT gateway (yes, this is your ‘duh’ moment). So, all that you need is your NAT gateway’s or NAT instance’s Elastic IP address and you’re done.

In my case, I was trying to allow an ELB on one AWS account to see traffic from private instances on another AWS account. So, I just added an entry to the ELB’s security group to listen from the NAT gateway’s Elastic IP of the other AWS account and I was done.

Posted in Amazon Web Services, Linux, Tech. | Tagged , , , , , , , , , | Leave a comment

TravisCI and Ansible on AWS

If you’re trying to use Travis CI and Ansible playbooks to spin up and configure instances on AWS, you’ll want to do things at some point:

  1. Configure instances on private subnets with Ansible via bastion host
  2. Secure the said Bastion host’s security group to talk to TravisCI

The problem is that Travis CI is a hosted service on the Internet, whereas your instances are sitting in a private subnet inside AWS. How can you make TravisCI use Ansible to talk to these instances? How do you find out TravisCI’s IP address, given that TravisCI launches your build in a new container each time?

The answer lies in Ansible 2.0’s new SSH Jump Host setting. The following lines should be set as variables for the group or host vars. I set it in group_vars/all because that fits my use case currently:

ansible_ssh_common_args: '-o StrictHostKeyChecking=no -o ProxyCommand="ssh -i <private-key-for-bastion-host.pem> -W %h:%p -q ubuntu@X.X.X.X"'
ansible_ssh_private_key_file: '<private-key-for-private-subnet-instances.pem>'

The first variable is appended to SSH commands automatically by Ansible. The problem with Ansible’s documentation is that it doesn’t mention the need to specify the key file for the bastion host, and I spent hours with errors such as these:

debug1: key_load_public: No such file or directory
debug1: identity file /<> type -1

It is probably immediately apparent to someone that works with SSH / Ansible day-in and day-out, though.

Next, you should encrypt these private keys with Travis encrypt files command and paste the output of the command into your .travis.yml file, like so:

- openssl aes-256-cbc -K $encrypted_23423423_key -iv $encrypted_23423423_iv -in <private-key>.enc -out <private-key>.pem -d

which dynamically decrypts the file during a build into the container’s current directory (which is the directory where it clones your Git repo, for example). If you want to encrypt multiple files, you should encrypt an archive of the files like so:

Next, let’s talk about securing the security group for the bastion host. Now, you don’t want to open SSH up for the world, do you? But given that TravisCI launches a new container with a different IP each time, how do you open the security group to this container?

The answer is dynamic modification of the security group. This is how I did it in .travis.yml:

- PUBLIC_IP=`wget -O - -q ; echo`
- "echo travis_ip: $PUBLIC_IP >> group_vars/all"

- ansible-playbook 01_create.yml

This effectively puts a variable called “travis_ip” into the group_vars/all file that is then picked up by Ansible when it runs the 01_create.yml playbook.

- name: create/maintaing EC2 security group for Bastion host
      module: ec2_group
      name: "{{ bastion_sg }}"
      description: Security Group for Bastion Server
      region: "{{ region }}"
      vpc_id: "{{ vpc_id }}"
        - proto: tcp
           from_port: 22
           to_port: 22
           cidr_ip: "{{ travis_ip }}/32"

That’s it! You’re now all set to use Travis CI and Ansible.

Posted in Linux, Tech. | Leave a comment

Defrost Timer – A Look Inside

If the defrost timer on your fridge is a mechanical timer (works like a wall clock, and ticks annoyingly), then sometime or the other you’ll have this thing fail on you. Ours did, but I wanted to be sure it couldn’t be saved, so I decided to pry it open. It isn’t easy to open the timer up. You’ll inadvertently break a tab or two (I broke one), and you’ll have to be careful opening it up, because as soon as you pop it open all the parts fly into the air. One, you’ll have to search all over the room for parts. Two, because you’ve no idea what the parts are, you’ll never know if you should stop searching for more parts. Third, when you do gather all parts and try to put it back in, you’ll have no idea which part goes where.

I scourged the Internet for a close-up picture of any defrost timer to help me put all the gears and parts back in, but I found nothing.

So, to help some people who might be in a similar situation, I post these pictures of my defrost timer and I hope it helps you put things back in the way they were. When I put all the parts back in, my timer started ticking again. I’ve no idea what fixed it, but the ritual of opening and putting everything back in seems to have worked. Click on the pictures for a full view.



Posted in Tech. | Tagged , , , , , , , , , , , , , , | 1 Comment

A Desert Experience – Jaisalmer & Khuri

I was lying on a thin mat and it was the only thing protecting me from the cold sand under it. I had two layers of blankets covering me, yet my body wouldn’t stop shivering. Not being used to not having walls surround my bed, my mind switched to “Stone-Age” mode of “fight or flight” and I was constantly on the look out for “predators” and other things that might pounce on me any minute. I barely slept a wink.

This was a night spent out on the Khuri sand dunes (Rajasthan), courtesy Badal Singh. Badal rents his place out for tourists and charges bare minimum for the arrangements. Badal is one of the few who believe money isn’t everything. He explained how he makes a good living with what he makes in rents and says he doesn’t need to charge more.

At his house, luxuries are minimum. Hot water buckets are arranged on request and on mercy of power gods (electricity department). Water is heated with coils dipped into buckets – they take a long time to do their job. There is no plumbing in most of the bathrooms so you’ll have to carry your own water. There are no sinks either, so brushing your teeth is awkwardly uncomfortable. There are no room heaters, so prepare to shiver if sitting in shade. Also prepare to shiver when having a bath because the bathroom has a window letting cold air in. Drinking water was provided from an earthen pot – the colony receives drinking water from the government once every few days. And then, I had no phone signal either. My phone was now rendered to being a torchlight.

All used vessels (I saw a huge pile) were washed with only a tub of water. Using more water would severely put them at risk of running out – water they store in a concrete tank built under their house.

Staying at Badal’s house made me realize just how many luxuries I was used to. Back at home, I have 24X7 running water for cleaning myself, for drinking and for everything else. I can have extremely hot water at the flick of a button, running water at the sink, backup power, and super fast Internet and instant communication.

Out here, I was stripped off these luxuries. I felt bare, but also relieved. With nothing to do, you start noticing everything else. I noticed how few clothes Badal and his family members owned. Those that they wore were obviously well worn and tears re-stitched. These were people that had to impress nobody – there were no bosses or colleagues, neither were there any Joneses to keep up with. Pots, pans and cups were of various sizes and shapes so I guessed they collected one here, one there, over the course of many years.

The little huts Badal built were made of a mixture of clay and cow dung, taking no more than a few weeks to build after foundation (of sandstones). They were nicely painted in white and red and looked beautiful inside out. Floors open to the sky were simply mud and cow-dung packed tightly. When I stepped on it barefoot, I realized that it was warm and welcoming unlike parts of the concrete floor that were still cold from last night’s chill. Wow!

Unable to bear the cold, I stepped out onto the terrace and out into the sun. I grabbed a blanket and lay out in the sun for an hour happily sunbathing, warming myself, and just casually gazing around doing nothing – just like the cows Badal owned. Why do human beings have to work?

Food served was basic and masalas were surely avoided. I had poha for breakfast with some really delicious ginger-tea served in a pot. Lunch comprised of bajra roti with dal, rice, and a simple cauliflower curry. Delicious!

Later that afternoon, we were hurried out to the desert on camels (We: there were others beside me and my wife that were staying with Badal) We were asked to bring our own water and nothing else. All arrangements were to be available at the site. It is not until you reach the desert that “arrangements” mean nothing but the availability of food and bedding. Back to the very basics.

It took us an hour to reach our site by camel on a ride that was mostly uncomfortable. Our site in the sand dunes was chosen such that it was low lying and behind shrubs – this was to avoid the chilly winds that were out there to freeze us. At the site, we walked around in the sand (still warm) and watched the sun set into the horizon. There was nothing around us for miles (as far as the eyes could see) but for sand and shrubs, shrubs and sand, in changing order. All we could hear was complete silence, occasionally penetrated by our own voices. Sound travels far when not impeded by obstacles.

We were served an early dinner.  Food was cooked over a wood fire and consisted of balls of atta, called “rota” – wheat flour baked directly in the fire, accompanied with dal and curry. The rotas had a beautiful outer crust that tasted great – I was never going to look at wheat flour the same way ever again. However, we soon realized that the sand just doesn’t finish getting into your shoes, and your shirt, it even gets into the food. There was a lot of sand we ate that night, but the taste of the food and our hunger made us ignore it.

Water is even more precious here, so bowls and pans aren’t “washed” anymore. They’re just wiped off clean with, umm, sand. After a round of generous wiping, our hosts ate their dinner in the same bowls.

Not long after we ate, the bedsheets were laid out and thick, heavy blankets handed out to all of us. We were shown our places and we had all the night to us, out in the open.

That night, I gazed for a long time at the beautiful bare sky. The moon was full and had lit up the desert well. Hundreds of stars twinkled at us, and we said hello for the first time in several years. Back in the city’s light-polluted skies, you barely get to see the moon. Here, we had a vast buffet of stars for our delight.

However, with the cold, and being out in the open, I barely slept at all. In the distance, I could hear a camel happily eating away at a large shrub all night, grinding its teeth against the hardened leaves.

Early next morning, we were woken up to the chirping of a few birds (that braved the cold) and the sun slowly rising above the dunes. There were no bathrooms obviously, so we had to make do with doing “it” in the open. It was an uncomfortable experience, given we had lived all our lives s(h)itting inside four walls. It was still horribly cold and my hands froze as I tried to brush my teeth with a bottle of water.

Meanwhile, breakfast was being prepared and we were shortly called out for. On offer was black tea sweetened with jaggery and rotis that were mildly sweet. They were not made of atta – I asked but I now forget the name. I was hungry and I hogged on 2 or 3 rotis before we left the desert to return to Badal’s house on the camels.

Btw, if you’ve never been on a camel ride, I suggest you avoid it. The ride is bumpy and very uncomfortable when the camel’s walking. At speeds greater than walking (say, jogging), your back is thrown 2 inches into the air with every stride. If you don’t end up with a broken back, you’re sure to end up with body pains that’ll last a while. Don’t do it! (But you’ll probably do it anyway.)


Posted in Travel | Tagged , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Lakshmi Misthan Bhandar – A Money Pit

We recently visited Lakshmi Misthan Bhandar at Jaipur (or LMB) after it was recommended by several people both online and off of it.

We were terribly hungry when we went in, so we planned to dive right into the main course and have some roti and curry. We sat down in the restaurant and looked at the menu. One look at the prices and we left immediately. We wouldn’t ever want to pay Rs.300 for a curry and Rs.80 for a (basic) paratha (ever!). And specially not, given the ambience (or lack of it) of the place. This restaurant was a noisy and closely packed place with the looks of a casual restaurant. The thaali (platter) was Rs.540 per person! The restaurant, however, was packed, so people of Jaipur are either too rich or have very little choice when it comes to food.

We stepped out into the LMB snacks and sweets area, and decided to have some snacks / light food and continue our shopping. The snacks area is a big mess with pamphlets and printouts of “special snacks” and “LMB special sweets” plastered all over the wall. Stacks of sweets and boxes piled in every possible place. I’ve never seen a messier eatery before. It is not enough for the owner to understand what he offers, if the customer doesn’t get it, it’s a fail. There was also a lot of confusion among new customers over ordering food items as there was no visible “cash counter” anywhere. After asking, we were pointed to a small area walled with pre-packed sweet boxes that was supposedly the token counter.

There’s a menu card tucked in at this counter where we could finally figure out what was on offer.



Most of the items on this card, as you can see, are still quite overpriced. We ordered a Raj Kachori, a samosa, a Mirchi Bada and a Laccha Rabdi (sweet). The Raj Kachori (Rs.90) is a huge pani puri filled with alu + moong dal (cooked) and curd – it tasted alright. The Mirchi Bada (Rs.25) was filled with alu masala and was tasty. The samosa (Rs.20) was a major disappointment as its taste lacked any character – we left half of it. The Laccha Rabdi (Rs.40) was delicious and we savoured it all, leaving nothing.

Later that evening, we ordered a veg cheese sandwich (for our train journey) and packed some sweets for back home. However, when we opened the sandwich for eating later that night, we were shocked to see how thin it really was. And when we bite into it, we realize that there are no veggies in there! Just cheese and bread (for Rs.90!!). The sandwich was a horrible joke, so we then went and ordered more food from the train’s pantry service. We were left feeling ripped off.

The packed sweet box (petha with sugar syrup) didn’t have a tight seal either and started leaking as soon as we left LMB ( we noticed it later and had to do some cleanup of our luggage).

It looks like LMB is one of those places that continues to rake in money and pull in customers based on nothing but the fact that it was established ages ago. The owner of this place has tried to transform the sweet shop into a all-you-can-think-of eatery, serving items from sweets, ice-creams, burgers, pizzas, thaalis, roti-subji, and everything under the sun. When you step in, you can feel right away that this place doesn’t have a heart, that the owner doesn’t care- it is rather very disconnecting from the “person” and only seems to crave the person’s money.

This probably still would have been a value-for-money place had everything on the menu been HALF its price. However, at these horrendously insane prices (and severe lack of quantity for the price), the Lakshmi Misthan Bhandar is a place best avoided.

Posted in Reviews, Travel | Tagged , , , , , , , , , , , , , , , , | 1 Comment

Aa Seetadevi – Lyrics (Rowdy Fellow)

I’m posting the lyrics to this song Aa Seetadevi from the tackily named movie – Rowdy Fellow. I had heard the song twice on the radio and quite liked it. However, googling for the song yielded no results as the song is new and no one had posted the lyrics to the song. Also, the song is called “Aa seetadevi” but I was searching using other words from the song.

Here’s the lyrics to the song so nobody else will have to spend hours searching for it, and here’s the song on YouTube:

Aa seetadevi navvula... unnave enti maatala
Laskhmanude leni ramude... neeku eedu jodu veede

Andala buttabommala... acchanga kanti papala
Vennallo aadapilla la... ninnu taluchukundi eede

Chelliyo challako... premano anduko
Nootiko kotiko... varudu nenu le

Ninatti janmalo... punyame anduko
Kaallane adduko... vadhuvu gane maripove

Ee kshanam swayamvaram... ivala sambaram X 2
Veedukolu leni todu... andi swagatam
Ee kshanam swayamvaram... ivala sambaram


Ivaala ningi loni taara... talukku mandi edurugaara
Vayassu teerikundadara? haayi haayi haayiiii

Sogassu panchutunna dhaara, nee pallukkuloni panchadhara
Aa paina oorukodu lera.. haayi haayi hayiiii

Uyaala oogutunte vallo... ekantham antu verey ledu lera
Kallaara ninnu chusukunte... haayi haayi haayi hayiii

Ee kshanam swayamvaram... ivala sambaram X 2
Veedukolu leni todu... andi swagatam
Ee kshanam swayamvaram... ivala sambaram

Aa Seetadevi navvula... unnave enti maatala
Laskhmanude leni ramude... neeku eedu jodu veede

Chelliyo challako... premano anduko
Kaallane adduko... vadhuvu gane maripove

Ee kshanam swayamvaram... ivala sambaram X 2
Veedukolu leni todu... andi swagatam
Ee kshanam swayamvaram... ivala sambaram



Posted in Personal, Uncategorized | 3 Comments

India’s Got A Driving Problem

Anybody that has driven or been driven in India know that it is not a pleasant experience. Heck, just being on an Indian road or street can be a highly stressful experience. Personally, I detest driving on India’s roads and I would call it as one of the most annoying experiences India has to offer. For many many years, I had a faint hint of hope that things would surely change for the better, but after a decade of being on these streets, I’ve completely lost all hope.

You know the rules of driving in India, wait, there’s just one rule and that is: “I’m the only one on the road”. Here, nobody likes to wait behind a vehicle, either in motion or at the signal. Everyone has to be at the front and in this quest we shall not care about clogging the free left or turning right from extreme left. We will also keep inching forward while waiting for green because that somehow makes red disappear faster. Don’t worry, all the action isn’t only for the lead drivers. Those waiting at the back while away time by spitting god-knows-what on the road, or trying to see how close their vehicle can get to the one in front or the side. Autorickshaws are trying to see if they can magically fit their tin-box into a gap meant for cats. Motorbikes are jostling hard to get to the much-vaunted front, and will climb footpaths and other Indian road undulations (such as your feet) to do so.

Red changes to green and mayhem occurs. Those at the front have the golden opportunity of being able to shoot themselves into a direction of choice. It’s different for everyone else. Drivers at the back see “Green” and their hands instantly reach for the large Indian horn-pad to scare the hell out of people like us around. For most Indians, though, it’s their wake up call to get their mouths in check (from spitting), phones go into pocket or into an awkward head-tilt. Autorickshaws will now try to get their junk machines to start, two wheelers will need to kick their mopeds into life, beggars will have to now move off the road and any pedestrian trying to cross over will need to run for life. Traffic starts moving an inch and you know it because there’s suddenly a massive cloud of black thick diesel and white kerosene smoke rising from tailpipes and there’s maddening honking everywhere. Nobody has any idea who’s taking what direction.  Everyone forgets lanes (if they knew what they were in the first place) and drive all over the road like they were scrambling for gold, but magically get their vehicle in the direction they intended to take.  Soon, the light turns to red but worry not, for there will be another 2 dozen vehicles that will make it before some decide to stop. Aah, the bliss of being at the front of a signal-wait.

Once let loose on the road, we drive with a happy bliss and leave all worries to the lemons hanging from the bumper (post puja). Driving too fast? Lemons. Following too closely? Lemons. Sudden lane change? Lemons. The lemons will automatically connect these drivers to whichever god they pray to and he creates a safety shield for the vehicles and it’s passengers. The aim is to drive fast, so long as you are in the general direction of your destination, then leave everything else to lemons. You don’t want to slow down for anyone and it’s pedal-to-metal if you see an empty road, forget vehicle dynamics and road conditions. On a congested road, honk a lot, and you might finally annoy someone into giving way. Remember to honk often, for that’s nitro-boost for your engine.

Also, when in doubt about any road “rule”, honk and ye shall find an answer. If you’re unsure where to go, honk and someone might appear at your window and tell you where to go. Municipal authorities selected a few streets and painted intermittent white lines that we’re not sure why. Hmm, maybe they are there to let the road-user know they’re still in the correct direction. We often wonder why they had to waste so much paint for telling direction. Oh wait, maybe it is to make up for the near-complete lack of street signs anywhere. There are a few signs peppered here and there but that’s for killing time on streets where there isn’t enough action in the form of stray dogs, pedestrians, cows or crazy drivers.

Then there is the complete lack of courteousness and the pushy behavior of a significant percent of motorists. If you’re in their general direction, even diagonally, they shall swerve and let you be known that you were supposed to have anticipated their move and slowed down. After all, they have important business to attend to. On undivided roads, the entire street for everybody, you choose the direction. You can drive on the left side or the right or even perpendicular to the traffic direction, it’s up to you. There will be a lot of honks in meek-protest, ye shall ignore them.

There is also complete ignorance and abuse of “high-beam” and it seems people are trying to illuminat other driver’s faces, rather than the road. It is nearly impossible to drive in India when it’s dark, and you can just manage if you choose to fold your rear view mirrors, else you’ll be completely blinded by vehicles at the back. Requests to dim lights are seen as requests to flash lights to dim and back to high beam. I have no choice but to switch to high-beam to be able to see something on the road. It’s weird, but I’ve seen some drivers switching to low-beam for 1-2 seconds and as I say “aah, thanks” and switch to low myself, they switch back to high-beam. I don’t get it.

I could write a book with a dozen chapters on India’s driving habits, but if there’s one common behavior that I see on the wild wild Indian roads, that’s this: We drive like we walk. Go to any busy bazaar street and what do you see? People jostling for space, walking inches within each other, randomly changing directions to go faster, some will even physically move you out of the way if you walk too slowly for them. We know where we want to go and we will make way for ourselves to be there. We all know the common push with hands or bellies from those behind. Also, there’s no queue system at any Indian counter and it’s service for the most pushy and loudest, and it reflects on the streets.

Most of the mess could be curbed with strict rule enforcement but in India, everybody’s innocent and the one with the meekest voice or without any ass-saving names to throw around (police officers, politicians, media connections) are the culprits (mostly middle class). By the way, all those 1.3Lakh people dying on India’s roads forgot to hang lemons.

Posted in Country Affairs | Leave a comment