diff --git a/aws/lambda/Dockerfile b/aws/lambda/Dockerfile index 5340c675d3..9716f1dc84 100644 --- a/aws/lambda/Dockerfile +++ b/aws/lambda/Dockerfile @@ -37,4 +37,4 @@ ENTRYPOINT [ "/usr/local/bin/python", "-m", "awslambdaric" ] # Set the Python import path to the Lambda function handler # This path is relative to the root of the Lambda function code (FUNCTION_DIR) # Lambda invocation will look for this path -CMD ["example_handler.extract_wall_psets"] +CMD ["example_handler.extract_wall_psets_handler"] diff --git a/aws/lambda/example_handler/__init__.py b/aws/lambda/example_handler/__init__.py index 5796334cf3..5256cb90a2 100644 --- a/aws/lambda/example_handler/__init__.py +++ b/aws/lambda/example_handler/__init__.py @@ -2,16 +2,16 @@ import ifcopenshell import ifcopenshell.util.element import boto3 -s3 = boto3.resource('s3') +s3 = boto3.client('s3') -def handler(event, context): +def extract_wall_psets_handler(event, context): print("Hello from lambda") print("Event: {}".format(event)) print("Context: {}".format(context)) filename = event['body']['filename'] - s3.Bucket('my_ifc_files').download_file(filename, f'/tmp/{filename}') + s3.download_file('my_ifc_files_bucket', filename, f'/tmp/{filename}') ifc_file = ifcopenshell.open(f'/tmp/{filename}') walls = ifc_file.by_type('IfcWall')