Skip to main content

Manage AWS Lambda functions using a Simiotics Function Registry

Project description

lambada

Manage AWS Lambda functions using a Simiotics Function Registry

Install

pip install -U simiotics-lambada

Use

This section lets you try out lambada using our example hello function.

First, export your SIMIOTICS_FUNCTION_REGISTRY environment variable. This tells lambada which Simiotics Function Registry to work with. If you do not have a private Simiotics account, you can use our free, public, and totally open registry:

export SIMIOTICS_FUNCTION_REGISTRY=registry-alpha.simiotics.com:7011

Make sure that your AWS credentials are available either by exporting AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY or by ensuring that the profile you want to use is default in your AWS credentials file, or by exporting AWS_PROFILE. If you are not familiar with AWS authentication, you can read more here: https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html

Decide on a key under which you would like to register the hello function into the Simiotics Function Registry. For example:

HELLO_KEY=hello-$(date -u +%s)

Register the function against the Simiotics Function Registry using lambada:

lambada register --key $HELLO_KEY \
    --code examples/hello/hello.py \
    --handler hello \
    --requirements examples/hello/requirements.txt

Check that the function was successfully registered (if the output of the following command is empty, there is a problem):

lambada list | grep "$HELLO_KEY"

Create an AWS IAM role capable of executing the hello function and logging to CloudWatch:

lambada create_role --key $HELLO_KEY --name iam-lambada-demo

Deploy the function as an AWS Lambda:

lambada deploy --key $HELLO_KEY --name lambda-lambada-demo

This should return an AWS Lambda ARN of the form:

arn:aws:lambda:<REGION>:<PROJECT ID>:function:lambda-lambada-demo

Now you can invoke the deployed Lambda using the AWS command-line interface:

OUTFILE=$(mktemp)
aws lambda invoke --function-name lambda-lambada-demo \
    --payload '{"target": "Sophia"}' \
    $OUTFILE
cat $OUTFILE
rm $OUTFILE

To take down the AWS Lambda:

lambada down --key $HELLO_KEY

This only removes the AWS Lambda. It doesn't delete the IAM role. If you would like to get rid of that, as well:

lambada down --key $HELLO_KEY --teardown

Kick back, enjoy some smooth tunes, and let the Lambdas proliferate.

Support

If you experience any problems with this tool, please add an issue on this repository.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simiotics-lambada-0.2.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

simiotics_lambada-0.2.0-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file simiotics-lambada-0.2.0.tar.gz.

File metadata

  • Download URL: simiotics-lambada-0.2.0.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.1

File hashes

Hashes for simiotics-lambada-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ac28b03fd0270151103fe4ae308801d3754ad89996733bb97ec2dcc062ed5830
MD5 68dc7645c27960ac35ae43a8c3f73b23
BLAKE2b-256 371439856b2af5ceb891182b2a8dbd66508aafbba21753cac582e92a0bf2ea88

See more details on using hashes here.

File details

Details for the file simiotics_lambada-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: simiotics_lambada-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.1

File hashes

Hashes for simiotics_lambada-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0cc1cb6dd373eb2f7dd1622b2953a396b7e052c9a3c7bc2e6cbb005706880527
MD5 f27d9a3767a7d783008f84bce2ba4162
BLAKE2b-256 2c01ab17d2fccadbaad7619bfc1cb1995e858cd0ff65306300c99072a2c2d38e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page