├── Makefile ├── netlify.toml ├── README.md ├── site └── index.html ├── main.go └── LICENSE /Makefile: -------------------------------------------------------------------------------- 1 | build: 2 | mkdir -p functions 3 | go get ./... 4 | go build -o functions/hello-lambda ./... 5 | -------------------------------------------------------------------------------- /netlify.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | command = "make build" 3 | functions = "functions" 4 | publish = "site" 5 | [build.environment] 6 | # Change this path with the path to your repository 7 | GO_IMPORT_PATH = "github.com/netlify/aws-lambda-go-example" 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Deploying AWS Lambda Go functions with Netlify 2 | 3 | This is an example of how to deploy Go functions with Netlify on AWS Lambda. 4 | 5 | You can find the code in [main.go](main.go). 6 | 7 | Read more about Go functions support on Netlify in [our documentation](https://www.netlify.com/docs/lambda-functions). 8 | -------------------------------------------------------------------------------- /site/index.html: -------------------------------------------------------------------------------- 1 | 2 | Deploying AWS Lambda Go functions with Netlify 3 | 4 |

Deploying AWS Lambda Go functions with Netlify

5 |

This is an example of how to deploy Go functions with Netlify on AWS Lambda.

6 |

Go to /.netlify/functions/hello-lambda to see the function in action

7 | 8 | 9 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/aws/aws-lambda-go/events" 5 | "github.com/aws/aws-lambda-go/lambda" 6 | ) 7 | 8 | func handler(request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) { 9 | return events.APIGatewayProxyResponse{ 10 | StatusCode: 200, 11 | Body: "Hello AWS Lambda and Netlify", 12 | }, nil 13 | } 14 | 15 | func main() { 16 | // Make the handler available for Remote Procedure Call by AWS Lambda 17 | lambda.Start(handler) 18 | } 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017 David Calavera 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | --------------------------------------------------------------------------------