Skip to content
This repository was archived by the owner on May 13, 2021. It is now read-only.
This repository was archived by the owner on May 13, 2021. It is now read-only.

transit-vpc-push-cisco-config.zip packaged on OS X fails to run in Lambda #28

@lucymhdavies

Description

@lucymhdavies

Running the ./build-s3-dist.sh build script on macOS directly results in errors of the form:

Unable to import module 'transit_vpc_push_cisco_config/lambda_function': /var/task/bcrypt/_bcrypt.so: invalid ELF header

This seems to be because paramiko uses C wrappers for low level crypto functions, and the versions of these available on macOS do not run on Linux (and thus the lambda function does not run).

My solution to this was to build the function inside a docker container:

$ cat Dockerfile
# Docker image to build the lambda function
FROM python:2.7

RUN apt-get update && \
    apt-get install zip -y && \
    pip install --upgrade pip && \
    pip install --upgrade setuptools && \
    pip install --upgrade virtualenv

ENTRYPOINT ["/bin/bash", "-c"]

# Run with:
# docker build -t build-lambda . && docker run -it --rm -v $PWD:/tmp/workspace -w /tmp/workspace/deployment build-lambda ./build-s3-dist.sh bucket-name-here

I have a Makefile in my fork of the repo which runs this, if it's worth a pull request.
Either way, something in the README for how to build on OS X would be useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions