Documentation
Use cases
DynamoDB events

DynamoDB events

To handle DynamoDB events (opens in a new tab), extend the DynamoDbHandler class:

use Bref\Context\Context;
use Bref\Event\DynamoDb\DynamoDbEvent;
use Bref\Event\DynamoDb\DynamoDbHandler;
 
class MyHandler extends DynamoDbHandler
{
    public function handleDynamoDb(DynamoDbEvent $event, Context $context): void
    {
        foreach ($event->getRecords() as $record) {
            $keys = $record->getKeys();
            $old = $record->getOldImage();
            $new = $record->getNewImage();
 
            // do something
        }
    }
}

Learn more about using DynamoDB in serverless.yml in the Serverless Framework documentation (opens in a new tab).