Voiced by Amazon Polly |
Overview
Sometimes we get stuck in deploying the packages in the Lambda function. Here is the simple way to do it without the need for CLI.
Now, let’s have a simple python code where we want to deploy the Pandas package in the Lambda function, but we got an error.
- We have a simple code where we import pandas.
- Now test this code so we get the output with an error because we have no pandas package inside the lambda function.
You just have to follow some simple steps, let’s get started.
Customized Cloud Solutions to Drive your Business Success
- Cloud Migration
- Devops
- AIML & IoT
Step-by-Step Guide
STEP 1 – Download wheel files from PyPI.org
- Download the wheel file from the org website . We are now deploying pandas so we download the pandas wheel file from the given website.
- pandas – This is our main file for the package.
- Now click on save to download this file.
STEP 2 – Unzip the wheel file and make a python zip file
- This is the most important step because we have to unzip the file and we have two ways to do it.
- One is by installing the wheel package in your python library and unzipping the wheel file with the python “unpack” command. (unpack + “file name”)
- But if you are not comfortable with the above way then, the second way is very simple you just have to unpack it through an online website. You will not use CLI here. It is suggested that using the website Extract WHL Files Online – ezyZip extract wheel files.
Here, you must click on “Select whl file to open” to upload your wheel file.
- After uploading your wheel file, you have to click on the “Save all” option to unzip that wheel file in a specific folder.
- You have to make a new combined folder (PYTHON PACKAGE) where all the data of the wheel file is stored After that you have to zip the file as shown below.
- Finally, you have the Python package zip file. Here we end with Step 2.
- Finally, you have the Python package zip file. Here we end with Step 2.
STEP 3 – Create a layer and attach it to the lambda function
- We are in the final step so now go to the Lambda function where you find the layer option.
- Create a layer.
- Your layer is successfully created. You can see it in the below image
- Go to your lambda function, scroll down and you will find the Layers option where you have to add a layer in it.
- Click on the AWS layer and choose the layers.
- Select “AWSDataWrangler-Python3.9” for the Lambda layer and select the layer version and click on ADD.
- Finally, you have added both layers successfully.
- Everything is perfectly set up. So, without wasting any time let’s “Test” our python code of the Lambda function.
Hurray! It works! so by these few steps, you can easily deploy any package in the lambda function without any issue. I hope you find it easy.
Conclusion
Lambda layers are an integral tool to use whenever you are developing a Lambda function that uses a third-party Python package. If AWS maintains a pre-built layer that satisfies your needs, it’s the best option to use that layer. I spent more time on this and found this is an easy way to deploy packages in lambda in a simple way. This is a good way to deploy packages if we did not want to use the CLI method.
Get your new hires billable within 1-60 days. Experience our Capability Development Framework today.
- Cloud Training
- Customized Training
- Experiential Learning
About CloudThat
CloudThat is a leading provider of Cloud Training and Consulting services with a global presence in India, the USA, Asia, Europe, and Africa. Specializing in AWS, Microsoft Azure, GCP, VMware, Databricks, and more, the company serves mid-market and enterprise clients, offering comprehensive expertise in Cloud Migration, Data Platforms, DevOps, IoT, AI/ML, and more.
CloudThat is the first Indian Company to win the prestigious Microsoft Partner 2024 Award and is recognized as a top-tier partner with AWS and Microsoft, including the prestigious ‘Think Big’ partner award from AWS and the Microsoft Superstars FY 2023 award in Asia & India. Having trained 850k+ professionals in 600+ cloud certifications and completed 500+ consulting projects globally, CloudThat is an official AWS Advanced Consulting Partner, Microsoft Gold Partner, AWS Training Partner, AWS Migration Partner, AWS Data and Analytics Partner, AWS DevOps Competency Partner, AWS GenAI Competency Partner, Amazon QuickSight Service Delivery Partner, Amazon EKS Service Delivery Partner, AWS Microsoft Workload Partners, Amazon EC2 Service Delivery Partner, Amazon ECS Service Delivery Partner, AWS Glue Service Delivery Partner, Amazon Redshift Service Delivery Partner, AWS Control Tower Service Delivery Partner, AWS WAF Service Delivery Partner, Amazon CloudFront Service Delivery Partner, Amazon OpenSearch Service Delivery Partner, AWS DMS Service Delivery Partner, AWS Systems Manager Service Delivery Partner, Amazon RDS Service Delivery Partner, AWS CloudFormation Service Delivery Partner, AWS Config, Amazon EMR and many more.
FAQs
1. Can we create custom layer without extracting wheel file?
ANS: – No, you must extract the wheel file otherwise you will not get the output.
2. Is it necessary to choose AWS layer?
ANS: – Yes, it every step is necessary and also be sure to choose latest version of AWS layer.
3. What are Wheel files?
ANS: – A WHL file is a package saved in wheel format, which is the standard built-in package format used for Python distribution. It contains all the files for python installation and metadata, including the version of wheel implementation and specification used to package it.

WRITTEN BY Mohd Monish
Monish is working as a Research Associate at CloudThat. He has a working knowledge of multiple different cloud platforms and is currently working on the AWS platform and working on WAR automation, and AWS Media Services. He is interested in research and publishing tech blogs and also exploring new technologies.
Comments