{"id":18573141,"url":"https://github.com/localstack-samples/sample-livedebug-lambda","last_synced_at":"2026-01-27T18:37:21.242Z","repository":{"id":183786457,"uuid":"667403309","full_name":"localstack-samples/sample-livedebug-lambda","owner":"localstack-samples","description":"Example .NET Lambda live debugging in Visual Studio","archived":false,"fork":false,"pushed_at":"2024-08-05T08:40:09.000Z","size":3199,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":14,"default_branch":"main","last_synced_at":"2025-05-31T17:41:57.963Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/localstack-samples.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-07-17T12:29:20.000Z","updated_at":"2024-07-24T04:37:03.000Z","dependencies_parsed_at":"2024-02-20T00:29:38.076Z","dependency_job_id":"0f822506-f665-43bf-aaf2-521cfc9b888a","html_url":"https://github.com/localstack-samples/sample-livedebug-lambda","commit_stats":null,"previous_names":["localstack-samples/sample-livedebug-lambda"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/localstack-samples/sample-livedebug-lambda","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localstack-samples%2Fsample-livedebug-lambda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localstack-samples%2Fsample-livedebug-lambda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localstack-samples%2Fsample-livedebug-lambda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localstack-samples%2Fsample-livedebug-lambda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/localstack-samples","download_url":"https://codeload.github.com/localstack-samples/sample-livedebug-lambda/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localstack-samples%2Fsample-livedebug-lambda/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28818239,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T18:01:38.485Z","status":"ssl_error","status_checked_at":"2026-01-27T18:01:27.499Z","response_time":168,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T23:08:08.546Z","updated_at":"2026-01-27T18:37:21.214Z","avatar_url":"https://github.com/localstack-samples.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AWS Lambda Testing on LocalStack and AWS Deploy\n\nThis example includes C# dotnet Lambdas, SQS, and DynamoDB. It demonstrates how to deploy\nmultiple services to LocalStack and AWS. The DynamoDB table acts as a set of unique keys for objects in S3.\nThe solution could be used as a starting point for a more complex solution that uses S3, DynamoDB, SQS, and Lambdas.\nFor example, the unique set of keys in DynamoDB could be used by a batch job to process invoices, orders, etc.\n\n![Architecture](./docs/img/design.drawio.png \"Architecture\")\n\n## Deploying the App to LocalStack\n\nTo deploy your infrastructure, follow the steps below.\n\n### Prerequisites\n\n1. [Install Watchman](https://facebook.github.io/watchman/)\n2. [Install LATEST AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)\n3. [Install Terraform](https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli)\n\n\n4. Install Node Version Manager (NVM)\n   https://github.com/nvm-sh/nvm#installing-and-updating\n\n5. Select Node version 18\n\n```shell\nnvm install 18\n```\n\n6. Install Terraform CDK\n   Install cdktf in the node 18 version you just installed in step (4).\n\n```shell\nnpm install --global cdktf-cli@latest\n```\n\n### Steps\n\nAfter cloning this repo, from this working directory, run these commands:\n\n1. Set your LocalStack pro key\n\n      ```bash\n      export LOCALSTACK_API_KEY=\u003cyour key\u003e\n      ```\n\n2. Start LocalStack\n\n      ```bash\n      make start-localstack\n      ```\n\n![Start LocalStack](./docs/img/start-localstack.png \"Start LocalStack\")\n\n3. Setup an AWS_PROFILE for LocalStack\n\n#### Add this to your `~/.aws/config` file\n\n```text\n[profile localstack]\nregion=us-east-1\noutput=json\nendpoint_url = http://localhost:4566\n```\n\n#### Add this to your `~/.aws/credentials` file\n\n```text\n[localstack]\naws_access_key_id=test\naws_secret_access_key=test\n```\n\n# Deploy to LocalStack with IaC\n\n## Terraform CDK IaC Instructions\n\n### Install pipeline packages\n\nYou need to do this initially, and if you manually add packages to `iac/terraform/cdk/package.json`\n\n```shell\nmake local-cdktf-install\n```\n\n### Deploy the Terraform CDK IaC Stack\n\nThis will deploy the S3 bucket, Lambda in hot reload mode, all roles and policies.\n\n```shell\nmake local-cdktf-deploy\n```\n\n## Testing Dotnet C# Lambda\n\nThere are two ways to hot reload and live test your C# Lambda now.\nUsing Visual Studio with the Lambda Test Tool, and deploying the Lambda to LocalStack with hot reloading.\nWe'll cover both now.\n\n### Debugging C# Lambda with Hot-Deploy to LocalStack\n\nWe'll deploy the C# Lambda to LocalStack using the CLI.\nThis is useful for test-driven development where you're testing a Lambda over and over again by running tests that\ninvoke it. This development method runs the Lambda in a hot-deploy scenario. Changes to the Lambda are immediately\nredeployed to\nLocalStack.\n\n1. Re-publish the dotnet bundle when code changes\n\n```shell\nmake watch-dotnet\n```\n\n2. Test Invoke\n\n```shell\nmake local-dotnet-ls-invoke\n```\n\nYou can run this command to put some data in the S3 bucket so the Lambda actually returns some results.\n\n```shell\nmake cp-readme\n```\n\n#### Testing Scenario for Hot-Reloading\n\nNow that you've deployed everything and you can invoke the Lambda manually using `make local-dotnet-ls-invoke`,\nas described in the instructions above, you can get into a fast dev cycle with some integration tests (not included\nyet).\nYour DevX looks like\n\n1. You're deployed in hot-reload mode from the steps above and watching the Lambda code for changes and rebuilding\n2. Write an integration test that invokes the Lambda and asserts outcomes\n3. Make changes to the Lambda, run the test\n4. Goto step (3)\n\n### Debugging Lambda in Visual Studio with Lambda Test Tool\n\nWe'll run the Lambda in Visual Studio with full access to the debugger.\nThis is useful for deep debugging using the Visual Studio debugger with break points\n\n1. Open the `src/dotnet/src/s3utillambda/s3utillambda.csproj` file in Visual Studio.\n   ![\"Open Visual Studio\"](./docs/img/open-visual-studio.png \"Open Visual Studio\")\n\n2. Configure Lambda Test Tool\n\n- [Windows config](https://github.com/aws/aws-lambda-dotnet/blob/master/Tools/LambdaTestTool/README.md#configure-for-visual-studio)\n- [Mac config](https://github.com/aws/aws-lambda-dotnet/blob/master/Tools/LambdaTestTool/README.md#configure-for-visual-studio-for-mac)\n\nOpening the properties looks like this on a Mac.\n![\"Open Project Properties\"](./docs/img/open-props.png \"Open Project Properties\")\n\nConfigure the Lambda test tool per the Lambda Test Tool links in this step.\nOn a Mac you point the external command to the `Amazon.Lambda.TestTool.BlazorTester.dll` file.\nTypically, in a location like\n\n```text\n/Users/\u003csomeuser\u003e/.dotnet/tools/.store/amazon.lambda.testtool-6.0/0.13.1/amazon.lambda.testtool-6.0/0.13.1/tools/net6.0/any/Amazon.Lambda.TestTool.BlazorTester.dll\n```\n\nAlso add the two environment variables.\n![\"Config Test Tool\"](./docs/img/config-test-tool.png \"Config Test Tool\")\n\n3. Debugging with Lambda Test Tool\n   You can set break points in the function. Hit the run button to launch the test tool and invoke the Lambda.\n   ![\"Invoke Lambda with Test Tool\"](./docs/img/start-test-tool.png \"Invoke Lambda with Test Tool\")\n\nThis launches the test tool on [\"localhost:5050\"](http://localhost:5050 \"Invoke Lambda\") where you can invoke the Lambda\nwith no parameters.\n![\"Invoke Lambda\"](./docs/img/exec-lambda-test-tool.png \"Invoke Lambda\")\n\nYou can run this command to put some data in the S3 bucket so the Lambda actually returns some results.\n\n```shell\nmake cp-readme\n```\n\nThen the invoke output will look like this\n![\"Invoke Output\"](./docs/img/invoke-output.png \"Invoke Output\")\n\n# AWS Deploy Instructions\n\nWe use the same IaC pipelines to deploy to AWS! This is a very important point that LocalStack enables teams\nto test their IaC pipelines locally before ever deploying them to a live AWS environment.\n\n## Set Live AWS Credentials\n\nHowever you set your credentials in your terminal, do it now.\n\n## Add Environment Config\n\nThis project stores Terraform state in an AWS S3 bucket in the target account.\nCreate an S3 bucket in your target account to hold the Terraform state\n\n```shell\naws s3 mb s3://\u003cname of your bucket\u003e-\u003cregion where bucket is\u003e --region \u003cregion where your bucket is\u003e\n# enable versioning in case of state corruption\naws s3api put-bucket-versioning --bucket \u003cyour full bucket name\u003e --versioning-configuration Status=Enabled\n```\n\nCreate a file called `nonenv.makefile` at the root of this project.\n\n```makefile\nnon%: export TERRAFORM_STATE_BUCKET=\u003cyour bucket name. ie my-happy-bucket-us-east-1\u003e\nnon%: export PULUMI_BACKEND_URL=s3://$(TERRAFORM_STATE_BUCKET)\nnon%: export LIST_BUCKET_NAME=\u003cchoose a unique bucket name that your Lambda will get a list of objects from\u003e\n```\n\n### Deploy to AWS with Terraform-CDK\n\n```shell\nmake non-cdktf-deploy\n```\n\n### Invoke the Lambda in AWS\n\n```shell\nmake non-dotnet-invoke\n```\n\nSee the output.\n\n```shell\ncat output.txt\n```\n\n### Copy a file to the S3 Bucket the Lambda is listing\n\n```shell\nmake non-cp-readme\n```\n\nNow you can invoke it again and view the new output.\n\n## Destroy the Deployed Stack\n\nBefore destroying the stack, empty the bucket the Lambda uses.\n\n```shell\nmake non-empty-bucket\n```\n\n```shell\nmake non-cdktf-destroy\n```\n\n# Deprecated IaC\n\nThis HCL IaC isn't being used anymore. The Terraform CDK IaC is up to date.\n\n#### Terraform HCL\n\n[Install Terraform](https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli)\n\nThis will deploy S3 resources that the test Lambdas will use. It does not deploy the Lambdas, we'll cover that next.\n\n ```bash\n make local-tformhcl-deploy\n ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocalstack-samples%2Fsample-livedebug-lambda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flocalstack-samples%2Fsample-livedebug-lambda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocalstack-samples%2Fsample-livedebug-lambda/lists"}