仅使用插入配置 DynamoDB 流触发器
Configure DynamoDB stream trigger with insert only
我目前有一个 AWS DynamoDB 流触发 Lambda 函数。
Lambda 函数由 DynamoDB 中的 insert 和 update 事件触发。有没有办法更改配置,使 Lambda 函数 仅 被 'insert' 触发?
据我所知这是不可能的。 AWS Lambda polls the stream and invokes your Lambda function when it detects any type of stream record update. Your Lambda will have to ignore the records that you are not interested in. You can use the eventName property 的流记录(可以有值 INSERT | MODIFY | REMOVE)
您可以使用 lambda 函数忽略插入以外的其余部分。
for record in event.get('Records'):
if record.get('eventName') in ('INSERT'):
""" code for execution. """
elif record.get('eventName') == 'REMOVE':
pass
elif record.get('eventName') == 'MODIFY':
pass
我目前有一个 AWS DynamoDB 流触发 Lambda 函数。
Lambda 函数由 DynamoDB 中的 insert 和 update 事件触发。有没有办法更改配置,使 Lambda 函数 仅 被 'insert' 触发?
据我所知这是不可能的。 AWS Lambda polls the stream and invokes your Lambda function when it detects any type of stream record update. Your Lambda will have to ignore the records that you are not interested in. You can use the eventName property 的流记录(可以有值 INSERT | MODIFY | REMOVE)
您可以使用 lambda 函数忽略插入以外的其余部分。
for record in event.get('Records'):
if record.get('eventName') in ('INSERT'):
""" code for execution. """
elif record.get('eventName') == 'REMOVE':
pass
elif record.get('eventName') == 'MODIFY':
pass