Skip to content

Commit 23a2044

Browse files
committed
Migrate from the localstack CLI to lstk
1 parent 4c520a0 commit 23a2044

3 files changed

Lines changed: 19 additions & 31 deletions

File tree

.github/workflows/ci.yml

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,15 @@ jobs:
2323
- name: Checkout
2424
uses: actions/checkout@v4
2525

26-
- uses: gautamkrishnar/keepalive-workflow@v1
27-
2826
- name: Setup Node.js
2927
uses: actions/setup-node@v4
3028
with:
3129
node-version: 18
3230

3331
- name: Install CDK
3432
run: |
35-
npm install -g aws-cdk-local aws-cdk
36-
cdklocal --version
33+
npm install -g @localstack/lstk aws-cdk
34+
cdk --version
3735
3836
- name: Install Python
3937
uses: actions/setup-python@v4
@@ -48,14 +46,8 @@ jobs:
4846
env:
4947
LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }}
5048
run: |
51-
pip install localstack awscli-local[ver1]
5249
docker pull localstack/localstack-pro:latest
53-
# Start LocalStack in the background
54-
DEBUG=1 localstack start -d
55-
# Wait 30 seconds for the LocalStack container to become ready before timing out
56-
echo "Waiting for LocalStack startup..."
57-
localstack wait -t 15
58-
echo "Startup complete"
50+
LOCALSTACK_DEBUG=1 lstk start
5951
6052
- name: Deploy using CDK
6153
env:
@@ -64,8 +56,8 @@ jobs:
6456
AWS_ACCESS_KEY_ID: test
6557
AWS_SECRET_ACCESS_KEY: test
6658
run: |
67-
cdklocal bootstrap aws://000000000000/us-east-1
68-
cdklocal deploy --require-approval never
59+
lstk cdk bootstrap aws://000000000000/us-east-1
60+
lstk cdk deploy --require-approval never
6961
7062
- name: Send a Slack notification
7163
if: failure() || github.event_name != 'pull_request'

Makefile

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,23 @@ usage: ## Show this help
77
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
88

99
install: ## Install dependencies
10-
@which localstack || pip install localstack
11-
@which awslocal || pip install awscli-local
10+
@which lstk || npm install -g @localstack/lstk
1211
virtualenv env
1312
. env/bin/activate && pip install -r requirements.txt
1413

1514
start: ## Start LocalStack
1615
@test -n "${LOCALSTACK_AUTH_TOKEN}" || (echo "LOCALSTACK_AUTH_TOKEN is not set. Find your token at https://app.localstack.cloud/workspace/auth-token"; exit 1)
17-
@LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) localstack start -d
16+
@LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) lstk start
1817

1918
stop: ## Stop LocalStack
20-
@localstack stop
19+
@lstk stop
2120

22-
ready: ## Wait until LocalStack is ready
23-
@echo Waiting on the LocalStack container...
24-
@localstack wait -t 30 && echo LocalStack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1)
2521

2622
logs: ## Save the logs in a separate file
27-
@localstack logs > logs.txt
23+
@lstk logs > logs.txt
2824

2925
deploy: ## Deploy the CDK stack
30-
cdklocal bootstrap
31-
cdklocal deploy --require-approval never
26+
lstk cdk bootstrap
27+
lstk cdk deploy --require-approval never
3228

33-
.PHONY: usage install start stop ready logs deploy
29+
.PHONY: usage install start stop logs deploy

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ The sample code in this repository demonstrates how to use the ECS Code Mounting
1919

2020
## Prerequisites
2121

22-
- A valid [LocalStack for AWS license](https://localstack.cloud/pricing). Your license provides a [`LOCALSTACK_AUTH_TOKEN`](https://docs.localstack.cloud/getting-started/auth-token/) to activate LocalStack.
23-
- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli).
24-
- [Cloud Development Kit](https://docs.localstack.cloud/user-guide/integrations/aws-cdk/) with the [`cdklocal`](https://www.npmjs.com/package/aws-cdk-local) installed.
22+
- A valid [LocalStack for AWS license](https://localstack.cloud/pricing). Your license provides a [`LOCALSTACK_AUTH_TOKEN`](https://docs.localstack.cloud/aws/getting-started/auth-token/) to activate LocalStack.
23+
- [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) to manage the LocalStack container lifecycle. The AWS CLI is required by `lstk aws`.
24+
- [Cloud Development Kit](https://docs.localstack.cloud/user-guide/integrations/aws-cdk/) used via the `lstk cdk` proxy.
2525
- [Python 3.9+](https://www.python.org/downloads/) & `pip` package manager.
2626
- [`virtualenv`](https://pypi.org/project/virtualenv/) for creating isolated Python environments.
2727
- `cURL` or any other tool to send HTTP requests.
@@ -30,7 +30,7 @@ Start LocalStack with the `LOCALSTACK_AUTH_TOKEN` pre-configured:
3030

3131
```shell
3232
export LOCALSTACK_AUTH_TOKEN=<your-auth-token>
33-
localstack start
33+
lstk start
3434
```
3535

3636
## Instructions
@@ -52,13 +52,13 @@ pip install -r requirements.txt
5252
To bootstrap the CDK, run the following command:
5353

5454
```shell
55-
cdklocal bootstrap
55+
lstk cdk bootstrap
5656
```
5757

5858
To deploy the infrastructure, run the following command:
5959

6060
```shell
61-
cdklocal deploy
61+
lstk cdk deploy
6262
```
6363

6464
You are expected to see the following output:
@@ -124,7 +124,7 @@ Hello, ECS Code Mounting!
124124
To clean up the resources, run the following command:
125125

126126
```shell
127-
localstack stop
127+
lstk stop
128128
```
129129

130130
## How do I set up the ECS Code Mounting feature?

0 commit comments

Comments
 (0)