Merge AWS Lambda installation documentation into official docs

This commit is contained in:
Dion Moult
2023-07-04 20:10:57 +10:00
parent ee82714423
commit 36f7625cee
2 changed files with 53 additions and 55 deletions
-48
View File
@@ -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).
@@ -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
<https://github.com/IfcOpenShell/IfcOpenShell/blob/v0.7.0/aws/lambda/README.md>`__.
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
<https://docs.aws.amazon.com/lambda/latest/dg/images-create.html>`__
1. Clone or download the `IfcOpenShell repository
<https://github.com/ifcopenshell/ifcopenshell>`_.
2. Replace the sample Lambda function code in the `example_handler
<https://github.com/IfcOpenShell/IfcOpenShell/blob/v0.7.0/aws/lambda/example_handler/__init__.py>`__
directory with your own code.
3. Update the import path in the Dockerfile's `CMD instruction
<https://github.com/IfcOpenShell/IfcOpenShell/blob/v0.7.0/aws/lambda/Dockerfile#L40>`__
to match your Lambda function's handler function.
4. Edit the `requirements.txt
<https://github.com/IfcOpenShell/IfcOpenShell/blob/v0.7.0/aws/lambda/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
<https://docs.aws.amazon.com/lambda/latest/dg/images-test.html>`__.
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
---------------------------