-
Notifications
You must be signed in to change notification settings - Fork 0
Migrate from the localstack CLI to lstk #5
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: main
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 |
|---|---|---|
|
|
@@ -7,26 +7,24 @@ usage: ## Show this help | |
| @fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$//' | sed -e 's/##//' | ||
|
|
||
| install: ## Install dependencies | ||
| @which localstack || pip install localstack | ||
| @which awslocal || pip install awscli-local | ||
| @which cdklocal || npm install -g aws-cdk-local aws-cdk | ||
| @which lstk || npm install -g @localstack/lstk aws-cdk | ||
|
|
||
| start: ## Start LocalStack | ||
| @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) localstack start -d | ||
| @LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) lstk start --non-interactive | ||
|
|
||
| stop: ## Stop LocalStack | ||
| @localstack stop | ||
| @lstk stop | ||
|
|
||
| ready: ## Wait until LocalStack is 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. I suggest removing 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) | ||
|
|
||
| logs: ## Save the logs in a separate file | ||
| @localstack logs > logs.txt | ||
| @lstk logs > logs.txt | ||
|
|
||
| deploy: ## Deploy infrastructure using CDK | ||
| cd cdk-user-microservice/src/CdkUserMicroservice && dotnet build | ||
| cd cdk-user-microservice && cdklocal bootstrap && cdklocal deploy --require-approval never | ||
| cd cdk-user-microservice && lstk cdk bootstrap && lstk cdk deploy --require-approval never | ||
|
|
||
| .PHONY: usage install start stop ready logs deploy | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,9 +31,9 @@ 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). | ||
| - [Cloud Development Kit](https://docs.localstack.cloud/user-guide/integrations/aws-cdk/) with the [`cdklocal`](https://www.npmjs.com/package/aws-cdk-local) installed. | ||
| - 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/). | ||
| - [Cloud Development Kit](https://docs.localstack.cloud/user-guide/integrations/aws-cdk/) installed, deployed via the `lstk cdk` proxy. | ||
| - [.NET Core 7.0](https://dotnet.microsoft.com/en-us/download/dotnet/7.0) or later and [.NET Core Global Tools for AWS](https://aws.amazon.com/blogs/developer/net-core-global-tools-for-aws/) | ||
|
|
||
| ## Start LocalStack | ||
|
|
@@ -46,7 +46,7 @@ make start | |
| make ready | ||
| ``` | ||
|
|
||
| We specified DEBUG=1 to get the printed LocalStack logs directly in the terminal to help us visualize the background tasks 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 DEBUG=1 to get the printed LocalStack logs directly in the terminal to help us visualize the background tasks in action. If you prefer running LocalStack in detached mode, 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 | ||
|
|
||
|
|
@@ -64,13 +64,13 @@ cd ../../.. | |
|
|
||
| ### Deploying the CDK code | ||
|
|
||
| To create the AWS infrastructure locally, you can use CDK and `cdklocal` wrapper. To deploy the infrastructure, you can run the following commands: | ||
| To create the AWS infrastructure locally, you can use CDK and the `lstk cdk` proxy. To deploy the infrastructure, you can run the following commands: | ||
|
|
||
| ```bash | ||
| cd cdk-user-microservice/src/CdkUserMicroservice && dotnet build | ||
| cd ../.. | ||
| cdklocal bootstrap | ||
| cdklocal deploy | ||
| lstk cdk bootstrap | ||
| lstk cdk deploy | ||
| ``` | ||
|
|
||
| This will deploy the `CdkUserMicroserviceStack` stack on LocalStack. You will see the following output: | ||
|
|
||
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.
Is there another way of solving this problem? The "keepalive" is necessary to ensure these samples are tested on a regular basis.