I am writing a project where I need to process DynamoDB table inserts and updates in Chalice. I see in Chalice events processing for SNS, SQS, scheduler but not for DynamoDB table. Currently it is not in Chalice, but AWS definitely can do it. What is a recommended workaround?
I do it manually without triggering but it is not as good due to separation of concerns and modularity
I would like to have it something like:
@app.on_dynamodb_table_trigger(table='mytable', event='insert')
def myhandler(event):
for record in event:
domyligic()
I need my domyligic() function to be called on insert event into table 'mytable'
This feature was added to Chalice on October 2nd, 2020:
https://aws.amazon.com/blogs/developer/aws-chalice-now-supports-amazon-kinesis-and-amazon-dynamodb-streams/
requirements.txt
chalice>=1.21
app.py
@app.on_dynamodb_record(stream_arn=os.environ['TABLE_STREAM_ARN'])
def on_table_update(event):
for record in event:
process_record(record)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With