AWS Dynamodb/Firehose Based Reccomendation Engine Based on Graphs.
1. Config Lambda Code
const {
App,
handlers
} = require('dynamodb-recs');
const app = new App('tablePrefix', 'partition', {
logs: { // optional
firehose: { // optional
concurrency: 100,
stream: 'app-recs-logs'
},
process: { // optional
concurrency: 100,
offset: 60 * 60 * 1000 // 1 hour
},
ttl: 24 * 60 * 60 * 1000 // 1 day optional
},
recs: {
firehose: { // optional
concurrency: 100,
stream: 'app-recs'
},
jobs: {
viewView: [{
entity: 'view'
}, {
entity: 'view'
}]
},
ttl: 2 * 365 * 24 * 60 * 60 * 1000, // 2 years optional
ttr: 30 * 60 * 1000 // 30 minutes optional
}
});
exports.fetch = handlers.fetch(app);
exports.logsFirehose = handlers.logsFirehose(app);
exports.logsHit = handlers.logsHit(app);
exports.logsProcess = handlers.logsProcess(app);
exports.recsFirehose = handlers.recsFirehose(app);
2. Config Lambda Handlers
Name
app-recs-fetch
Handler
index.fetch
Size
3008 MB
-
Name
app-recs-firehose
Handler
index.recsFirehose
Size
512 MB
-
Name
app-recs-logs-firehose
Handler
index.logsFirehose
Size
512 MB
-
Name
app-recs-logs-hit
Handler
index.logsHit
Size
128 MB
-
Name
app-recs-logs-process
Handler
index.logsProcess
Size
512 MB
3. Config Kinesis Firehose
Name
app-recs
Lambda Transformer
app-recs-firehose
S3 Bucket
app
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-recs-logs
Lambda Transformer
app-recs-logs-firehose
S3 Bucket
app
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}/