This file contains hidden or 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
Resources: | |
HelloGopher: # Here we set a Resource Name, You can set anything you want. | |
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction | |
Properties: | |
CodeUri: ./ # This is the path to the Code, in our case we are bad and store it in root | |
Handler: hello-gopher | |
Runtime: go1.x | |
Environment: | |
Variables: | |
my-cool-variable: "maybe-not-so-cool" |
This file contains hidden or 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
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
"net/http" | |
"github.com/aws/aws-lambda-go/events" | |
"github.com/aws/aws-lambda-go/lambda" | |
) |
This file contains hidden or 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
AWSTemplateFormatVersion: '2010-09-09' | |
Transform: AWS::Serverless-2016-10-31 | |
Description: > | |
demo | |
Sample SAM Template for demo | |
# More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst | |
Globals: | |
Function: |
This file contains hidden or 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
sam local invoke -e event.json | |
Invoking hello-gopher (go1.x) | |
Skip pulling image and use local one: public.ecr.aws/sam/emulation-go1.x:rapid-1.40.1-x86_64. | |
Mounting /home/percy/development/aws-sam-demo/demo/.aws-sam/build/HelloGopher as /var/task:ro,delegated inside runtime container | |
START RequestId: 50c407a8-9a71-4acc-a45b-2ad1d725c759 Version: $LATEST | |
END RequestId: 50c407a8-9a71-4acc-a45b-2ad1d725c759 | |
REPORT RequestId: 50c407a8-9a71-4acc-a45b-2ad1d725c759 Init Duration: 0.21 ms Duration: 36.67 ms Billed Duration: 37 ms Memory Size: 128 MB Max Memory Used: 128 MB | |
"Hello From Lambda Percy" |
This file contains hidden or 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
{ | |
"name": "Percy" | |
} |
This file contains hidden or 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
sam local invoke | |
Invoking hello-gopher (go1.x) | |
Skip pulling image and use local one: public.ecr.aws/sam/emulation-go1.x:rapid-1.40.1-x86_64. | |
Mounting /home/percy/development/aws-sam-demo/demo as /var/task:ro,delegated inside runtime container | |
START RequestId: 10b09db1-9b02-4e1b-9b39-ce410039bfc1 Version: $LATEST | |
fork/exec /var/task/hello-gopher: no such file or directory: PathError | |
null | |
END RequestId: 10b09db1-9b02-4e1b-9b39-ce410039bfc1 | |
REPORT RequestId: 10b09db1-9b02-4e1b-9b39-ce410039bfc1 Init Duration: 0.15 ms Duration: 29.82 ms Billed Duration: 30 ms Memory Size: 128 MB Max Memory Used: 128 MB |
This file contains hidden or 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
AWSTemplateFormatVersion: '2010-09-09' | |
Transform: AWS::Serverless-2016-10-31 | |
Description: > | |
demo | |
Sample SAM Template for demo | |
# More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst | |
Globals: | |
Function: |
This file contains hidden or 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
package main | |
import ( | |
"fmt" | |
"github.com/aws/aws-lambda-go/lambda" | |
) | |
// Event is the Input Payload representation | |
type Event struct { |
This file contains hidden or 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
// Wget to Fetch ZIP | |
wget https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-linux-x86_64.zip | |
// Unzip into a folder named sam-installation | |
unzip aws-sam-cli-linux-x86_64.zip -d sam-installation | |
// Execute installation script | |
sudo ./sam-installation/install | |
// Cleanup | |
rm -rf aws-sam-cli-linux-x86_64.zip | |
rm -rf sam-installation |
This file contains hidden or 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
package main | |
import ( | |
"log" | |
"programmingpercy.tech/buildflags/version" | |
) | |
var ( | |
runner = "client-1.0.0" | |
) |