Closed rohanhodarkar closed 5 years ago
lambda ships fairly ancient versions of boto3, its unclear why they stopped updating, but at least for py 2.7 and 3.6 its a release from august 2018, 3.7 has a lib from early november 2018. in general if your using new services in lambda you should bundle and package your botocore/boto3 versions, ideally via layer.
I have used latest boto3 version i.e. 1.9.86 and this latest version doesn't have 'personalize-runtime' service. Is it something development? If yes, what is the ETA for its production?
I have no idea what that is, its not a released model or service as far as I can tell.
AWS Personalize is a ML recommendation engine service by Amazon. This service was released back in end of Nov 2018. See official page of this service here: https://aws.amazon.com/personalize/
you'll need to package up the service files for use in lambda, https://docs.aws.amazon.com/personalize/latest/dg/aws-personalize-set-up-aws-cli.html
you'll typically do that via setting AWS_DATA_PATH per to point to the directory within your lambda upload that contains your uploaded service files. AWS_DATA_PATH=$LAMBDA_TASK_ROOT/path_in_zip/ https://boto3.amazonaws.com/v1/documentation/api/latest/guide/configuration.html#environment-variable-configuration
Thank you @kapilt ..
@rohanhodarkar were you able to solve this?
@niyando Yes. You need to follow steps mentioned in the link provided by @kapilt above. But it will work only on your local environment NOT Lambda.
My requirement changed as I we were not able to call it from Lambda.
You will have to open ticket against AWS team to get the solution probably..
@rohanhodarkar Thanks. I just need it to work on my local boto3 SDK. Will try the steps mentioned in the link.
Can anybody please help me. I need to use personalize-runtime in lambda but getting UnknownServiceError: Unknown service: 'personalize-runtime'. How to call this service in lambda. Please help. @kapilt - Can u please help.
Here's one way you can do this -- by using Lambda Layers and manually adding the models to the sdk.
Read more about lambda layers here: https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html
Update your AWS CLI to make sure it supports Lambda Layers
Steps:
Create a site-packages lib directory
LIB=boto3-with-personalize/python/lib/python3.6/site-packages
mkdir -p $LIB
Install the library to LIB
pip3 install boto3 -t $LIB
Download the service models, rename them & put them in the botcore/data directory
wget -N https://s3-us-west-2.amazonaws.com/personalize-cli-json-models/personalize.json
wget -N https://s3-us-west-2.amazonaws.com/personalize-cli-json-models/personalize-runtime.json
rename each one of them to service-2.json
move them to: /boto3-latest/python/lib/python3.6/site-packages/botocore/data/personalize/2018-05-28/ /boto3-latest/python/lib/python3.6/site-packages/botocore/data/personalize-runtime/2018-05-28/
4. Zip all the dependencies to /tmp/boto3-with-personalize.zip
cd boto3-with-personalize zip -r /tmp/boto3-with-personalize .
5. Publish the layer
aws lambda publish-layer-version --layer-name boto3-with-personalize --zip-file fileb:///tmp/boto3-with-personalize.zip
The above should return an ARN for a layer in the form:
arn:aws:lambda:region:ACC_ID:layer:boto3-with-personalize:1"
6. Add the layer to the function's configuration
aws lambda update-function-configuration --function-name
Hi,
I am trying to run real-time recommendations from AWS Personalize campaign in AWS Lambda following below code mentioned in the documentation .
https://docs.aws.amazon.com/personalize/latest/dg/getting-recommendations.html
However I am getting below error:
Seems like personalize-runtime service is not present in boto3 yet.
Boto3 version used = 1.9.86 Region = us-east-1
Thanks in advance.
Rohan Hodarkar