我在AWS GovCloud工作我在 AWS Lambda 中有以下配置:
无论配置如何,我似乎都无法让 Lambda 触发目标函数(或 SQS 事件中的队列)。
这是当前的 Lambda 函数。我已经尝试了许多结果/返回有效载荷的排列,但无济于事。
import base64
import json
def lambda_handler(event, context):
#print("Received event: " + json.dumps(event, indent=2))
for record in event['Records']:
payload = base64.b64decode(record['kinesis']['data']).decode('utf-8', 'ignore')
print("Success")
result = {
"statusCode": 202,
"headers": {
#'Content-Type': 'application/json',
},
"body": '{payload}'
}
return json.dumps(result)
Run Code Online (Sandbox Code Playgroud)
然后,我使用 AWS CLI 向 Kinesis 发送一条消息(我注意到控制台中的“测试”没有按照Jared Short观察目标)。
Every 0.1s: aws kinesis put-records --stream-name test-stream --records …Run Code Online (Sandbox Code Playgroud)