-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e777f49
commit caf8ffe
Showing
3 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
Binary file added
BIN
+3.41 MB
content/en/user-guide/tools/lambda-vscode-extension/deploy-lambda-function.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 46 additions & 0 deletions
46
content/en/user-guide/tools/lambda-vscode-extension/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`. | ||
|
||
|
||
<img src="deploy-lambda-function.gif" alt="CloudFormation Output on Former2 Dashboard" title="CloudFormation Output on Former2 Dashboard" width="700" /> | ||
<br><br> | ||
|
||
|
||
Click the CodeLens **Invoke Lambda function** and pick the stack name `my-stack` and the function `hello-world-function`. | ||
|
||
|
||
<img src="invoke-lambda-function.gif" alt="CloudFormation Output on Former2 Dashboard" title="CloudFormation Output on Former2 Dashboard" width="700" /> | ||
<br> | ||
|
||
## 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. |
Binary file added
BIN
+162 KB
content/en/user-guide/tools/lambda-vscode-extension/invoke-lambda-function.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.