You really shouldn't need to configure it for this example. Running the vscode launch configuration should do everything for you... see the video section about 8 minutes and 50 seconds in. Just install docker (desktop) and make sure that the service is running. From the command line if you can issue a command like "docker ps" as long as an error isn't thrown you should be fine. If you get an error like "Cannot connect to the Docker daemon", then docker isn't running and you need to start the service. If you're having a specific issue let me know and I'll see if I can walk you through it.
Very clear explanation. But I tried it with Python runtime and I do not get the code lense options above my Lambda function definition. How do I start the debug when those links are not showing?
You can use the "Run and Debug" button on the left menu bar in VS Code, then select the Launch Configuration you want from the drop down, then click the green "play" button. Make sure you have a break point set if you want to step into your code, otherwise it will just execute and you really won't have the option to "see" what is going on. BTW - I didn't have CodeLens configured in the tutorial, so you won't see it mine either.... you don't need it for debugging.
Interesting video, what about if i use some packages, i need to setup a venv environment? I found a command with AWS SAM (sam invoke local) ... Which one do you recommend? Thanks for video !
I always use a virtual environment to make my life a little easier (but it's not required). When using SAM I prefer to use the method I outlined in the video to connect vis the sam local invoke. You can use the sam local invoke but then you need also configure the debugger and attach it at runtime... it always seemed like a lot of extra work to me. If I'm not using SAM and instead using the CDK, then there are other tricks out there. I'll make a video on that soon.
Thanks for the sub! Will do. If you need immediate assistance, take a look at this link: disaster-recovery.workshop.aws/en/labs/basics/lambda.html It will show you how to export an existing function (assuming you don't already have access to the source via a repository, other means). Then you can unzip it and open it in VSCode. From there use this tutorial to debug it. If you have access to the existing function from a repo, just clone it and follow this tutorial.
Hi, Im trying to test a lambda locally, but Im struggling with the fact that the DB Im connecting to is only available through AWS VPC. How could test a lambda locally that needs to connect to the VPC in order to connect to the DB and retrieve data fro
In this case you can configure a local db (maybe run a docker container with the db) and configure the lambda function to connect to the local db instead of attempting to connect to VPC. Pass in your db connection information via environment variables. So locally you pass in the local db connection and when it's running in AWS you pass in the connection information relative to the environment (dev, prod, etc). This follows a best practice and makes your function more portable between environments.
Got this issue with: File "/tmp/lambci_debug_files/py_debug_wrapper.py", line 46, in runpy.run_module('debugpy', run_name='__main__') File "", line 222, in run_module File "", line 142, in _get_module_details ImportError: No module named debugpy Wondering if anyone has seen it before?
I've never seen that one. Was that an error in your local environment, locally in docker or up in AWS Lambda? Since it's pointing to the /tmp directory, I'm guessing in a docker lambda environment or up in AWS. Once I know the specifics, I might be able to help.
@@TechTalkWithEric thank you for replying. I finally got it figured out. At least on Mac silicon Mx. Need to add following in your launch.json. Hopefully this will help folks out. "sam": { "containerBuild": false, "buildDir": "${workspaceFolder}/src/.aws-sam", "buildArguments": [ "--debug", ], },
Thank you !!! I'm off to part 2 !!!
glad you like them!
非常好的视频,为我节省了大量时间,thanks。
Glad it helped!
Excellent video.
Thank you very much!
Can you share some video about docker configuration that is required?
You really shouldn't need to configure it for this example. Running the vscode launch configuration should do everything for you... see the video section about 8 minutes and 50 seconds in.
Just install docker (desktop) and make sure that the service is running. From the command line if you can issue a command like "docker ps" as long as an error isn't thrown you should be fine. If you get an error like "Cannot connect to the Docker daemon", then docker isn't running and you need to start the service.
If you're having a specific issue let me know and I'll see if I can walk you through it.
Very clear explanation. But I tried it with Python runtime and I do not get the code lense options above my Lambda function definition. How do I start the debug when those links are not showing?
You can use the "Run and Debug" button on the left menu bar in VS Code, then select the Launch Configuration you want from the drop down, then click the green "play" button. Make sure you have a break point set if you want to step into your code, otherwise it will just execute and you really won't have the option to "see" what is going on.
BTW - I didn't have CodeLens configured in the tutorial, so you won't see it mine either.... you don't need it for debugging.
Interesting video, what about if i use some packages, i need to setup a venv environment? I found a command with AWS SAM (sam invoke local) ... Which one do you recommend? Thanks for video !
I always use a virtual environment to make my life a little easier (but it's not required). When using SAM I prefer to use the method I outlined in the video to connect vis the sam local invoke. You can use the sam local invoke but then you need also configure the debugger and attach it at runtime... it always seemed like a lot of extra work to me. If I'm not using SAM and instead using the CDK, then there are other tricks out there. I'll make a video on that soon.
Great video mate. Earned a sub :) BTW, please make a video on how to locally debug an existing Lambda functions and bring it to VSCode. Cheers!
Thanks for the sub! Will do. If you need immediate assistance, take a look at this link:
disaster-recovery.workshop.aws/en/labs/basics/lambda.html
It will show you how to export an existing function (assuming you don't already have access to the source via a repository, other means). Then you can unzip it and open it in VSCode. From there use this tutorial to debug it.
If you have access to the existing function from a repo, just clone it and follow this tutorial.
Hi, Im trying to test a lambda locally, but Im struggling with the fact that the DB Im connecting to is only available through AWS VPC. How could test a lambda locally that needs to connect to the VPC in order to connect to the DB and retrieve data fro
In this case you can configure a local db (maybe run a docker container with the db) and configure the lambda function to connect to the local db instead of attempting to connect to VPC. Pass in your db connection information via environment variables.
So locally you pass in the local db connection and when it's running in AWS you pass in the connection information relative to the environment (dev, prod, etc). This follows a best practice and makes your function more portable between environments.
Got this issue with:
File "/tmp/lambci_debug_files/py_debug_wrapper.py", line 46, in
runpy.run_module('debugpy', run_name='__main__')
File "", line 222, in run_module
File "", line 142, in _get_module_details
ImportError: No module named debugpy
Wondering if anyone has seen it before?
I've never seen that one. Was that an error in your local environment, locally in docker or up in AWS Lambda? Since it's pointing to the /tmp directory, I'm guessing in a docker lambda environment or up in AWS. Once I know the specifics, I might be able to help.
@@TechTalkWithEric thank you for replying. I finally got it figured out. At least on Mac silicon Mx. Need to add following in your launch.json. Hopefully this will help folks out.
"sam": {
"containerBuild": false,
"buildDir": "${workspaceFolder}/src/.aws-sam",
"buildArguments": [
"--debug",
],
},
Good to know. Thanks for posting the fix!!