From 36f7625cee795cf7ed87b818a5374556b9aeb5b7 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Tue, 4 Jul 2023 20:10:57 +1000 Subject: [PATCH] Merge AWS Lambda installation documentation into official docs --- aws/lambda/README.md | 48 --------------- .../docs/ifcopenshell-python/installation.rst | 60 ++++++++++++++++--- 2 files changed, 53 insertions(+), 55 deletions(-) delete mode 100644 aws/lambda/README.md diff --git a/aws/lambda/README.md b/aws/lambda/README.md deleted file mode 100644 index 0ba5a80273..0000000000 --- a/aws/lambda/README.md +++ /dev/null @@ -1,48 +0,0 @@ -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. - -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 ---------------- - -1. **Clone this repository to your local machine:** - -2. **Customize the Lambda function code:** - - - 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. - -3. **Install the required Python packages:** - - Edit the `requirements.txt` file and add any additional dependencies required by your Lambda function. - -4. **Build the Docker image:** - - ```shell - $ docker build -t lambda-ifcopenshell . - ``` - -5. **Run the Docker container:** - - ```shell - $ docker run lambda-ifcopenshell - ``` -6. **Test lambda locally** - - Follow the steps in this [guide](https://docs.aws.amazon.com/lambda/latest/dg/images-test.html) - - -7. **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 - - ---------- -> 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). \ No newline at end of file diff --git a/src/ifcopenshell-python/docs/ifcopenshell-python/installation.rst b/src/ifcopenshell-python/docs/ifcopenshell-python/installation.rst index 4708290f45..fee93ff178 100644 --- a/src/ifcopenshell-python/docs/ifcopenshell-python/installation.rst +++ b/src/ifcopenshell-python/docs/ifcopenshell-python/installation.rst @@ -7,9 +7,10 @@ There are different methods of installation, depending on your situation. 2. **PyPI** is recommended for developers using Pip. 3. **Conda** is recommended for developers using Anaconda. 4. **Docker** is recommended for developers using Docker. -5. **Using the BlenderBIM Add-on** is recommended for non-developers wanting a graphical interface. -6. **From source with precompiled binaries** is recommended for developers actively working with the Python code. -7. **Compiling from source** is recommended for developers actively working with the C++ core. +5. **AWS Lambda** is recommended for developers using AWS Lambda functions. +6. **Using the BlenderBIM Add-on** is recommended for non-developers wanting a graphical interface. +7. **From source with precompiled binaries** is recommended for developers actively working with the Python code. +8. **Compiling from source** is recommended for developers actively working with the C++ core. Pre-built packages ------------------ @@ -130,11 +131,56 @@ Docker Installing IfcOpenShell from Docker will also install IfcConvert. -.. using-container-on-aws-lambda:: +AWS Lambda +---------- - Refer `AWS Lambda - Readme - `__. +This guide provides a Dockerfile and sample code to help you run an AWS Lambda +function written in Python and using the IfcOpenShell library. + +This is only 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 +Gateways, etc. + +.. seealso:: + + For more information on building lambda containers refer to the `AWS guide + on working with Lambda container images + `__ + +1. Clone or download the `IfcOpenShell repository + `_. + +2. Replace the sample Lambda function code in the `example_handler + `__ + directory with your own code. + +3. Update the import path in the Dockerfile's `CMD instruction + `__ + to match your Lambda function's handler function. + +4. Edit the `requirements.txt + `__ + file and add any additional dependencies required by your Lambda function. + +5. Build the Docker image: + + .. code-block:: + + $ docker build -t lambda-ifcopenshell . + +6. Run the Docker container: + + .. code-block:: + + $ docker run lambda-ifcopenshell + +7. Test lambda locally by following the `AWS guide on testing Lambda container + images locally + `__. + +8. Deploy to lambda. This is beyond the scope of this guide. Please refer to + the AWS documentation. Some tools that could be useful are AWS + CloudFormaton, AWS CDK, pulumi or terraform. Using the BlenderBIM Add-on ---------------------------