所以我从另一个堆栈问题中跟踪了这个gudie:
实现这一目标的步骤是:
我理解这一点但是我不明白如何在我的lambda函数(Python)中使用这个参数
我尝试过input.name但没有成功。
答案 0 :(得分:0)
您可以使用如下查询字符串:
UserName = event["UserName"]
这是Python的一个例子:
def lambda_handler(event, context):
import boto3
import json
import decimal
# Helper class to convert a DynamoDB item to JSON.
class DecimalEncoder(json.JSONEncoder):
def default(self, o):
if isinstance(o, decimal.Decimal):
if o % 1 > 0:
return float(o)
else:
return int(o)
return super(DecimalEncoder, self).default(o)
dynamodb = boto3.resource('dynamodb', region_name='ap-southeast-1', endpoint_url="http://dynamodb.ap-southeast-1.amazonaws.com")
table = dynamodb.Table('TableUsers')
UserName =event["UserName"]
UserId = event["UserId"]
UserPassword=event["UserPassword"]
response = table.put_item(
Item={
'UserName': UserName,
'UserId': UserId,
'UserPassword':UserPassword
}
)
return "Register Successfully"