Files
IfcOpenShell/aws/lambda/README.md
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

48 lines
1.8 KiB
Markdown
Raw Normal View History

2023-06-10 22:49:54 +02:00
Dockerized AWS Lambda Function with Python and IfcOpenShell
===========================================================
2023-06-11 10:26:06 +02:00
This guide provides a Dockerfile and sample code to help you run an AWS Lambda function written in Python and utilizing IfcOpenShell library.
2023-06-10 22:49:54 +02:00
Prerequisites
-------------
Make sure you have Docker installed on your machine. You can download Docker from the official website: [Docker Instalation](https://docs.docker.com/engine/install/)
Getting Started
---------------
2023-06-11 10:26:06 +02:00
1. **Clone this repository to your local machine:**
2023-06-10 22:49:54 +02:00
2023-06-11 10:26:06 +02:00
2. **Customize the Lambda function code:**
2023-06-10 22:49:54 +02:00
- Replace the sample Lambda function code in the `example_handler` directory with your own code.
- Update the import path in the Dockerfile's `CMD` instruction to match your Lambda function's handler function.
2023-06-11 10:26:06 +02:00
3. **Install the required Python packages:**
2023-06-10 22:49:54 +02:00
- Edit the `requirements.txt` file and add any additional dependencies required by your Lambda function.
2023-06-11 10:26:06 +02:00
4. **Build the Docker image:**
2023-06-10 22:49:54 +02:00
```shell
$ docker build -t lambda-ifcopenshell .
```
2023-06-11 10:26:06 +02:00
5. **Run the Docker container:**
2023-06-10 22:49:54 +02:00
```shell
$ docker run lambda-ifcopenshell
```
2023-06-11 10:26:06 +02:00
6. **Test lambda locally**
Follow the steps in this [guide](https://docs.aws.amazon.com/lambda/latest/dg/images-test.html)
2023-06-10 22:49:54 +02:00
2023-06-11 10:26:06 +02:00
7. **Deploy to lambda**
2023-06-10 22:49:54 +02:00
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
2023-06-11 11:23:45 +02:00
---------
> Note: This is a superficial guide, 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.
For more information on building lambda containers refer to this [guide](https://docs.aws.amazon.com/lambda/latest/dg/images-create.html).