Configure your lambda function to copy changed records from the Orders Kinesis Data Stream to the OrdersHistory table.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"dynamodb:DeleteItem",
"dynamodb:GetItem",
"dynamodb:PutItem",
"dynamodb:Scan",
"dynamodb:UpdateItem"
],
"Resource": "arn:aws:dynamodb:{aws-region}:{aws-account-id}:table/*"
}
]
}
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"kinesis:DescribeStream",
"kinesis:GetRecords",
"kinesis:GetShardIterator",
"kinesis:ListStreams"
],
"Resource": "arn:aws:kinesis:{aws-region}:{aws-account-id}:stream/Orders"
},
{
"Effect": "Allow",
"Action": "dynamodb:PutItem",
"Resource": "arn:aws:dynamodb:{aws-region}:{aws-account-id}:table/OrdersHistory"
},
{
"Effect": "Allow",
"Action": "sqs:SendMessage",
"Resource": "arn:aws:sqs:{aws-region}:{aws-account-id}:orders-kds-dlq"
}
]
}
Replace {aws-region} and {aws-account-id} in the policy statement above with your AWS region and account ID respectively.
1
arn:aws:lambda:{aws-region}:017000801446:layer:AWSLambdaPowertoolsPythonV2:58
Replace {aws-region} with ID for the AWS region that you are currently working on.