I have created lambda function and tried to invoke it from python program using boto3 API,its failing.
import boto3
client = boto3.client('lambda','us-east-1')
response = client.invoke(
FunctionName='arn:aws:lambda:us-east-1:025631470700:function:app-test',
InvocationType='Event',
LogType='Tail',
Payload='{"name": "David","status": "Active"}',
Qualifier='1'
)
Traceback (most recent call last):
File "/home/ssm-user/test.py", line 11, in <module>
Qualifier='1'
File "/usr/local/lib/python3.6/site-packages/botocore/client.py", line 357, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/usr/local/lib/python3.6/site-packages/botocore/client.py", line 676, in _make_api_call
raise error_class(parsed_response, operation_name)
botocore.errorfactory.ResourceNotFoundException: An error occurred (ResourceNotFoundException) when calling the Invoke operation: Function not found: arn:aws:lambda:us-east-1:025631470700:function:app-test:1
Did i miss anything? Any thoughts, much appreciated
As the user Jens said in the comments, the FunctionName
argument of the invoke()
function is not the ARN of the lambda, it's its name. Use this:
response = client.invoke(
FunctionName='app-test',
InvocationType='Event',
LogType='Tail',
Payload='{"name": "David","status": "Active"}',
Qualifier='1'
)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.