diff --git a/content/en/user-guide/aws/lambda/index.md b/content/en/user-guide/aws/lambda/index.md index 0d202871c5..a7e66fcb5d 100644 --- a/content/en/user-guide/aws/lambda/index.md +++ b/content/en/user-guide/aws/lambda/index.md @@ -1,19 +1,9 @@ --- title: "Lambda" linkTitle: "Lambda" -categories: ["LocalStack Community", "LocalStack Pro"] description: > - Get started with AWS Lambdas on LocalStack -tags: -- lambda -- aws-lambda -- lambda-hot-reloading -- lambda-debugging -- localstack-lambda -- serverless -- lambda-layers + Get started with Lambda on LocalStack aliases: - - /aws/lambda/ - /references/lambda-executors/ - /references/lambda-provider-v2/ - /references/lambda-asf-provider/ @@ -119,6 +109,7 @@ LocalStack provides various tools to help you develop, debug, and test your AWS * **Hot reloading**: With Lambda hot reloading, you can continuously apply code changes to your Lambda functions without needing to redeploy them manually. To learn more about how to use hot reloading with LocalStack, check out our [hot reloading documentation]({{< ref "hot-reloading" >}}). * **Remote debugging**: LocalStack's remote debugging functionality allows you to attach a debugger to your Lambda function using your preferred IDE. To get started with remote debugging in LocalStack, see our [debugging documentation]({{< ref "debugging" >}}). +* **Lambda VS Code Extension**: LocalStack's Lambda VS Code Extension supports deploying and invoking Python Lambda functions through AWS SAM or AWS CloudFormation. To get started with the Lambda VS Code Extension, see our [Lambda VS Code Extension documentation]({{< ref "user-guide/tools/lambda-tools/lambda-vscode-extension" >}}). ## Lambda Layers (Pro) diff --git a/content/en/user-guide/tools/lambda-tools/lambda-vscode-extension/deploy-lambda-function.gif b/content/en/user-guide/tools/lambda-tools/lambda-vscode-extension/deploy-lambda-function.gif new file mode 100644 index 0000000000..5ff8f616b7 Binary files /dev/null and b/content/en/user-guide/tools/lambda-tools/lambda-vscode-extension/deploy-lambda-function.gif differ diff --git a/content/en/user-guide/tools/lambda-tools/lambda-vscode-extension/index.md b/content/en/user-guide/tools/lambda-tools/lambda-vscode-extension/index.md new file mode 100644 index 0000000000..397438d398 --- /dev/null +++ b/content/en/user-guide/tools/lambda-tools/lambda-vscode-extension/index.md @@ -0,0 +1,46 @@ +--- +title: "Lambda VSCode Extension" +weight: 9 +description: > + Deploy and invoke Lambda functions in LocalStack directly from VSCode +--- + +## Introduction + +[LocalStack Lambda VSCode Extension](https://github.com/localstack/localstack-vscode-extension) supports deploying and invoking Python Lambda functions through [AWS SAM](https://github.com/aws/serverless-application-model) or [AWS CloudFormation](https://aws.amazon.com/cloudformation/resources/templates/). + +## Prerequisites + +- [VS Code](https://code.visualstudio.com/) +- [`samlocal`](https://github.com/localstack/aws-sam-cli-local) command line wrapper around the [AWS SAM CLI](https://github.com/aws/aws-sam-cli) for use with [LocalStack](https://github.com/localstack/localstack). +- [LocalStack](https://docs.localstack.cloud/getting-started/) running in the background. + +## Getting Started + +You can use a [sample project](https://github.com/joe4dev/lambda-python) to get started with the extension. The sample project contains a simple Lambda function and a SAM template. Clone the repository and open the project in VSCode. + +{{< command >}} +$ git clone https://github.com/joe4dev/lambda-python.git +$ cd lambda-python +$ code . +{{< /command >}} + +Install the [LocalStack VSCode Extension](https://marketplace.visualstudio.com/items?itemName=localstack.localstack) as recommended by the project. + +You can now open the Python handler function under `app/hello_world.py`. Click the CodeLens **Deploy Lambda function**, select the `template.yaml`, and choose a stack name such as `my-stack`. + + +Deploying Lambda function via the VS Code Extension +

+ + +Click the CodeLens **Invoke Lambda function** and pick the stack name `my-stack` and the function `hello-world-function`. + + +Invoking Lambda function via the VS Code Extension +
+ +## Limitations + +- The CodeLens for **Deploy Lambda function** always appears at the first line of each Python file. +- **Invoke Lambda function** currently only works in the region `us-east-1` and with an empty payload. diff --git a/content/en/user-guide/tools/lambda-tools/lambda-vscode-extension/invoke-lambda-function.gif b/content/en/user-guide/tools/lambda-tools/lambda-vscode-extension/invoke-lambda-function.gif new file mode 100644 index 0000000000..3b8e163c6d Binary files /dev/null and b/content/en/user-guide/tools/lambda-tools/lambda-vscode-extension/invoke-lambda-function.gif differ