-
Notifications
You must be signed in to change notification settings - Fork 3
Migrate from the localstack CLI to lstk #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,35 +9,35 @@ usage: | |
|
|
||
| ## Install dependencies | ||
| install: | ||
| @which localstack || pip install localstack | ||
| @which awslocal || pip install awscli-local | ||
| @which samlocal || pip install aws-sam-cli-local | ||
| @which lstk || npm install -g @localstack/lstk | ||
| @which aws || pip install awscli | ||
| @which sam || pip install aws-sam-cli | ||
|
|
||
| # Deploy the infrastructure | ||
| build: | ||
| samlocal build; | ||
| lstk sam build; | ||
|
|
||
| ## Deploy the infrastructure | ||
| deploy: | ||
| samlocal deploy --resolve-s3 --no-confirm-changeset; | ||
| lstk sam deploy --resolve-s3 --no-confirm-changeset; | ||
|
|
||
| ## Start LocalStack in detached mode | ||
| start: | ||
| @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) | ||
| @LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) DEBUG=1 localstack start -d | ||
| @LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) LOCALSTACK_DEBUG=1 lstk start --non-interactive | ||
|
|
||
| ## Stop the Running LocalStack container | ||
| stop: | ||
| @echo | ||
| localstack stop | ||
| lstk stop | ||
|
|
||
| ## Make sure the LocalStack container is up | ||
| ready: | ||
| @echo Waiting on the LocalStack container... | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the samples that I've modified, I generally removed the |
||
| @localstack wait -t 30 && echo LocalStack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) | ||
| @lstk status && echo LocalStack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) | ||
|
|
||
| ## Save the logs in a separate file, since the LS container will only contain the logs of the last sample run. | ||
| logs: | ||
| @localstack logs > logs.txt | ||
| @lstk logs > logs.txt | ||
|
|
||
| .PHONY: usage install run start stop ready logs | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,10 +35,10 @@ We are using the following AWS services and their features to build our infrastr | |
|
|
||
| ## Prerequisites | ||
|
|
||
| - 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. | ||
| - [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli). | ||
| - [Serverless Application Model](https://docs.localstack.cloud/user-guide/integrations/aws-sam/) with the [`samlocal`](https://github.com/localstack/aws-sam-cli-local) installed. | ||
| - [AWS CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) with the [`awslocal` wrapper](https://docs.localstack.cloud/user-guide/integrations/aws-cli/#localstack-aws-cli-awslocal). | ||
| - 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. | ||
| - [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/). | ||
| - [Serverless Application Model](https://docs.localstack.cloud/user-guide/integrations/aws-sam/) with `aws-sam-cli` installed, used via the `lstk sam` proxy. | ||
| - [AWS CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/), required by `lstk aws`. | ||
| - [Python 3.9.0](https://www.python.org/downloads/release/python-390/) in the `PATH` | ||
|
|
||
| ## Start LocalStack | ||
|
|
@@ -51,7 +51,7 @@ make start | |
| make ready | ||
| ``` | ||
|
|
||
| We specified `DEBUG=1` to get the printed LocalStack logs directly in the terminal to help us see the event-driven architecture in action. If you prefer running LocalStack in detached mode, you can add the `-d` flag to the `localstack start` command, and use Docker Desktop to view the logs. | ||
| We specified `LOCALSTACK_DEBUG=1` to get the printed LocalStack logs directly in the terminal to help us see the event-driven architecture in action. If you prefer running LocalStack in the background, you can add the `--non-interactive` flag to the `lstk start` command, and use Docker Desktop to view the logs. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not correct, since |
||
|
|
||
| ## Instructions | ||
|
|
||
|
|
@@ -62,7 +62,7 @@ You can build and deploy the sample application on LocalStack by running our `Ma | |
| To build the SAM application, run the following command: | ||
|
|
||
| ```shell | ||
| samlocal build | ||
| lstk sam build | ||
| ``` | ||
|
|
||
| If you see a `Build Succeeded` message, you can proceed to the next step. | ||
|
|
@@ -74,24 +74,24 @@ If you see a `Build Succeeded` message, you can proceed to the next step. | |
| To deploy the SAM application, run the following command: | ||
|
|
||
| ```shell | ||
| samlocal deploy --resolve-s3 | ||
| lstk sam deploy --resolve-s3 | ||
| ``` | ||
|
|
||
| The above command will create a new managed S3 bucket to store the artifacts of the SAM application. If you want to use an existing S3 bucket, you can use the `--s3-bucket` flag to specify the bucket name. Before being deployed, the CloudFormation changeset will be displayed in the terminal. If you want to deploy the application without confirmation, you can use the `--no-confirm-changeset` flag. | ||
|
|
||
| To view the created resources, check out the CloudFormation outputs from deployed stack or run the following commands | ||
|
|
||
| ```shell | ||
| awslocal sqs list-queues | ||
| awslocal sns list-topics | ||
| awslocal dynamodb list-tables | ||
| awslocal lambda list-functions | ||
| awslocal s3 ls | ||
| lstk aws sqs list-queues | ||
| lstk aws sns list-topics | ||
| lstk aws dynamodb list-tables | ||
| lstk aws lambda list-functions | ||
| lstk aws s3 ls | ||
| ``` | ||
|
|
||
| ### Testing the application | ||
|
|
||
| After a successful deployment, you can test the application's functionality by checking out the LocalStack logs (`localstack logs`). For more verbose logs, we have enabled `DEBUG=1`, and you can alternatively set `LS_LOG=trace-internal` to see internal calls between different services. | ||
| After a successful deployment, you can test the application's functionality by checking out the LocalStack logs (`lstk logs`). For more verbose logs, we have enabled `LOCALSTACK_DEBUG=1`, and you can alternatively set `LS_LOG=trace-internal` to see internal calls between different services. | ||
|
|
||
| We offer **Resource Browsers** in the LocalStack Web Application to help you visualize the resources created by the application. You can access the Web Application by visiting [**app.localstack.cloud**](https://app.localstack.cloud) in your browser. Navigate to the [CloudWatch Log Groups](https://app.localstack.cloud/resources/cloudwatch/groups) to verify the Log groups. | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this comment, and the
echofollowing it are a bit misleading. I suggest we only include best practices in our sample application, because that's what humans/agents will copy.