Skip to content

Instantly share code, notes, and snippets.

@maatthc
Created March 13, 2019 22:57
Show Gist options
  • Save maatthc/4f38b6238cff9d67e3c7401f33670dce to your computer and use it in GitHub Desktop.
Save maatthc/4f38b6238cff9d67e3c7401f33670dce to your computer and use it in GitHub Desktop.
Basic AWS SAM template to run NodeJs Lambdas locally: sam local invoke -t sam_template.yml -e test/fixtures/s3-to-lambda-put-event.json
AWSTemplateFormatVersion : '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Resources:
LambdaFunction:
Type: AWS::Serverless::Function
Properties:
Handler: index.handler
Runtime: nodejs8.10
MemorySize: 128
Timeout: 15
Environment:
Variables:
LOG_LEVEL: "debug"
{
"Records": [
{
"eventVersion": "2.1",
"eventSource": "aws:s3",
"awsRegion": "ap-southeast-2",
"eventTime": "2019-02-25T02:25:09.091Z",
"eventName": "ObjectCreated:Put",
"userIdentity": {
"principalId": "AWS:NAH"
},
"requestParameters": {
"sourceIPAddress": "666.84.43.666"
},
"responseElements": {
"x-amz-request-id": "PUFT",
"x-amz-id-2": "lalaland"
},
"s3": {
"s3SchemaVersion": "1.0",
"configurationId": "666-666",
"bucket": {
"name": "company-dev-project-app",
"ownerIdentity": {
"principalId": "MEMYMINE"
},
"arn": "arn:aws:s3:::company-dev-project-app"
},
"object": {
"key": "my_folder/excellent_file.csv",
"size": 1310,
"eTag": "aabbcc",
"sequencer": "00112233"
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment