Upload a Python Function to AWS Lambda

Following on the previous post, in this blog post, I will show you how to upload a Python function to AWS Lambda and run it.

AWS Lambda

AWS flagship serverless offering of AWS comes down to Lambda which acts as the engine and platform where we upload or run our code on.

The main requirement that is very important in Lambda is that our code needs to write in the form of a function, that’s it.

Once we have the function running in our environment, we just need to copy it or upload it and link it to the handler (very simple as you will see soon).

Get Started

To get started, I will first create a Python function using the same steps I have shown you in the previous article.

On my computer, I have my python function as you can see below.

In order to upload it to AWS, I will need to zip it first.

From the Lambda page, I will use the upload option from the Code entry type dropbox as shown below.

As explained in the previous post, I will need to rename the function handler to match the file name and function name.

Below, you can see the correct names.

This is the correct handler name.

The final test will be configuring the test event, as shown below and running the test.

As shown below, the test worked.

Processing…
Success! You're on the list.

Posted

in

,

by