Skip to content

Commit b41c135

Browse files
docs(aws/developer-tools): migrate /aws/developer-tools section to use lstk (#815)
1 parent 4add57f commit b41c135

16 files changed

Lines changed: 152 additions & 114 deletions

File tree

astro.config.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -482,10 +482,6 @@ export default defineConfig({
482482
label: 'Overview',
483483
slug: 'aws/developer-tools/running-localstack',
484484
},
485-
{
486-
label: 'LocalStack CLI',
487-
slug: 'aws/developer-tools/running-localstack/localstack-cli',
488-
},
489485
{
490486
label: 'lstk CLI',
491487
slug: 'aws/developer-tools/running-localstack/lstk',
@@ -498,6 +494,10 @@ export default defineConfig({
498494
label: 'LocalStack Desktop',
499495
slug: 'aws/developer-tools/running-localstack/localstack-desktop',
500496
},
497+
{
498+
label: 'Deprecated LocalStack CLI',
499+
slug: 'aws/developer-tools/running-localstack/localstack-cli',
500+
},
501501
],
502502
},
503503
{

src/components/SectionCards.astro

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ interface Props {
77
title?: string;
88
customTitles?: Record<string, string>;
99
useDirectFiles?: boolean;
10+
excludeFiles?: string[];
1011
}
1112
12-
const { basePath, title, customTitles = {}, useDirectFiles = false } = Astro.props;
13+
const { basePath, title, customTitles = {}, useDirectFiles = false, excludeFiles = [] } = Astro.props;
1314
1415
// Get sections - either index files from subdirectories or direct files
1516
const allSections = await getCollection('docs', ({ id }) => {
@@ -49,14 +50,18 @@ const sortedSections = allSections.sort((a, b) => {
4950
return titleA.localeCompare(titleB);
5051
});
5152
52-
const sectionData = sortedSections.map(section => {
53+
const sectionData = sortedSections.flatMap(section => {
5354
// Extract the key name from the section ID
5455
const relativePath = section.id.substring(basePath.length);
5556
const keyName = relativePath.split('/').filter(part => part !== '')[0];
56-
57+
5758
// For direct files, we need to remove the file extension from the key
5859
const cleanKey = useDirectFiles ? keyName.replace(/\.(md|mdx)$/, '') : keyName;
59-
60+
61+
if (excludeFiles.includes(cleanKey)) {
62+
return [];
63+
}
64+
6065
// Use custom title if provided, otherwise fall back to the section title
6166
const sectionTitle = customTitles[cleanKey] || section.data.title || section.data.linkTitle || 'Unknown Section';
6267
const description = section.data.description || `Learn more about ${sectionTitle}`;

src/content/docs/aws/developer-tools/aws-replicator/index.mdx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,14 @@ LocalStack AWS Replicator creates identical copies of AWS resources in a running
2020
This means that external resources can easily be replicated before deploying the main application, and removes the need to change existing stacks or create custom infrastructure, making LocalStack setup easier.
2121

2222
:::note
23-
The AWS Replicator is in a preview state, supporting only [selected resources](#supported-resources).
23+
The AWS Replicator is in a preview state, supporting only [selected resources](#supported-resources). The new CLI experience, `lstk`, does not yet support the AWS Replicator.
24+
Continue using the legacy [LocalStack CLI](/aws/developer-tools/running-localstack/localstack-cli/) version 4.2.0 or newer.
2425
:::
2526

2627
## Getting started
2728

2829
A valid `LOCALSTACK_AUTH_TOKEN` must be configured to start the LocalStack for AWS image.
2930

30-
:::note
31-
The Replicator is in limited preview and is available from LocalStack CLI version 4.2.0.
32-
If you encounter issues, update your [LocalStack CLI](/aws/getting-started/installation/#update-localstack-cli).
33-
:::
3431

3532
### Retrieve credentials to access AWS
3633

src/content/docs/aws/developer-tools/chaos-engineering/chaos-api.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ If you'd like to try it out, please [contact us](https://www.localstack.cloud/de
3333

3434
The prerequisites for this guide are:
3535

36-
- LocalStack for AWS and [LocalStack CLI](/aws/getting-started/installation/)
36+
- LocalStack for AWS and [`lstk`](/aws/developer-tools/running-localstack/lstk/#installation)
3737
- [LocalStack Auth Token](/aws/getting-started/auth-token/)
3838
- [Docker](https://docs.docker.com/get-docker/) and [Docker Compose](https://docs.docker.com/compose/install/)
3939
- [Python](https://www.python.org/downloads/)
@@ -119,7 +119,7 @@ All calls to these services in these regions will return a 503 Service Unavailab
119119
To see this in action, try to create an S3 bucket in `us-east-1`:
120120

121121
```bash
122-
awslocal s3 mb s3://test-bucket --region us-east-1
122+
lstk aws s3 mb s3://test-bucket --region us-east-1
123123
```
124124

125125
```bash
@@ -129,7 +129,7 @@ make_bucket failed: s3://test-bucket An error occurred (ServiceUnavailableExcept
129129
However, the same operation, when run in `eu-central-1` will work as expected.
130130

131131
```bash
132-
awslocal s3 mb s3://test-bucket --region eu-central-1
132+
lstk aws s3 mb s3://test-bucket --region eu-central-1
133133
```
134134

135135
```bash

src/content/docs/aws/developer-tools/cloud-sandbox/app-preview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ preview-cmd: |
105105
make deploy;
106106
make build-frontend;
107107
make deploy-frontend;
108-
distributionId=$(awslocal cloudfront list-distributions | jq -r '.DistributionList.Items[0].Id');
108+
distributionId=$(lstk aws cloudfront list-distributions | jq -r '.DistributionList.Items[0].Id');
109109
echo LS_PREVIEW_URL=$AWS_ENDPOINT_URL/cloudfront/$distributionId/ >> $GITHUB_ENV;
110110
```
111111

src/content/docs/aws/developer-tools/cloud-sandbox/ephemeral-instances.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ Ephemeral Instances allows you to run a LocalStack instance in the cloud.
1313
You can interact with these instances via the LocalStack Web Application, or by configuring your integrations and developer tools with the endpoint URL of the ephemeral instance.
1414

1515
:::note
16-
Ephemeral Instances is offered as a **preview** feature and is under active development.
16+
Ephemeral Instances is offered as a **preview** feature. `lstk` does not yet support Ephemeral Instances.
17+
Continue using the legacy [LocalStack CLI](/aws/developer-tools/running-localstack/localstack-cli/) for this feature.
1718
:::
1819

1920
## Getting started

src/content/docs/aws/developer-tools/lambda-tools/hot-reloading.mdx

Lines changed: 11 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ To create the Lambda function, you just need to take care of two things:
142142
So, using the AWS example, this would be:
143143

144144
```bash
145-
awslocal lambda create-function --function-name my-cool-local-function \
145+
lstk aws lambda create-function --function-name my-cool-local-function \
146146
--code S3Bucket="hot-reload",S3Key="/tmp/aws-doc-sdk-examples/python/example_code/lambda" \
147147
--handler lambda_handler_basic.lambda_handler \
148148
--runtime python3.8 \
@@ -153,23 +153,12 @@ You can also check out some of our [Deployment Configuration Examples](#deployme
153153

154154
We can also quickly make sure that it works by invoking it with a simple payload:
155155

156-
<Tabs>
157-
<TabItem label="AWS CLI v1">
158156
```bash
159-
awslocal lambda invoke --function-name my-cool-local-function \
160-
--payload '{"action": "increment", "number": 3}' \
161-
output.txt
162-
```
163-
</TabItem>
164-
<TabItem label="AWS CLI v2">
165-
```bash
166-
awslocal lambda invoke --function-name my-cool-local-function \
157+
lstk aws lambda invoke --function-name my-cool-local-function \
167158
--cli-binary-format raw-in-base64-out \
168159
--payload '{"action": "increment", "number": 3}' \
169160
output.txt
170161
```
171-
</TabItem>
172-
</Tabs>
173162

174163
The invocation returns itself returns:
175164

@@ -332,10 +321,10 @@ To create the Lambda function, you need to take care of two things:
332321
* Set the S3 key to the path of the directory your lambda function resides in.
333322
The handler is then referenced by the filename of your lambda code and the function in that code that needs to be invoked.
334323

335-
Create the Lambda Function using the `awslocal` CLI:
324+
Create the Lambda Function using `lstk aws`:
336325

337326
```bash
338-
awslocal lambda create-function \
327+
lstk aws lambda create-function \
339328
--function-name hello-world \
340329
--runtime "nodejs16.x" \
341330
--role arn:aws:iam::123456789012:role/lambda-ex \
@@ -345,25 +334,13 @@ awslocal lambda create-function \
345334

346335
You can quickly make sure that it works by invoking it with a simple payload:
347336

348-
<Tabs>
349-
<TabItem label="AWS CLI v1">
350337
```bash
351-
awslocal lambda invoke \
352-
--function-name hello-world \
353-
--payload '{"action": "test"}' \
354-
output.txt
355-
```
356-
</TabItem>
357-
<TabItem label="AWS CLI v2">
358-
```bash
359-
awslocal lambda invoke \
338+
lstk aws lambda invoke \
360339
--function-name hello-world \
361340
--cli-binary-format raw-in-base64-out \
362341
--payload '{"action": "test"}' \
363342
output.txt
364343
```
365-
</TabItem>
366-
</Tabs>
367344

368345
The invocation returns itself returns:
369346

@@ -422,10 +399,10 @@ This is enabled using the [`nodemon-webpack-plugin`](https://www.npmjs.com/packa
422399

423400
##### Creating the Lambda Function with Webpack
424401

425-
You can now create the Lambda function using the `awslocal` CLI:
402+
You can now create the Lambda function using `lstk aws`:
426403

427404
```bash
428-
awslocal lambda create-function \
405+
lstk aws lambda create-function \
429406
--function-name localstack-example \
430407
--runtime nodejs18.x \
431408
--role arn:aws:iam::000000000000:role/lambda-ex \
@@ -436,7 +413,7 @@ awslocal lambda create-function \
436413
Additionally, you can create a Lambda Function URL with the following command:
437414

438415
```bash
439-
function_url=$(awslocal lambda create-function-url-config \
416+
function_url=$(lstk aws lambda create-function-url-config \
440417
--function-name localstack-example \
441418
--auth-type NONE | jq -r '.FunctionUrl')
442419
```
@@ -629,8 +606,8 @@ LAMBDA_MOUNT_CWD=$(pwd)/build/hot serverless deploy --stage local
629606
<TabItem label="AWS Cloud Development Kit (CDK)">
630607
```bash
631608
STAGE=local && LAMBDA_MOUNT_CWD=$(pwd)/build/hot &&
632-
cdklocal bootstrap aws://000000000000/$(AWS_REGION) && \
633-
cdklocal deploy
609+
lstk cdk bootstrap aws://000000000000/$(AWS_REGION) && \
610+
lstk cdk deploy
634611
```
635612
</TabItem>
636613
<TabItem label="Terraform">
@@ -686,7 +663,7 @@ Please note that this environment variable name is arbitrary - you can use any y
686663
You can then deploy a hot-reloading function with the following command:
687664

688665
```bash
689-
awslocal lambda create-function \
666+
lstk aws lambda create-function \
690667
--function-name test-function \
691668
--code S3Bucket=hot-reload,S3Key='$HOST_LAMBDA_DIR/src' \
692669
--handler handler.handler \

src/content/docs/aws/developer-tools/lambda-tools/remote-debugging.mdx

Lines changed: 43 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ This guide describes how to use the AWS Toolkit for VS Code to debug Lambda func
4242

4343
### Prerequisites
4444

45-
* Upgrade to LocalStack v4.8 (or higher) for both your LocalStack CLI and your LocalStack Docker image.
45+
* Install the [`lstk` CLI](/aws/developer-tools/running-localstack/lstk)
4646
* [VS Code](https://code.visualstudio.com/) (>= v1.83.0)
4747
* [AWS Toolkit for VS Code](https://marketplace.visualstudio.com/items?itemName=AmazonWebServices.aws-toolkit-vscode) (>= v3.74)
4848
* [LocalStack Toolkit for VS Code](https://marketplace.visualstudio.com/items?itemName=LocalStack.localstack) (>= v1.2.0)
@@ -196,10 +196,19 @@ necessary tools and flexibility to troubleshoot effectively.
196196

197197
To enable Lambda Debug Mode, set the `LAMBDA_DEBUG_MODE` environment variable as shown below:
198198

199+
```toml
200+
# .lstk/config.toml
201+
[[containers]]
202+
type = "aws"
203+
env = ["lambda-debug"]
204+
205+
[env.lambda-debug]
206+
LAMBDA_DEBUG_MODE = "1"
207+
LAMBDA_DOCKER_FLAGS = "-p 19891:19891"
208+
```
209+
199210
```bash
200-
LAMBDA_DEBUG_MODE=1 \
201-
LAMBDA_DOCKER_FLAGS='-p 19891:19891' \
202-
localstack start
211+
lstk start
203212
```
204213

205214
When enabled, Lambda Debug Mode automatically adjusts timeouts to accommodate debugging needs:
@@ -217,11 +226,21 @@ Manually setting `LAMBDA_DOCKER_FLAGS` is unnecessary when using this configurat
217226
Here is an example of mounting a `debug_config.yaml` in your LocalStack container to start your Debug Mode:
218227

219228
<Tabs>
220-
<TabItem label="LocalStack CLI">
229+
<TabItem label="lstk">
230+
```toml
231+
# .lstk/config.toml
232+
[[containers]]
233+
type = "aws"
234+
env = ["lambda-debug-advanced"]
235+
volumes = ["/path/to/debug-config.yaml:/tmp/lambda_debug_mode_config.yaml"]
236+
237+
[env.lambda-debug-advanced]
238+
LAMBDA_DEBUG_MODE = "1"
239+
LAMBDA_DEBUG_MODE_CONFIG_PATH = "/tmp/debug_config.yaml"
240+
```
241+
221242
```bash
222-
LOCALSTACK_LAMBDA_DEBUG_MODE=1 \
223-
LOCALSTACK_LAMBDA_DEBUG_MODE_CONFIG_PATH=/tmp/debug_config.yaml \
224-
localstack start --volume /path/to/debug-config.yaml:/tmp/lambda_debug_mode_config.yaml
243+
lstk start
225244
```
226245
</TabItem>
227246
<TabItem label="Docker Compose">
@@ -338,8 +357,18 @@ to [iterate quickly over your function code](/aws/developer-tools/lambda-tools/h
338357

339358
First, make sure that LocalStack is started with the following configuration (see the [Configuration docs](/aws/customization/configuration-options#lambda) for more information):
340359

360+
```toml
361+
# .lstk/config.toml
362+
[[containers]]
363+
type = "aws"
364+
env = ["lambda-debug"]
365+
366+
[env.lambda-debug]
367+
LAMBDA_DOCKER_FLAGS = "-p 19891:19891"
368+
```
369+
341370
```bash
342-
LAMBDA_DOCKER_FLAGS='-p 19891:19891' localstack start
371+
lstk start
343372
```
344373

345374
#### Preparing your code
@@ -479,7 +508,7 @@ To create the Lambda function, you just need to take care of two things:
479508
Using the AWS CLI, this would be:
480509

481510
```bash
482-
awslocal lambda create-function --function-name my-cool-local-function \
511+
lstk aws lambda create-function --function-name my-cool-local-function \
483512
--code S3Bucket="hot-reload",S3Key="$(pwd)/" \
484513
--handler handler.handler \
485514
--runtime python3.13 \
@@ -489,23 +518,12 @@ awslocal lambda create-function --function-name my-cool-local-function \
489518

490519
We can quickly verify that it works by invoking it with a simple payload:
491520

492-
<Tabs>
493-
<TabItem label="AWS CLI v1">
494521
```bash
495-
awslocal lambda invoke --function-name my-cool-local-function \
496-
--payload '{"message": "Hello from LocalStack!"}' \
497-
output.txt
498-
```
499-
</TabItem>
500-
<TabItem label="AWS CLI v2">
501-
```bash
502-
awslocal lambda invoke --function-name my-cool-local-function \
522+
lstk aws lambda invoke --function-name my-cool-local-function \
503523
--cli-binary-format raw-in-base64-out \
504524
--payload '{"message": "Hello from LocalStack!"}' \
505525
output.txt
506526
```
507-
</TabItem>
508-
</Tabs>
509527

510528
### Debugging JVM Lambda functions
511529

@@ -527,7 +545,7 @@ services:
527545
When creating your Lambda function, set the `_JAVA_OPTIONS` environment variable like so:
528546

529547
```bash
530-
awslocal lambda create-function --function-name debugfunc \
548+
lstk aws lambda create-function --function-name debugfunc \
531549
--zip-file fileb://java-handler.zip \
532550
--handler myindex.handler \
533551
--runtime java8.al2 \
@@ -688,7 +706,7 @@ exports.handler = async (event) => {
688706
Create the lambda function using:
689707

690708
```bash
691-
awslocal lambda create-function --function-name func1 \
709+
lstk aws lambda create-function --function-name func1 \
692710
--code S3Bucket="hot-reload",S3Key="$(pwd)/" \
693711
--handler myindex.handler \
694712
--runtime nodejs14.x \
@@ -700,23 +718,12 @@ Now to debug your lambda function, click on the `Debug` icon with
700718
`Attach to Remote Node.js` configuration selected, and then invoke your
701719
lambda function:
702720

703-
<Tabs>
704-
<TabItem label="AWS CLI v1">
705-
```bash
706-
awslocal lambda invoke --function-name func1 \
707-
--payload '{"hello":"world"}' \
708-
output.txt
709-
```
710-
</TabItem>
711-
<TabItem label="AWS CLI v2">
712721
```bash
713-
awslocal lambda invoke --function-name func1 \
722+
lstk aws lambda invoke --function-name func1 \
714723
--cli-binary-format raw-in-base64-out \
715724
--payload '{"hello":"world"}' \
716725
output.txt
717726
```
718-
</TabItem>
719-
</Tabs>
720727

721728

722729
## Examples

0 commit comments

Comments
 (0)