-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
executable file
·43 lines (38 loc) · 1.38 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
'use strict';
const AWS = require('aws-sdk');
var Lambda = require('lambda-log-wrapper');
var Timer = require('lambda-log-timer');
/* This is a sample Lambda Function for getting started with serverless
*
*/
module.exports.hello = (event, context, callback) => {
Timer.getTimeService(main, event, context, callback);
};
function main(event, context, callback) {
// The code snippet here shows how you can access a value stored in the encrypted S3
// secrets bucket at runtime - see https://github.com/pariveda-serverless/support/tree/master/secrets-uploader
// for detailed instructions on uploading secret data
// const params = {
// Bucket: process.env.SECRETS_BUCKET,
// Key: 'secret-file.enc'
// };
// const s3 = new AWS.S3({signatureVersion: "v4"});
// s3.getObject(params, function(err, data) {
// if (err) console.log(err, err.stack); // an error occurred
// else {
// const secretContents = data.Body.toString('ascii');
// // Don't log secrets, because they will be pushed to Elastic/Kibana
// // Instead, use them as you would any variable
// console.log(secretContents);
// }
// });
// end secret sample code
const response = {
statusCode: 200,
body: JSON.stringify({
message: 'Go Serverless! Your function executed successfully!',
input: event,
}),
};
callback(null, response);
}