Conjuring Code: Casting Your First AWS Lambda Spell (Part II of series: Lambda Lessons: Unlocking Serverless Computing)

Hey there! ๐ I'm Hardeep Jethwani (HJ), your resident cloud aficionado and code maestro, proudly navigating the ever-changing seas of AWS Cloud and Full Stack Development for ~5 glorious years and counting. โ๏ธ๐ป
Currently, I'm orchestrating the tech symphony as part of Team HSBC Bank, where I'm on a mission to enhance the banking experience through the magic of technology. ๐๐ผ
In my past life at Capgemini, I led exciting adventures like migrating critical applications to the cloud (18 and counting!). I had databases waltzing into the AWS Cloud, sprinkling a bit of containerization magic along the way. AWS managed services like RDS, Lambda, ECS, and friends? They were my trusty sidekicks. ๐ฉ๐ง
When not automating deployments with CI/CD finesse (think AWS CodePipeline, CodeBuild, and CodeDeploy), you might find me designing infrastructure like a digital architect using AWS CloudFormation. Security is my jam โ I've got WAF, Security Groups, MFA, Cognito, and even a secret club in private subnets to keep things safe. ๐๐โโ๏ธ
On top of all that, I'm on a mission to reduce carbon footprints because, why not? HSBC's commitment to sustainability is my heart and soul. We're going for NET ZERO carbon footprint, and I'm leading the charge, one container at a time! ๐๐ฑ
And yes, the fun doesn't stop at work. In my past life at Tata Consultancy Services, I co-created a multi-tier Point of Sale application with a global footprint, touching the lives of billions. My automation tools were so efficient that even Father Time was left scratching his head. โณ๐ก
If you're in need of a cloud-savvy comedian or a code deployment magician, look no further. Let's chat about tech, swap automation tales, or share some coding humor over a virtual coffee. Oh, and don't worry; I promise not to write code in my sleep (well, most of the time). Cheers to cloud adventures! โ๐
Welcome back to our whimsical journey through the clouds in the Blog series "Lambda Lessons: Unlocking Serverless Computing". If you missed our initial foray into the magic of serverless computing, where we turned mere mortals into cloud wizards, check out Part-I. Now, buckle up as we dive into part 2, where we'll be casting our very first AWS Lambda spell (function).
The Adventure Continues: Your First AWS Lambda Function
So, you've decided to join the ranks of cloud sorcerers with AWS Lambda. Let's create something magical, shall we?
Step 1: The Summoning (Signing Up for AWS)
If you haven't already joined the AWS coven, it's time to sign up. Navigate to the AWS Management Console and pledge your allegiance. As a newcomer, you'll be granted access to the AWS Free Tier, which is like the cloud's version of a free trial potion.
Step 2: Entering the Secret Chamber (Navigating to the AWS Lambda Console)
Once you've crossed the threshold into the AWS realm:
Seek out โServicesโ in the top menu, as if looking for a hidden spellbook.
Click on โLambdaโ under โComputeโ or you can directly search for "Lambda" in the search boxโ it's not guarded by a dragon, fortunately.

Step 3: The Incantation Begins (Creating a New Lambda Function)
Here, in the Lambda console:
- Hit โCreate functionโ like you're summoning a familiar.

Opt for โAuthor from scratchโ because original spells are more potent.
Give your function a mystical name, like โMyFirstLambdaSpell.โ
Choose a runtime; AWS Lambda is multilingual, from the ancient tongues of Node.js to the runes of Python. Here in this blog, I have made use of Node.JS runtime. You can choose runtime according to your needs.

Step 4: Bestowing Powers (Set Up Permissions)
Even wizards need permissions:
Choose โCreate a new role with basic Lambda permissionsโ unless you've already conjured one before.
This role is like your function's magical amulet, granting it the power to perform tasks, like writing logs to Amazon CloudWatch.
Click on create function.

Step 5: The Spellcraft (Writing Your Function Code)
Now, for the heart of the spell:
In the โFunction codeโ section, an editor awaits your incantations.
For a simple charm, let's write a function that echoes โHello, Worldโ from the ethers.

Example in Node.js:
export const handler = async (event) => {
console.log("Hello, World from Lambda!");
return "Hello, World";
};
- Don't miss packing your potion by hitting on the "Deploy" button
Step 6: Testing the Lambda Function (Configure Your Test Event)
Before unleashing your spell:
- Hit โTestโ to create a test event. The default potion (test request content) recipe should be sufficient, as we are not using any of the parameters in our Lambda function as of now.

- Name your test Event, something like โtestEventโ (you can name anything as per your convenience) and save it.

Step 7: Releasing the Magic (Testing Your Lambda Function)
With your potion ready, click โTestโ once more.
If the stars align and your console returns โHello, World,โ your spell has worked!

Step 8: Beyond the Veil (Explore More)
You've taken your first step into a larger world:
Experiment with different spells and incantations.
Consider binding your Lambda spell to other mystical AWS services.
A New Dawn
You've just scratched the surface of your potential as a cloud wizard. As you grow more comfortable with AWS Lambda, the realm of serverless computing will open up to you in ways you've never imagined. Keep experimenting, learning, and, most importantly, casting.
Stay tuned for the next chapter in our "Lambda Lessons" series, where we'll delve deeper into the arcane arts of AWS Lambda. Together, we'll uncover secrets that will make even the most seasoned sorcerers raise an eyebrow.
Thank you for being a part of this adventure. Until next time, happy cloud computing!!
If you have any questions, ideas, or experiences you'd like to share, I'm all ears. Let's keep the conversation going in the comments section below. And remember, this is just the beginning; there's a world of innovation waiting for you in the cloud. Stay curious, keep exploring, and keep making technology work for you. Follow me on social media, where I promise to share cloud wisdom with a side of chuckles:
LinkedIn: Connect with me on LinkedIn, where my cloud prowess is only rivalled by my talent for finding the perfect GIF for every situation. ๐๐ผ hardeepjethwani@LinkedIn
TopMate: Looking for a fellow cloud aficionado to share a virtual coffee with or brainstorm your next AWS masterpiece? Find me on TopMate! Because let's face it, cloud enthusiasts need to stick together. โ๐ค hardeepjethwani@topmate
Instagram: For behind-the-scenes glimpses of my cloud adventures and occasional 'AWS Gone Wild' stories that even AWS engineers find amusing. ๐ธ๐ฉ๏ธ hardeepjethwani@Instagram
X: Join the cloud conversation on Twitter, where I drop cloud knowledge and quirky cloud memes faster than you can say 'Elastic Beanstalk.' ๐ฆโ๏ธ hardeepjethwani@X
So, whether you're seeking cloud advice, a good laugh, or simply a friendly chat about cloud and coffee preferences, I'm just a click away on these cloud-tastic platforms. See you in the cloudisphere, fellow cloud builders! ๐โ๏ธ๐
Want to support my cloud adventures and keep the coffee flowing? Feel free to buy me a virtual coffee. After all, coffee is the secret sauce behind every successful cloud deployment. โ๐
#AWSLambda #ServerlessComputing #CloudComputing #TechTutorial, #ServerlessArchitecture #AWS #CloudTechnology #DevOps #Programming #SoftwareDevelopment






