我有一个用Python 3.6编写的lambda函数,并从lambda控制台进行了测试,可以很好地将其作为响应返回
<div class="container">
<div class="testimony-item">
<div class="testimony">
<p>text</p>
<div class="stu-details">
<strong>text</strong>
<small>text</small>
</div>
</div>
</div>
<div class="testimony-item">
<div class="testimony">
<p>text</p>
<div class="stu-details">
<strong>text</strong>
<small>text</small>
</div>
</div>
</div>
<div class="testimony-item">
<div class="testimony">
<p>text</p>
<div class="stu-details">
<strong>text</strong>
<small>text</small>
</div>
</div>
</div>
</div>
在lambda功能控制台中,我单击添加触发器,然后在拥有API时选择了API Gateway,然后创建了资源,然后在该资源中创建了GET方法
但是,当我从API网关测试端点时,会在响应正文中得到
Response:
{
"statusCode": 200,
"body": {
"bank": "my bank",
"trust_name": "my trust",
"start_time": "Wed 09 Oct 07:56AM",
"end_time": "Wed 09 Oct 08:26AM",
"cost": 111
}
}
答案 0 :(得分:0)
我最终使用了Chalice由AWS开发的Python无服务器微框架,使您能够快速启动和部署可工作的无服务器应用程序,并使用AWS Lambda根据需要自行扩展和缩小。
这部署了我的lambda函数并将其连接到API网关没有任何问题,除了必须手动通过lambda层添加任何依赖项