1.6 KiB
Dockerized AWS Lambda Function with Python and IfcOpenShell
This guide provides a Dockerfile and sample code to help you run an AWS Lambda function written in Python and utilizing IfcOpenShell library.
Note: This is a superficial guideline, in order to make this work for your usecase you will need a good understanding of other AWS services like SQS, S3, API Gateway etc.
Prerequisites
Make sure you have Docker installed on your machine. You can download Docker from the official website: Docker Instalation
Getting Started
-
Clone this repository to your local machine:
-
Customize the Lambda function code:
- Replace the sample Lambda function code in the
example_handlerdirectory with your own code. - Update the import path in the Dockerfile's
CMDinstruction to match your Lambda function's handler function.
- Replace the sample Lambda function code in the
-
Install the required Python packages:
- Edit the
requirements.txtfile and add any additional dependencies required by your Lambda function.
- Edit the
-
Build the Docker image:
$ docker build -t lambda-ifcopenshell . -
Run the Docker container:
$ docker run lambda-ifcopenshell -
Test lambda locally
Follow the steps in this guide
-
Deploy to lambda
This is beyond the scope of this example. Please refer to AWS documentation. Some tools that could be useful are - AWS CloudFormaton, AWS CDK, pulumi or terraform