intro
exports.handler = (event, context, callback) => {
https.get(url, (res) => {
callback(null, res.statusCode)
}).on('error', (e) => {
callback(Error(e))
})
}
exports.handler = async (event) => {
return new Promise((resolve, reject) => {
if (Math.random() * 2 ^ 0) {
resolve();
} else {
reject();
}
});
}
or
exports.handler = async (event) => {
return https.get(url).promise();
}
or
# aws lambda invoke \
--function-name <value> \
<outfile>
Terminal
var lambda = new AWS.Lambda();
lambda.addLayerVersionPermission(params, function (err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
var lambda = new AWS.Lambda();
lambda.addLayerVersionPermission(params).promise();
or