This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports.hello = (event, context, callback) => { | |
const errorResponse = { | |
statusCode: 400, | |
headers: { | |
"x-custom-header" : "my custom header value" | |
}, | |
body: JSON.stringify({ | |
message: 'Bad request Dude', | |
}), | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
functions: | |
hello: | |
handler: handler.hello | |
events: | |
- http: | |
path: hello | |
method: get |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports.hello = (event, context, callback) => { | |
const response = { | |
statusCode: 200, | |
headers: { | |
"x-custom-header" : "my custom header value" | |
}, | |
body: JSON.stringify({ | |
message: 'Go Serverless v1.0! Your function executed successfully!', | |
input: event, | |
}), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
╔════════════════════════════════════════════════╦═══════════════════════════════════════════════════════╗ | |
║ Lambda-Proxy ║ Lambda ║ | |
╠════════════════════════════════════════════════╬═══════════════════════════════════════════════════════╣ | |
║ 1. Prone to human errors, as status code ║ 1. Involves lot of work in setting up the integration ║ | |
║ and response message will be in code. ║ request template, response template, status code ║ | |
║ This is subjective, but a point to stay in ║ pattern. All these need some extra knowledge on ║ | |
║ the dis-advantage. ║ VTL(Velocity Template Language) and JSON Path. ║ | |
║ ║ ║ | |
║ 2. Everything rests in the code. Headers, ║ ║ | |
║ status codes, messages are hidden in the ║ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
╔══════════════════════════════════════════════════════╦═════════════════════════════════════════════════════════════════════════╗ | |
║ Lambda-Proxy ║ Lambda ║ | |
╠══════════════════════════════════════════════════════╬═════════════════════════════════════════════════════════════════════════╣ | |
║ 1. Very Easy to setup. Status code and the response ║ 1. It completely decouples the APIGateway from Lambda's request ║ | |
║ message are in lambda's control. ║ and response payload, its headers and statusCodes. Thus, you ║ | |
║ ║ have more control over the workflow. ║ | |
║ ║ ║ | |
║ 2. Easy for rapid prototyping, as you don't want ║ 2. Provides a procedural way of defining various s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
╔════════════════════════════════════════════════╦════════════════════════════════════════════════╗ | |
║ Lambda-Proxy ║ Lambda ║ | |
╠════════════════════════════════════════════════╬════════════════════════════════════════════════╣ | |
║ - Request from the client are sent directly to ║ - Request and Response can be altered/modified ║ | |
║ lambda. In the same way, responses are ║ when it is sent to and from the lambda. ║ | |
║ sent directly from the lambda. API Gateway ║ API Gateway has full control of the request ║ | |
║ has no part in the transmission data. ║ and responses. ║ | |
║ ║ ║ | |
║ - Status code of the response message such ║ - Status Code of the response message are set ║ | |
║ as 2XX, 4XX & 5XX are set by the lambda. ║ by the API Gateway. ║ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
╔════════════════╦═══════════════════════════════════════════════════════════════╦════════════════════════════════════════════════════════════════════════════╗ | |
║ Features ║ lambda-proxy ║ lambda ║ | |
╠════════════════╬═══════════════════════════════════════════════════════════════╬════════════════════════════════════════════════════════════════════════════╣ | |
║ General ║ This is a simple, but powerful integration. All the request ║ This is complex, but offers more control over transmission data. ║ | |
║ Description ║ and response to the APIGateway URL is forwarded ║ The request and response can be modified before it is sent to ║ | |
║ ║ straight to the Lambda. ║ lambda. This can be done by mapping templates which transforms ║ | |
║ ║ i.e No modifications to the request(query par |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"lastUpload":"2017-10-23T11:31:35.410Z","extensionVersion":"v2.8.3"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!global._babelPolyfill) require('babel-polyfill'); | |
import { Promise as bbPromise } from 'bluebird'; | |
import AWS from 'aws-sdk'; | |
const lambda = new AWS.Lambda({ | |
region: 'ap-northeast-1' | |
}); | |
module.exports.wakeup = (event, context, callback) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
service: stakinet-wakeup | |
package: | |
exclude: | |
provider: | |
name: aws | |
runtime: nodejs6.10 | |
cfLogs: true | |
timeout: 20 |