Lambda関数
import boto3
from boto3.dynamodb.conditions import Key, Attr
def main(nam):
#def lambda_handler(event, context):
region = "us-east-2"
dynamodb = boto3.resource('dynamodb')
table = dynamodb.Table('testUser')
response = table.query(KeyConditionExpression=Key('name').eq(nam))
sites = response["Items"]
print(sites)
return sites
API Gateway
マッピングテンプレート
#set($inputRoot = $input.path('$'))
#foreach($elem in $inputRoot)
<table border="1">
<tbody>
<tr>
<td>name</td>
<td>charge</td>
<td>email</td>
</tr>
<tr>
<td>"$elem.name"</td>
<td>"$elem.charge"</td>
<td>"$elem.email"</td>
</tr>
</tbody>
</table>
#end