AWS Lambda executor setup

configuration of Amazon Web Services Lambda executor

Yoda uses an external executor to resolve requests to data sources. Currently, it supports AWS Lambda (through REST interface). In future releases, yoda will support more executors and allow you to specify multiple executors to add redundancy.

In your AWS account, go to AWS Lambda page, and select 'create function'

Select Author from Scratch

Choose your Function name It will be your endpoint route.

Set Runtime to Python 3.7

For permission, if you don't have an existing role, create a new one.

Once the function has been created, you will want to uploas the oracle executor runtime source code zip.

In the upper right cornee of the "Source Code" window, click on "Upload from" and select "zip file".

After uploading the runtime zip, the rest of the function needs to be configured.

Here is what the settings page looks like when setting or editing basic settings;

Use 512Mb, and a role should've been created when the function was created. Set the timeout to 12 seconds, and optionally add a description. Next we will move on to adding the environment variables.

Add the following environment variables to the function instance;

MAX_EXECUTABLE to 8192

MAX_DATA_SIZE to 256

Next you will need to add a trigger. Use the following settings;

After creating the API trigger using the wizard, you will need to copy the API endpoint URL. This will be neesed to test the AWS executor as well as for yoda configuration, to move forward as an oracle validator.

Your lambda executor can now be tested with curl, using the following command;

curl --location --request POST '<your_api_endpoint>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "executable": "IyEvdXNyL2Jpbi9lbnYgcHl0aG9uMwoKaW1wb3J0IHN5cwoKZGVmIG1haW4oZGF0YSk6CiAgICByZXR1cm4gZGF0YQoKCmlmIF9fbmFtZV9fID09ICJfX21haW5fXyI6CiAgICB0cnk6CiAgICAgICAgcHJpbnQobWFpbigqc3lzLmFyZ3ZbMTpdKSkKICAgIGV4Y2VwdCBFeGNlcHRpb24gYXMgZToKICAgICAgICBwcmludChzdHIoZSksIGZpbGU9c3lzLnN0ZGVycikKICAgICAgICBzeXMuZXhpdCgxKQo=",
        "calldata": "\"Hello lambda\"",
            "timeout": 3000
            }'

Of course you will need to <your_api_endpoint> with the API endpoint URL of your own specific instance.

If everything has been configured correctly, the expected result of the test command consists of this output;

{
     "returncode": 0,
     "stdout": "Hello lambda\n",
     "stderr": "",
     "error": "",
     "version": "lambda:1.1.2"
 }                         

Last updated