-
Notifications
You must be signed in to change notification settings - Fork 7
Setup Yoda Executor Using AWS Lambda
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 click Create function.
Follow the following steps:
- Select Author from Scratch
- Choose your Function name It will be your endpoint route.
- Set Runtime to
Python 3.9
- Set Architecture to
x86_64
- For permission, if you don't have an existing role, create a new one. We recommend using the role with basic Lambda permission to make sure Yoda executor has no significant privileges.
Click Create function. Once everything is complete, You will see this page.
Runtime source code for Yoda executor can be downloaded here. Then, At Code Source section, click Upload from and choose .zip file.
Upload your downloaded runtime zip file.
Go to Configuration tab and select Environment variables section to add 2 environment variables
Key | Value |
---|---|
MAX_EXECUTABLE |
8192 |
MAX_DATA_SIZE |
512 |
Next, go to General Configuration section to configure runtime. We recommend using 1024MB RAM and 12 seconds timeout.
We will use API Gateway for receiving a request from our Yoda program. Let’s create a new trigger by clicking + Add trigger -> API Gateway and follow the setup wizard to create a new API endpoint connecting to your Lambda function.
Then, click Create an API
After that, click Add
Once completed, you will see the API endpoint that will be used as the endpoint URL to test your Lambda function.
You can now test the endpoint using curl
curl --location --request POST '<your_api_endpoint>' \
--header 'Content-Type: application/json' \
--data-raw '{
"executable": "IyEvdXNyL2Jpbi9lbnYgcHl0aG9uMwoKaW1wb3J0IHN5cwoKZGVmIG1haW4oZGF0YSk6CiAgICByZXR1cm4gZGF0YQoKCmlmIF9fbmFtZV9fID09ICJfX21haW5fXyI6CiAgICB0cnk6CiAgICAgICAgcHJpbnQobWFpbigqc3lzLmFyZ3ZbMTpdKSkKICAgIGV4Y2VwdCBFeGNlcHRpb24gYXMgZToKICAgICAgICBwcmludChzdHIoZSksIGZpbGU9c3lzLnN0ZGVycikKICAgICAgICBzeXMuZXhpdCgxKQo=",
"calldata": "\"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages.\"",
"timeout": 3000
}'
The expected result should be:
{
"returncode": 0,
"stdout": "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages.\n",
"stderr": "",
"error": "",
"version": "lambda:2.0.4"
}