我创建了一个python lambda函数myTestPython,并希望使用sam CLI mac或Windows进行调用。
我正在执行:
sudo aws lambda invoke --function-name "myLambdaPython" --endpoint-url "https://XXXXXX.execute-api.us-east-1.amazonaws.com/Prod" --no-verify-ssl out.txt
但是我遇到了以下错误:
/usr/local/aws/lib/python3.7/site-packages/urllib3/connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)
An error occurred (InvalidSignatureException) when calling the Invoke operation: Credential should be scoped to a valid region, not 's3.amazonaws.com'. Credential should be scoped to correct service: 'execute-api'
sudo aws lambda invoke --function-name "myLambdaPython" --endpoint-url "https://XXXXXX.execute-api.us-east-1.amazonaws.com/Prod" --no-verify-ssl out.txt
但是我遇到了错误
/usr/local/aws/lib/python3.7/site-packages/urllib3/connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)
def lambda_handler(event, context):
# TODO implement
return {
'statusCode': 200,
'body': json.dumps('Hello from Lambda!')
}
预期结果是函数的输出