AWS Dynamodb/Firehose Based Reccomendation Engine Based on Graphs.
1. Config Lambda Code
const {
App,
handlers
} = require('dynamodb-recs');
module.exports = new App('tablePrefix', 'partition', {
recs: {
firehose: { // optional
concurrency: 100
stream: 'app-name-recs'
},
jobs: {
viewView: [{
entity: 'view'
}, {
entity: 'view'
}],
viewBuy: [{
entity: 'view'
}, {
entity: 'buy'
}]
},
ttr: 30 * 60 * 1000 // 30 minutes optional
},
recsLogs: { // optional
firehose: { // optional
concurrency: 100
stream: 'app-name-recs-logs'
},
process: { // optional
concurrency: 100,
offset: 60 * 60 * 1000 // 1 hour
}
}
});
export.recs = handlers.recs(app);
export.recsLogsFirehose = handlers.recsLogsFirehose(app);
export.recsLogsHit = handlers.recsLogsHit(app);
export.recsLogsProcess = handlers.recsLogsProcess(app);
2. Config Lambda Handlers
Name
app-recs
Handler
index.fetch
Size
3008 MB
-
Name
app-recs-logs-firehose
Handler
index.recsLogsFirehose
Size
512 MB
-
Name
app-recs-logs-hit
Handler
index.recsLogsHit
Size
128 MB
-
Name
app-recs-logs-process
Handler
index.recsLogsProcess
Size
512 MB
3. Config Kinesis Firehose
Name
app-name-recs
Lambda Transformer
app-recs-firehose
S3 Bucket
app-name
Prefix
recs/dt=!{timestamp:yyyy}-!{timestamp:MM}-!{timestamp:dd}/
Error prefix
recs-error/err=!{firehose:error-output-type}/dt=!{timestamp:yyyy}-!{timestamp:MM}-!{timestamp:dd}/
-
Name
app-name-recs-logs
Lambda Transformer
app-recs-logs-firehose
S3 Bucket
app-name
Prefix
recs-logs/dt=!{timestamp:yyyy}-!{timestamp:MM}-!{timestamp:dd}/
Error prefix
recs-logs-error/err=!{firehose:error-output-type}/dt=!{timestamp:yyyy}-!{timestamp:MM}-!{timestamp:dd}/