Amazon Lambda Function — Code Download
First post on Medium so bare with me :)
As many of the fellow Developers I got an offer from a bigger company and I had to give a one month notice to my current one.
This meant that I had to go through a month of explaining my job to my fellow colleagues. As my current company’s backend infrastructure is hosted on Amazon AWS, we made use of the Lambda Function utility for an Image Resizing task.
So I had to also explain this Function’s task, but I could not retrieve the code from my Mac or my TimeMachine HDD.
The file was also large, so I could not edit it inline through the Lambda console as well. My last hope was that I could download it somehow. Tried using the “Download Function code” entry, but had no luck. The downloaded file had my Function’s main file name as a prefix and a suffix that looked like a hash.
My OS (Mac OSX — El Capitan) tried to open it like a .txt file with TextEdit and had no luck, as the TextEdit was complaining for a corrupt file or something.
That did not fit well for me, so I tried to open it with Sublime 2, cause I could not believe that Amazon would ever serve me a corrupt file. Sublime 2 was of no help either. The file opened but it was like a Hex viewer, if you have ever played with one. After that my only hope was Google Search. Ended up making me more hopeless and desperate :(
Luckily, an idea came to my head and thought giving it a try. I just had to add the “.zip” extension at the end of the file.
There I got it. A fully functional “.zip” file. Double clicked it and got my original “.zip” file containing my Node.JS modules and my main file for the Image Resizing task.
So, lesson learned. Most of the times, problems that seem to be hard and difficult to tackle, might require a stupid simple solution :)
P.S.: Another lesson learned, is that if you do not have your stuff backed up one three places at least, you do not have it backed up at all :)