AWS Lambda certification guide and questions

AWS Lambda Certification Guide & Questions

Ok, so this is one of my favourite topics to writer about. As I think it could quite possibly be the future of writing large scale applications based in the cloud. Lambda is Amazons implementation of cloud functions. If you’re reading this article then there’s a good chance you’ll already have an understanding of what a cloud function is. But just incase you don’t we’ll cover the basics in the article as well.

So without delay welcome to part 13 of a multiple part course on passing your AWS Architect, Developer & Sysops Associate exams. The best part…this course is totally free of charge!

In this article we’ll review all you need to know about Lambda (cloud functions) for the exams

The article will take just 5 minutes to read and after doing so you’ll have all you need to know to answer any Lambda questions to pass the AWS certifications.

Who should read this?

If you are studying for the:

  • AWS Associate Architect
  • AWS Associate Developer
  • AWS Associate SysOps

Or you are using AWS and want to learn more about Lambda then this is the article for you.

Contents:

  • AWS Lambda learnings for the AWS certifications
  • AWS Lambda mock exam questions

OK let’s dive in…

The History of Serverless?

Ok, so you might be asking yourself “What exactly is Serverless and where does Lambda fit in?”

To answer this question let’s take a quick trip down software development memory lane….

In the beginning  there was code!

Developers write code which is ran on computer hardware. Originally companies would house and and maintain their hardware themselves. This lead to many problems, like ensuring servers ran 24/7 without interruption and over provisioning the hardware they ran to cater for times of peak demand (for instance on an eCommerce site when a sale is on, which results in increased traffic)

This methodology proved problematic since now companies would have to employ additional staff to run their ever increasing IT infrastructure. Not to mention the increased electricity bill!

Enter the data centre

To fill this gap, data centres emerged. These companies ran and maintained server farms which they then rented out their capacity to companies/individuals who wanted to run their software but didn’t have the desire to host hardware on their own premises.

This approach solved a bunch of problems and allowed software development houses the ability to focus more on what they did best…write software!

However even this approach had its shortcoming. The first of which was that there was still a significant lead time for commissioning new hardware. For instance let’s say your company needs 3 new servers in preparation for a new product launch. Typically there could be a lead time stretching into several days. Sure this might not be a problem in most cases but it ultimately it slows down the development process.

IT infrastructure providers were slow to react to this and thats where AWS steps in….

Infrastructure as a service is born (IAAS)

In 2006 amazon introduced EC2 (elastic cloud compute). This made it possible for developers to provision hardware programatically over command line. Suddenly there was no lead times to getting hardware to support your business. It was just a few commands and you’d have a new virtual machine ready and waiting.

This was great for a while, but developers soon realised that even with this new innovative way of allocating hardware you still had the same problems you would with any normal server. Such as OS patches and security updates.

AWS and other providers recognised this and took infrastructure as a service to its next logical progression.

Platform as a service (PAAS)

PAAS adds another lay of abstraction over IAAS by allowing developers to simply upload their projects to the cloud. Things like OS patches and security are now handled by AWS. This simplified even further the development process since developers could focus almost exclusively on the code they were writing.

However even with this lay of abstraction, there’s still drawbacks. For instance, you’re still paying for a server to be running 24/7! And what happens when you want to scale your application during peak loads. In the past, load balancers and more recently containers attempt to solve this problem. However that adds further complexity to your projects architecture.

Wouldn’t it be great if you didn’t have to worry about any of these things!?

What are cloud functions?

Cloud functions emerged to fill this need. Essentially now all a developer needs do is write a function and upload it to the cloud. No virtual machines or PAAS solutions are required. The entire process is handled including uptime and scalability is handled by the cloud provider. Amazon pioneered this concept with their solution Lambda.

Enter AWS Lambda (Cloud Functions)

aws lambda icon

AWS Lambda gives developers the ability to execute code in a variety of programming languages (which you are expected to remember for the AWS certifications) without having to worry about where and how the code is executed. Lambda will scale automatically depending on load at any one time.

It also means that you are ONLY charged for when the lambda function is invoked. Meaning that you pay for what you use and nothing more. This improves on the previous iterations of hosting and running software where you would be billed regardless of if you were making use of the service or not.

What’s happening under the hood?

Essentially Lambda is detecting when a request is made, launching a VM and then executing the function. All within a fraction of a second. Don’t worry if this doesn’t make too much sense. We’ll go into more detail later on.

What do I need to know about Lambda?

Ok now we understand a little about the history of serverless and the process that lead to it’s creation. Let’s take a closer look at what parts of Lambda we need to know for the Architect Associate exam and the Developer Associate exam.

The first thing to note is that Lambda did not make itself onto the exams until fairly recently, however it’s now definitely on the exams and you will have to answer questions around it.

In quick summary here’s the bullet points to remember for the AWS certification exams:

  • Understand the different types of triggers for Lambda functions
  • Remember the different programming languages supported by AWS Lambda
  • Be able to create a Lambda function in the AWS management console
  • Configure triggers on your Lambda function
  • Be able to link your Lambda function to an API gateway trigger
  • Understand the pricing structure for AWS Lambda
  • 5 minute limit on function executions
  • Lambda functions can trigger other lambda functions (forming chains)
  • Remember which AWS services can trigger lambda.
  • Understand which services are not serverless (for instance EC2)

Programming languages supported by AWS Lambda

Lambda currently supports Java, NodeJs, Python, Go, .Net & Ruby. Note that Lambda does support multiple versions of these languages, however you are unlikely to need to remember them for the exam.

which languages does aws lambda support?

which languages does aws lambda support?

AWS Lambda Triggers

Triggers can be either existing AWS services or HTTP requests via API Gateway. As part of the exam, you’ll be expected to remember which AWS services are compatible with Lambda.

aws lambda triggers

aws lambda triggers

Creating your first Lambda trigger is LESS than 3 minutes

If this all sounds a bit complicated, don’t worry! Once you go through the steps in creating a simple lambda function it will start to make more sense. So let’s go ahead and create a simple lambda function that returns the phrase:

"Hello from Lambda!"

Whenever a call is made to an API gateway HTTP endpoint.

Step 1: Enter the Lambda portal

Step 2: Name the function and select the run time

 

Step 3: Reviewing the function

At this point, lambda has generated a template set of code for our function. Note that we can edit this function within the lambda function portal. However this feature is not available for all of the languages that lambda supports. Let’s take a look at the generated code:

Here we can see a simple 8 line function that returns a response containing the body message “Hello from Lambda!”. Pretty simple!

Step 4: Attaching API Gateway to our function

Select the API gateway trigger to display the configuration tile. Once there, select the “Create a New API” option from the drop down list.

From the security dropdown, select “Open” – This will mean the API can be accessed by anyone. No security is enabled.

Finally click the “Add” button.

You’ll then see something similar to the following screen shot.

You can see that there is a summary of the newly created API Gateway endpoint and a handy link that if you click…..

Hay presto, you’ve created your first Lambda function exposed via a API Gateway endpoint.

Lambda will provide you with a helpful summary diagram of the triggers, functions and logging that goes into building up your cloud function.

Conclusion and Exam Questions

This post should be enough to give you the basics of how to put together a simple Lambda function. You should also have an idea of the history of Lambda and the past technologies and processes that led to its creation. And finally you should start to have a sense of what types of questions regarding lambda will be asked in the exam.

Following on from that, our next post will be a series of mock exam questions, focussing exclusively on AWS Lambda. I’m going to try something a little new with this post by making it a little more interactive. So let me what you think!

Click here for Lambda certification mock exam questions

Leave a Comment