Skip to content

Instantly share code, notes, and snippets.

@gauravds
Created November 15, 2023 17:55
Show Gist options
  • Save gauravds/8d5712c8c927de2a6584e1065e6b411d to your computer and use it in GitHub Desktop.
Save gauravds/8d5712c8c927de2a6584e1065e6b411d to your computer and use it in GitHub Desktop.
VSCode debugger for aws lambda (Sam) command for service.

Local AWS lambda service call via sam / aws sam cli, you can also attach debugger to VSCode via configuration settings.json

$ sam local invoke --profile=dev MyServiceName1 -e events/events-MyServiceName1.json -n env/env-MyServiceName1.json
{
"launch": {
"configurations": [
{
"type": "aws-sam",
"request": "direct-invoke",
"name": "Invoke Lambda",
"aws": {
"credentials": "profile:dev",
"region": "us-east-1"
},
"invokeTarget": {
"target": "template",
"templatePath": "${workspaceFolder}/template.yaml",
"logicalId": "MyServiceName1"
},
"lambda": {
"runtime": "nodejs14.x",
"environmentVariables": {
"ENV_1": "asdf",
"ENV_2": "asdf2"
},
"payload": {
"path": "${workspaceFolder}/events/events-MyServiceName1.json"
}
}
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment