From 1993d31b60f48bc0632ef70a83cf89cb8cdb7bb3 Mon Sep 17 00:00:00 2001 From: Harsh Mishra Date: Thu, 15 Oct 2026 17:52:44 +0530 Subject: [PATCH 1/8] Migrate every sample from the localstack CLI to lstk Replace the localstack CLI with lstk across all samples, the archived samples, the root Makefile and README, and CI: - check/install targets look for lstk and install it with npm - start runs lstk start --non-interactive --type aws; settings the old CLI forwarded implicitly now carry the LOCALSTACK_ prefix that lstk forwards (DEBUG, EC2_VM_MANAGER, ENFORCE_IAM, SERVICES) - ready/logs/stop use lstk status, lstk logs and lstk stop - the Lambda debugging SAM samples mount their debug config through a project .lstk/config.toml instead of --volume - route53-dns-failover and java-notification-app manage LocalStack with Docker Compose, so they wait on the health endpoint and use docker compose logs/down instead of either CLI - CI installs lstk instead of the localstack Python package and passes LOCALSTACK_DEBUG and LOCALSTACK_DNS_ADDRESS - READMEs link the lstk docs and use lstk start / lstk login Claude-Session: https://claude.ai/code/session_01DZfDmzUBPqNAu3yFKyfCNM --- .github/workflows/test.yml | 10 ++++++---- Makefile | 7 +++---- README.md | 15 ++++++++------- apigw-custom-domain/Makefile | 11 +++++------ apigw-custom-domain/README.md | 2 +- appsync-graphql-api/Makefile | 12 ++++++------ appsync-graphql-api/README.md | 2 +- athena-s3-queries/Makefile | 14 +++++++------- athena-s3-queries/README.md | 2 +- cdk-resources/Makefile | 10 +++++----- cdk-resources/README.md | 2 +- chalice-rest-api/Makefile | 11 +++++------ chalice-rest-api/README.md | 2 +- cloudwatch-metrics-aws/Makefile | 11 +++++------ cloudwatch-metrics-aws/README.md | 2 +- codecommit-git-repo/Makefile | 12 ++++++------ codecommit-git-repo/README.md | 2 +- cognito-jwt/Makefile | 8 ++++---- cognito-jwt/README.md | 2 +- ec2-docker-instances/Makefile | 10 +++++----- ec2-docker-instances/README.md | 2 +- ecs-ecr-container-app/Makefile | 12 ++++++------ ecs-ecr-container-app/README.md | 2 +- emr-serverless-python-dependencies/Makefile | 8 ++++---- emr-serverless-python-dependencies/README.md | 2 +- emr-serverless-sample/Makefile | 11 +++++------ emr-serverless-sample/README.md | 2 +- emr-serverless-spark/Makefile | 10 +++++----- emr-serverless-spark/README.md | 2 +- glacier-s3-select/Makefile | 14 +++++++------- glacier-s3-select/README.md | 2 +- glue-etl-jobs/Makefile | 12 ++++++------ glue-etl-jobs/README.md | 2 +- glue-etl-jobs/run.sh | 2 +- glue-msk-schema-registry/Makefile | 12 ++++++------ glue-msk-schema-registry/README.md | 2 +- glue-redshift-crawler/Makefile | 12 ++++++------ glue-redshift-crawler/README.md | 2 +- iam-policy-enforcement/Makefile | 14 +++++++------- iam-policy-enforcement/README.md | 2 +- iot-basics/Makefile | 12 ++++++------ iot-basics/README.md | 2 +- java-notification-app/Makefile | 5 +++-- lambda-container-image/Makefile | 10 +++++----- lambda-container-image/README.md | 2 +- lambda-debugging-sam-java/.lstk/config.toml | 8 ++++++++ lambda-debugging-sam-java/Makefile | 9 ++++----- lambda-debugging-sam-java/README.md | 4 ++-- lambda-debugging-sam-javascript/.lstk/config.toml | 8 ++++++++ lambda-debugging-sam-javascript/Makefile | 8 ++++---- lambda-debugging-sam-javascript/README.md | 4 ++-- lambda-debugging-sam-python/.lstk/config.toml | 8 ++++++++ lambda-debugging-sam-python/Makefile | 9 ++++----- lambda-debugging-sam-python/README.md | 4 ++-- lambda-debugging-sam-typescript/.lstk/config.toml | 8 ++++++++ lambda-debugging-sam-typescript/Makefile | 9 ++++----- lambda-debugging-sam-typescript/README.md | 4 ++-- lambda-event-filtering/Makefile | 11 +++++------ lambda-event-filtering/README.md | 2 +- lambda-function-urls-javascript/Makefile | 11 +++++------ lambda-function-urls-javascript/README.md | 4 ++-- lambda-function-urls-python/Makefile | 11 +++++------ lambda-function-urls-python/README.md | 2 +- lambda-hot-reloading/Makefile | 11 +++++------ lambda-hot-reloading/README.md | 2 +- .../javascript-terraform-layers/README.md | 4 ++-- .../javascript-terraform/README.md | 4 ++-- lambda-hot-reloading/javascript/README.md | 4 ++-- .../lambda-typescript-webpack/README.md | 2 +- lambda-php-bref-cdk-app/Makefile | 12 ++++++------ lambda-php-bref-cdk-app/README.md | 2 +- lambda-xray/README.md | 4 ++-- lambda-xray/python-powertools/Makefile | 9 ++++----- lambda-xray/python-powertools/README.md | 4 ++-- lambda-xray/python-xray-sdk/Makefile | 9 ++++----- lambda-xray/python-xray-sdk/README.md | 4 ++-- mq-broker/Makefile | 12 ++++++------ mq-broker/README.md | 2 +- multi-account-multi-region-s3-access/Makefile | 15 +++++++-------- multi-account-multi-region-s3-access/README.md | 2 +- neptune-graph-db/Makefile | 14 +++++++------- neptune-graph-db/README.md | 2 +- rds-db-queries/Makefile | 12 ++++++------ rds-db-queries/README.md | 2 +- rds-failover-test/Makefile | 12 ++++++------ rds-failover-test/README.md | 2 +- reproducible-ml/Makefile | 12 ++++++------ reproducible-ml/README.md | 2 +- route53-dns-failover/Makefile | 9 ++++----- sagemaker-inference/Makefile | 11 +++++------ sagemaker-inference/ReadMe.md | 2 +- .../aws-sam-amplify-lambda-webapp/README.md | 2 +- sample-archive/azure-functions/Makefile | 2 +- sample-archive/cdk-for-terraform/Makefile | 11 +++++------ sample-archive/cdk-for-terraform/README.md | 2 +- sample-archive/cloudfront-distributions/Makefile | 4 ++-- sample-archive/cloudfront-distributions/README.md | 2 +- sample-archive/ec2-custom-ami/Makefile | 4 ++-- sample-archive/ec2-custom-ami/README.md | 2 +- sample-archive/emr-hadoop-spark-jobs/Makefile | 4 ++-- sample-archive/emr-hadoop-spark-jobs/README.md | 2 +- sample-archive/kinesis-analytics/Makefile | 4 ++-- sample-archive/kinesis-analytics/README.md | 2 +- sample-archive/mediastore-uploads/Makefile | 12 ++++++------ sample-archive/mediastore-uploads/README.md | 2 +- sample-archive/qldb-ledger-queries/Makefile | 12 ++++++------ sample-archive/qldb-ledger-queries/README.md | 2 +- sample-archive/sagemaker-ml-jobs/Makefile | 4 ++-- sample-archive/sagemaker-ml-jobs/README.md | 2 +- .../serverless-request-workers/Makefile | 4 ++-- serverless-lambda-layers/Makefile | 12 ++++++------ serverless-lambda-layers/README.md | 2 +- serverless-websockets/Makefile | 12 ++++++------ serverless-websockets/README.md | 2 +- stepfunctions-lambda/Makefile | 11 +++++------ stepfunctions-lambda/README.md | 2 +- terraform-resources/Makefile | 10 +++++----- terraform-resources/README.md | 2 +- transfer-ftp-s3/Makefile | 12 ++++++------ transfer-ftp-s3/README.md | 2 +- 120 files changed, 387 insertions(+), 370 deletions(-) create mode 100644 lambda-debugging-sam-java/.lstk/config.toml create mode 100644 lambda-debugging-sam-javascript/.lstk/config.toml create mode 100644 lambda-debugging-sam-python/.lstk/config.toml create mode 100644 lambda-debugging-sam-typescript/.lstk/config.toml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d60e97ca..0f0c04ee 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -38,9 +38,10 @@ jobs: with: node-version: 20 - - name: Install LocalStack + - name: Install lstk and the AWS CLI wrapper run: | - pip install localstack awscli-local[ver1] virtualenv + npm install -g @localstack/lstk + pip install awscli-local[ver1] virtualenv pip install --upgrade boto3 botocore - name: Setup config @@ -59,8 +60,9 @@ jobs: make test-ci env: LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }} - DEBUG: 1 - DNS_ADDRESS: 127.0.0.1 + # lstk forwards LOCALSTACK_-prefixed variables to the emulator container + LOCALSTACK_DEBUG: 1 + LOCALSTACK_DNS_ADDRESS: 127.0.0.1 - name: Compute sample name if: always() diff --git a/Makefile b/Makefile index a73b4346..e6013409 100644 --- a/Makefile +++ b/Makefile @@ -8,13 +8,12 @@ lint: ## Run code linter for all projects MAKE_TARGET='lint' make for-each-dir start: ## Start LocalStack infrastructure - localstack start -d - + lstk start --non-interactive --type aws ready: ## Check if the LocalStack container is up and running. - localstack wait -t 20 && echo "LocalStack is ready to use!" + lstk status > /dev/null && echo "LocalStack is ready to use!" stop: ## Stop LocalStack infrastructure - localstack stop + lstk stop for-each-dir: ./make-for-each.sh $$MAKE_TARGET $$CMD diff --git a/README.md b/README.md index c4722416..8b8d187e 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ Each example in the repository is prefixed with the name of the AWS service bein ## Prerequisites * [Docker](https://docs.docker.com/get-docker/) +* [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/), which starts LocalStack: `npm install -g @localstack/lstk` or `brew install localstack/tap/lstk` * [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) * [Serverless](https://www.serverless.com/framework/docs/getting-started) * [Terraform](https://developer.hashicorp.com/terraform/downloads) @@ -22,10 +23,10 @@ All samples require a valid [LocalStack for AWS license](https://localstack.clou export LOCALSTACK_AUTH_TOKEN= ``` -Alternatively, use the LocalStack CLI to persist the token: +Alternatively, log in with `lstk`, which stores your credentials: ```bash -localstack auth set-token +lstk login ``` You can find your Auth Token on the [LocalStack Web Application](https://app.localstack.cloud/workspace/auth-token). @@ -115,7 +116,7 @@ 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 lstk > /dev/null || npm install -g @localstack/lstk @which awslocal || pip install awscli-local ## install whatever else you need, like node modules, python packages, etc. @test -e node_modules || npm install @@ -126,18 +127,18 @@ run: ## Run the actual sample steps/commands. This assumes LocalStack is start: ## Start LocalStack in detached mode @test -n "${LOCALSTACK_AUTH_TOKEN}" || (echo "LOCALSTACK_AUTH_TOKEN is not set. Get your auth token at https://localstack.cloud/pricing."; exit 1) - localstack start -d + lstk start --non-interactive --type aws stop: ## Stop the Running LocalStack container @echo - localstack stop + lstk stop ready: ## Make sure the LocalStack container is up @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo LocalStack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo LocalStack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: ## Save the logs in a separate file, since the LS container will only contain the logs of the last sample run. - @localstack logs > logs.txt + @lstk logs > logs.txt test-ci: ## Execute the necessary targets in the correct order for an automatic execution. make start install ready run; return_code=`echo $$?`;\ diff --git a/apigw-custom-domain/Makefile b/apigw-custom-domain/Makefile index de2b3f97..ef25408b 100644 --- a/apigw-custom-domain/Makefile +++ b/apigw-custom-domain/Makefile @@ -11,7 +11,7 @@ check: ## Check if all required prerequisites are installed @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed. Please install AWS CLI and try again."; exit 1; } @command -v python > /dev/null 2>&1 || { echo "Python is not installed. Please install Python and try again."; exit 1; } @command -v openssl > /dev/null 2>&1 || { echo "OpenSSL is not installed. Please install OpenSSL and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack is not installed. Please install LocalStack and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies @@ -56,18 +56,17 @@ test: ## Run tests 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 start -d - + lstk start --non-interactive --type aws stop: ## Stop LocalStack @echo - localstack stop + lstk stop ready: ## Wait until LocalStack is ready @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: ## Retrieve LocalStack logs - @localstack logs > logs.txt + @lstk logs > logs.txt test-ci: ## Run CI tests make check start install ready test; return_code=`echo $$?`;\ diff --git a/apigw-custom-domain/README.md b/apigw-custom-domain/README.md index 8826e7af..50379e35 100644 --- a/apigw-custom-domain/README.md +++ b/apigw-custom-domain/README.md @@ -16,7 +16,7 @@ Under the hood, the Serverless framework uses the [`serverless-localstack`](http - 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. - [Docker](https://docs.docker.com/get-docker/) -- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli) +- [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) - [Node.js 18.x](https://nodejs.org/en/download/package-manager) with `npm` - [Serverless Framework](https://www.serverless.com/framework/docs/getting-started) 3.x diff --git a/appsync-graphql-api/Makefile b/appsync-graphql-api/Makefile index 764cc898..0ed04540 100644 --- a/appsync-graphql-api/Makefile +++ b/appsync-graphql-api/Makefile @@ -11,7 +11,7 @@ check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v node > /dev/null 2>&1 || { echo "Node.js is not installed. Please install Node.js and try again."; exit 1; } @command -v python3 > /dev/null 2>&1 || { echo "Python 3 is not installed. Please install Python 3 and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } @echo "All required prerequisites are available." @@ -19,7 +19,7 @@ check: ## Check if all required prerequisites are installed install: ## Install dependencies @test -e node_modules || npm install @which serverless || npm install -g serverless - @which localstack || pip install localstack + @which lstk > /dev/null || npm install -g @localstack/lstk @which awslocal || pip install awscli-local @test -e .venv || (python3 -m venv .venv; source .venv/bin/activate; pip install -r requirements.txt) @@ -27,17 +27,17 @@ run: ## Deploy the app locally and run an AppSync GraphQL test invocatio ./run.sh 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) - DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) localstack start -d + LOCALSTACK_DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) lstk start --non-interactive --type aws stop: @echo - localstack stop + lstk stop ready: @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: - @localstack logs > logs.txt + @lstk logs > logs.txt test-ci: make start install ready run; return_code=`echo $$?`;\ diff --git a/appsync-graphql-api/README.md b/appsync-graphql-api/README.md index 1b240d35..a6220533 100644 --- a/appsync-graphql-api/README.md +++ b/appsync-graphql-api/README.md @@ -14,7 +14,7 @@ A demo application illustrating how to proxy data from different resources (Dyna - 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. - [Docker](https://docs.docker.com/get-docker/) -- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli) +- [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) - [Python 3](https://www.python.org/downloads/) diff --git a/athena-s3-queries/Makefile b/athena-s3-queries/Makefile index d9a23343..d25997df 100644 --- a/athena-s3-queries/Makefile +++ b/athena-s3-queries/Makefile @@ -1,6 +1,6 @@ export AWS_ACCESS_KEY_ID ?= test export AWS_SECRET_ACCESS_KEY ?= test -export SERVICES = serverless,athena +export LOCALSTACK_SERVICES = serverless,athena export AWS_DEFAULT_REGION=us-east-1 usage: ## Show this help @@ -8,14 +8,14 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies # @test -e node_modules || npm install - @which localstack || pip install localstack + @which lstk > /dev/null || npm install -g @localstack/lstk @which awslocal || pip install awscli-local run: ## Set up database connections and run Athena queries locally @@ -24,17 +24,17 @@ run: ## Set up database connections and run Athena queries locally ./run.sh 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) - DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) localstack start -d + LOCALSTACK_DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) lstk start --non-interactive --type aws stop: @echo - localstack stop + lstk stop ready: @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: - @localstack logs > logs.txt + @lstk logs > logs.txt test-ci: # skip Athena tests for now, to avoid downloading large images in CI diff --git a/athena-s3-queries/README.md b/athena-s3-queries/README.md index 84693afe..642e2876 100644 --- a/athena-s3-queries/README.md +++ b/athena-s3-queries/README.md @@ -14,7 +14,7 @@ A demo application illustrating how to run Athena queries over S3 files locally - 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. - [Docker](https://docs.docker.com/get-docker/) -- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli) +- [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) - [Node.js](https://nodejs.org/en/download/) with `npm` diff --git a/cdk-resources/Makefile b/cdk-resources/Makefile index d04a361a..2434efc1 100644 --- a/cdk-resources/Makefile +++ b/cdk-resources/Makefile @@ -9,7 +9,7 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v node > /dev/null 2>&1 || { echo "Node.js is not installed. Please install Node.js and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v cdklocal > /dev/null 2>&1 || { echo "cdklocal is not installed. Please run: npm install -g aws-cdk-local"; exit 1; } @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } @echo "All required prerequisites are available." @@ -22,18 +22,18 @@ install-ci-dependencies: ## Install CI-only prerequisites 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) - DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) localstack start -d + LOCALSTACK_DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) lstk start --non-interactive --type aws stop: ## Stop LocalStack @echo - localstack stop + lstk stop ready: ## Wait until LocalStack is ready @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo LocalStack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo LocalStack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: ## Retrieve LocalStack logs - @localstack logs > logs.txt + @lstk logs > logs.txt deploy: ## Deploy CDK resources to LocalStack @cdklocal bootstrap diff --git a/cdk-resources/README.md b/cdk-resources/README.md index 14d0e328..3966aa5e 100644 --- a/cdk-resources/README.md +++ b/cdk-resources/README.md @@ -14,7 +14,7 @@ A demo application illustrating deployment of AWS resources locally using [AWS C - 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. - [Docker](https://docs.docker.com/get-docker/) -- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli) +- [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [`cdklocal`](https://github.com/localstack/aws-cdk-local) — install with `npm install -g aws-cdk-local` - [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) - [Node.js](https://nodejs.org/en/download/) with `npm` diff --git a/chalice-rest-api/Makefile b/chalice-rest-api/Makefile index 72cde03b..75af8317 100644 --- a/chalice-rest-api/Makefile +++ b/chalice-rest-api/Makefile @@ -9,7 +9,7 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v python3 > /dev/null 2>&1 || { echo "Python 3 is not installed. Please install Python 3 and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v chalice-local > /dev/null 2>&1 || { echo "chalice-local is not installed. Please run: pip install chalice-local"; exit 1; } @echo "All required prerequisites are available." @@ -18,18 +18,17 @@ install: ## Install dependencies 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 start -d - + lstk start --non-interactive --type aws stop: ## Stop LocalStack @echo - localstack stop + lstk stop ready: ## Wait until LocalStack is ready @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo LocalStack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo LocalStack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: ## Retrieve LocalStack logs - @localstack logs > logs.txt + @lstk logs > logs.txt deploy: ## Deploy the Chalice REST API to LocalStack @chalice-local deploy diff --git a/chalice-rest-api/README.md b/chalice-rest-api/README.md index 4ca304a6..d7e09982 100644 --- a/chalice-rest-api/README.md +++ b/chalice-rest-api/README.md @@ -14,7 +14,7 @@ A demo application illustrating the [AWS Chalice](https://github.com/aws/chalice - 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. - [Docker](https://docs.docker.com/get-docker/) -- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli) +- [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [`chalice-local`](https://github.com/localstack/chalice-local) — install with `pip install chalice-local` - [Python 3](https://www.python.org/downloads/) diff --git a/cloudwatch-metrics-aws/Makefile b/cloudwatch-metrics-aws/Makefile index 47444adc..0278deda 100644 --- a/cloudwatch-metrics-aws/Makefile +++ b/cloudwatch-metrics-aws/Makefile @@ -8,7 +8,7 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } @command -v jq > /dev/null 2>&1 || { echo "jq is not installed. Please install jq and try again."; exit 1; } @echo "All required prerequisites are available." @@ -18,18 +18,17 @@ install: ## Install dependencies 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 start -d - + lstk start --non-interactive --type aws stop: ## Stop LocalStack @echo - localstack stop + lstk stop ready: ## Wait until LocalStack is ready @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo LocalStack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo LocalStack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: ## Retrieve LocalStack logs - @localstack logs > logs.txt + @lstk logs > logs.txt run: ## Run the CloudWatch metrics alarm demo ./run.sh diff --git a/cloudwatch-metrics-aws/README.md b/cloudwatch-metrics-aws/README.md index a87d090d..a33d1482 100644 --- a/cloudwatch-metrics-aws/README.md +++ b/cloudwatch-metrics-aws/README.md @@ -20,7 +20,7 @@ To receive email notifications locally, you need a mock SMTP server such as [smt - 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. - [Docker](https://docs.docker.com/get-docker/) -- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli) +- [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) - [`jq`](https://stedolan.github.io/jq/) diff --git a/codecommit-git-repo/Makefile b/codecommit-git-repo/Makefile index b4122bcb..6c9345e0 100644 --- a/codecommit-git-repo/Makefile +++ b/codecommit-git-repo/Makefile @@ -9,13 +9,13 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v git > /dev/null 2>&1 || { echo "Git is not installed. Please install Git and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies - @which localstack || pip install localstack + @which lstk > /dev/null || npm install -g @localstack/lstk @which awslocal || pip install awscli-local run: ## Deploy and run the sample locally @@ -36,17 +36,17 @@ run: ## Deploy and run the sample locally 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) - DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) localstack start -d + LOCALSTACK_DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) lstk start --non-interactive --type aws stop: @echo - localstack stop + lstk stop ready: @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: - @localstack logs > logs.txt + @lstk logs > logs.txt test-ci: make start install ready run; return_code=`echo $$?`;\ diff --git a/codecommit-git-repo/README.md b/codecommit-git-repo/README.md index 2d265954..0f68d06e 100644 --- a/codecommit-git-repo/README.md +++ b/codecommit-git-repo/README.md @@ -14,7 +14,7 @@ A demo application illustrating the use of the AWS CodeCommit API with LocalStac - 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. - [Docker](https://docs.docker.com/get-docker/) -- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli) +- [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) - [Git](https://git-scm.com/) diff --git a/cognito-jwt/Makefile b/cognito-jwt/Makefile index ad2e9925..21104898 100644 --- a/cognito-jwt/Makefile +++ b/cognito-jwt/Makefile @@ -1,20 +1,20 @@ export AWS_ACCESS_KEY_ID ?= test export AWS_SECRET_ACCESS_KEY ?= test export AWS_DEFAULT_REGION = us-east-1 -export SERVICES = cognito +export LOCALSTACK_SERVICES = cognito usage: ## Show this help @fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//' check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies - @which localstack || pip install localstack + @which lstk > /dev/null || npm install -g @localstack/lstk @which awslocal || pip install awscli-local run: ## Run the scenario with the Cognito commands @@ -28,5 +28,5 @@ test-ci: 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) - DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) localstack start -d + LOCALSTACK_DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) lstk start --non-interactive --type aws diff --git a/cognito-jwt/README.md b/cognito-jwt/README.md index bb85a57b..f8389f83 100644 --- a/cognito-jwt/README.md +++ b/cognito-jwt/README.md @@ -21,7 +21,7 @@ To receive Cognito email verification codes locally, configure the following env - 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. - [Docker](https://docs.docker.com/get-docker/) -- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli) +- [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) ## Check prerequisites diff --git a/ec2-docker-instances/Makefile b/ec2-docker-instances/Makefile index 73220991..af26aa25 100644 --- a/ec2-docker-instances/Makefile +++ b/ec2-docker-instances/Makefile @@ -1,7 +1,7 @@ check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } @echo "All required prerequisites are available." @@ -18,17 +18,17 @@ run: 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) - EC2_VM_MANAGER=docker DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) localstack start -d + LOCALSTACK_EC2_VM_MANAGER=docker LOCALSTACK_DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) lstk start --non-interactive --type aws stop: @echo - localstack stop + lstk stop ready: @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: - @localstack logs > logs.txt + @lstk logs > logs.txt test-ci: make start install ready run; return_code=`echo $$?`;\ diff --git a/ec2-docker-instances/README.md b/ec2-docker-instances/README.md index 2b021043..b3222523 100644 --- a/ec2-docker-instances/README.md +++ b/ec2-docker-instances/README.md @@ -16,7 +16,7 @@ A demo application illustrating LocalStack EC2 and SSM functionality using the D - 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. - [Docker](https://docs.docker.com/get-docker/) -- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli) +- [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) - [`jq`](https://stedolan.github.io/jq/) diff --git a/ecs-ecr-container-app/Makefile b/ecs-ecr-container-app/Makefile index ab1c1e0f..ba038a19 100644 --- a/ecs-ecr-container-app/Makefile +++ b/ecs-ecr-container-app/Makefile @@ -8,13 +8,13 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies - @which localstack || pip install localstack + @which lstk > /dev/null || npm install -g @localstack/lstk @which awslocal || pip install awscli-local run: ## Build and deploy the app locally @@ -46,17 +46,17 @@ clean: ## stop and remove created containers 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) - DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) localstack start -d + LOCALSTACK_DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) lstk start --non-interactive --type aws stop: @echo - localstack stop + lstk stop ready: @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: - @localstack logs > logs.txt + @lstk logs > logs.txt test-ci: make start install ready run; return_code=`echo $$?`;\ diff --git a/ecs-ecr-container-app/README.md b/ecs-ecr-container-app/README.md index fe242c50..aa4ef2b0 100644 --- a/ecs-ecr-container-app/README.md +++ b/ecs-ecr-container-app/README.md @@ -14,7 +14,7 @@ A demo application illustrating ECS container applications running locally using - 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. - [Docker](https://docs.docker.com/get-docker/) -- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli) +- [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) ## Check prerequisites diff --git a/emr-serverless-python-dependencies/Makefile b/emr-serverless-python-dependencies/Makefile index 8b033f95..a6d53af0 100644 --- a/emr-serverless-python-dependencies/Makefile +++ b/emr-serverless-python-dependencies/Makefile @@ -7,7 +7,7 @@ TERRAFORM_VERSION ?= 1.9.8 check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v terraform > /dev/null 2>&1 || { echo "Terraform is not installed. Please install Terraform and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } @echo "All required prerequisites are available." @@ -53,13 +53,13 @@ run-aws: 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) - DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) localstack start -d + LOCALSTACK_DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) lstk start --non-interactive --type aws stop: - docker compose down + lstk stop logs: - @localstack logs > logs.txt + @lstk logs > logs.txt cat logs.txt destroy: diff --git a/emr-serverless-python-dependencies/README.md b/emr-serverless-python-dependencies/README.md index fc1aad99..2ba4daec 100644 --- a/emr-serverless-python-dependencies/README.md +++ b/emr-serverless-python-dependencies/README.md @@ -14,7 +14,7 @@ A demo application illustrating how to add Python dependencies to an EMR Serverl - 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. - [Docker](https://docs.docker.com/get-docker/) -- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli) +- [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) - [Terraform](https://developer.hashicorp.com/terraform/downloads) ~> 1.9.1 diff --git a/emr-serverless-sample/Makefile b/emr-serverless-sample/Makefile index e7094d52..f8356b8f 100644 --- a/emr-serverless-sample/Makefile +++ b/emr-serverless-sample/Makefile @@ -11,7 +11,7 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } @command -v mvn > /dev/null 2>&1 || { echo "Maven is not installed. Please install Maven and try again."; exit 1; } @echo "All required prerequisites are available." @@ -21,18 +21,17 @@ install: ## Build the Java application 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 start -d - + lstk start --non-interactive --type aws stop: ## Stop LocalStack @echo - localstack stop + lstk stop ready: ## Wait until LocalStack is ready @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo LocalStack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo LocalStack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: ## Retrieve LocalStack logs - @localstack logs > logs.txt + @lstk logs > logs.txt deploy: ## Create S3 bucket and upload the JAR file @awslocal s3 mb s3://$(S3_BUCKET) || true diff --git a/emr-serverless-sample/README.md b/emr-serverless-sample/README.md index de78b655..cb923207 100644 --- a/emr-serverless-sample/README.md +++ b/emr-serverless-sample/README.md @@ -14,7 +14,7 @@ A demo application illustrating how to run a Java Spark job on EMR Serverless us - 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. - [Docker](https://docs.docker.com/get-docker/) -- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli) +- [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) - [Java](https://openjdk.org/) and [Maven](https://maven.apache.org/) diff --git a/emr-serverless-spark/Makefile b/emr-serverless-spark/Makefile index bba14bc7..fa34432c 100644 --- a/emr-serverless-spark/Makefile +++ b/emr-serverless-spark/Makefile @@ -11,7 +11,7 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } @command -v mvn > /dev/null 2>&1 || { echo "Maven is not installed. Please install Maven and try again."; exit 1; } @echo "All required prerequisites are available." @@ -21,18 +21,18 @@ install: ## Build the Java Spark application 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) - DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) localstack start -d + LOCALSTACK_DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) lstk start --non-interactive --type aws stop: ## Stop LocalStack @echo - localstack stop + lstk stop ready: ## Wait until LocalStack is ready @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo LocalStack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo LocalStack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: ## Retrieve LocalStack logs - @localstack logs > logs.txt + @lstk logs > logs.txt deploy: ## Create S3 bucket and upload the JAR file @awslocal s3 mb s3://$(S3_BUCKET) || true diff --git a/emr-serverless-spark/README.md b/emr-serverless-spark/README.md index a913ca6b..2fac2195 100644 --- a/emr-serverless-spark/README.md +++ b/emr-serverless-spark/README.md @@ -14,7 +14,7 @@ A demo application illustrating how to run a Java Spark job on EMR Serverless us - 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. - [Docker](https://docs.docker.com/get-docker/) -- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli) +- [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) - [Java](https://openjdk.org/) and [Maven](https://maven.apache.org/) diff --git a/glacier-s3-select/Makefile b/glacier-s3-select/Makefile index 82f6cf77..3bc91119 100644 --- a/glacier-s3-select/Makefile +++ b/glacier-s3-select/Makefile @@ -1,6 +1,6 @@ export AWS_ACCESS_KEY_ID ?= test export AWS_SECRET_ACCESS_KEY ?= test -export SERVICES = cloudformation,glacier +export LOCALSTACK_SERVICES = cloudformation,glacier export AWS_DEFAULT_REGION = us-east-1 usage: ## Show this help @@ -8,13 +8,13 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies - @which localstack || pip install localstack + @which lstk > /dev/null || npm install -g @localstack/lstk @which awslocal || pip install awscli-local run: ## Upload data and run Glacier/S3 Select queries locally @@ -23,17 +23,17 @@ run: ## Upload data and run Glacier/S3 Select queries locally 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) - DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) localstack start -d + LOCALSTACK_DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) lstk start --non-interactive --type aws stop: @echo - localstack stop + lstk stop ready: @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: - @localstack logs > logs.txt + @lstk logs > logs.txt test-ci: make start install ready run; return_code=`echo $$?`;\ diff --git a/glacier-s3-select/README.md b/glacier-s3-select/README.md index fccc6ae9..35ecf4b5 100644 --- a/glacier-s3-select/README.md +++ b/glacier-s3-select/README.md @@ -14,7 +14,7 @@ A demo application illustrating the use of the Glacier API and S3 Select queries - 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. - [Docker](https://docs.docker.com/get-docker/) -- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli) +- [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) ## Check prerequisites diff --git a/glue-etl-jobs/Makefile b/glue-etl-jobs/Makefile index 3b92d92c..e7d03452 100644 --- a/glue-etl-jobs/Makefile +++ b/glue-etl-jobs/Makefile @@ -7,13 +7,13 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies - @which localstack || pip install localstack + @which lstk > /dev/null || npm install -g @localstack/lstk @which awslocal || pip install awscli-local run: ## Prepare environment and run sample Glue PySpark ETL job @@ -21,17 +21,17 @@ run: ## Prepare environment and run sample Glue PySpark ETL job 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) - DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) localstack start -d + LOCALSTACK_DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) lstk start --non-interactive --type aws stop: @echo - localstack stop + lstk stop ready: @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: - @localstack logs > logs.txt + @lstk logs > logs.txt test-ci: make start install ready run; return_code=`echo $$?`;\ diff --git a/glue-etl-jobs/README.md b/glue-etl-jobs/README.md index bf26a50a..7324d655 100644 --- a/glue-etl-jobs/README.md +++ b/glue-etl-jobs/README.md @@ -14,7 +14,7 @@ A demo application illustrating the use of the AWS Glue API to run local ETL (Ex - 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. - [Docker](https://docs.docker.com/get-docker/) -- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli) +- [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) ## Check prerequisites diff --git a/glue-etl-jobs/run.sh b/glue-etl-jobs/run.sh index a26ffba7..ebe26c56 100755 --- a/glue-etl-jobs/run.sh +++ b/glue-etl-jobs/run.sh @@ -70,7 +70,7 @@ elif [ "$state" == FAILED ]; then # sample CI keeps passing until LocalStack exposes RDS to spawned containers. awslocal glue get-job-run --job-name $JOB_NAME --run-id $run_id awslocal logs filter-log-events --log-group-name /aws-glue/jobs || true - localstack logs || true + lstk logs || true echo "Glue job reached FAILED state (likely due to JDBC connectivity from the spawned Spark container) - see logs above for details." exit 0 fi diff --git a/glue-msk-schema-registry/Makefile b/glue-msk-schema-registry/Makefile index 4394879b..5692217c 100644 --- a/glue-msk-schema-registry/Makefile +++ b/glue-msk-schema-registry/Makefile @@ -9,13 +9,13 @@ check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v java > /dev/null 2>&1 || { echo "Java is not installed. Please install Java and try again."; exit 1; } @command -v mvn > /dev/null 2>&1 || { echo "Maven is not installed. Please install Maven and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies - @which localstack || pip install localstack + @which lstk > /dev/null || npm install -g @localstack/lstk @which awslocal || pip install awscli-local run-interactive: ## Prepare environment and run sample Glue MSK environment (interactive example) @@ -26,17 +26,17 @@ run run-quiet: ## Prepare environment and run sample Glue MSK environment (no 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) - DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) localstack start -d + LOCALSTACK_DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) lstk start --non-interactive --type aws stop: @echo - localstack stop + lstk stop ready: @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: - @localstack logs > logs.txt + @lstk logs > logs.txt test-ci: make start install ready run; return_code=`echo $$?`;\ diff --git a/glue-msk-schema-registry/README.md b/glue-msk-schema-registry/README.md index 85e3c90c..01cfbf46 100644 --- a/glue-msk-schema-registry/README.md +++ b/glue-msk-schema-registry/README.md @@ -14,7 +14,7 @@ A demo application illustrating schema evolution with AWS Glue Schema Registry a - 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. - [Docker](https://docs.docker.com/get-docker/) -- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli) +- [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) - [Java 11](https://openjdk.org/) and [Maven 3](https://maven.apache.org/) diff --git a/glue-redshift-crawler/Makefile b/glue-redshift-crawler/Makefile index 25ef6d99..90e0b65b 100644 --- a/glue-redshift-crawler/Makefile +++ b/glue-redshift-crawler/Makefile @@ -7,13 +7,13 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies - @which localstack || pip install localstack + @which lstk > /dev/null || npm install -g @localstack/lstk @which awslocal || pip install awscli-local run: ## Prepare environment and run sample @@ -21,17 +21,17 @@ run: ## Prepare environment and run sample 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) - DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) localstack start -d + LOCALSTACK_DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) lstk start --non-interactive --type aws stop: @echo - localstack stop + lstk stop ready: @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: - @localstack logs > logs.txt + @lstk logs > logs.txt test-ci: TIMEOUT_MINUTES=2 make start install ready; \ diff --git a/glue-redshift-crawler/README.md b/glue-redshift-crawler/README.md index 80ee1f9f..8cf2468c 100644 --- a/glue-redshift-crawler/README.md +++ b/glue-redshift-crawler/README.md @@ -14,7 +14,7 @@ A demo application illustrating how to use AWS Glue Crawler to populate the Glue - 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. - [Docker](https://docs.docker.com/get-docker/) -- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli) +- [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) ## Check prerequisites diff --git a/iam-policy-enforcement/Makefile b/iam-policy-enforcement/Makefile index edc5298f..da8321e7 100644 --- a/iam-policy-enforcement/Makefile +++ b/iam-policy-enforcement/Makefile @@ -1,20 +1,20 @@ export AWS_ACCESS_KEY_ID ?= test export AWS_SECRET_ACCESS_KEY ?= test export AWS_DEFAULT_REGION=us-east-1 -export ENFORCE_IAM=1 +export LOCALSTACK_ENFORCE_IAM=1 usage: ## Show this help @fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//' check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies - @which localstack || pip install localstack + @which lstk > /dev/null || npm install -g @localstack/lstk @which awslocal || pip install awscli-local run: ## Run the IAM tests locally @@ -23,17 +23,17 @@ run: ## Run the IAM tests locally 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) - DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) localstack start -d + LOCALSTACK_DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) lstk start --non-interactive --type aws stop: @echo - localstack stop + lstk stop ready: @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: - @localstack logs > logs.txt + @lstk logs > logs.txt test-ci: #make start install ready run; return_code=`echo $$?`;\ diff --git a/iam-policy-enforcement/README.md b/iam-policy-enforcement/README.md index 0c136f8d..5d5040cb 100644 --- a/iam-policy-enforcement/README.md +++ b/iam-policy-enforcement/README.md @@ -16,7 +16,7 @@ A demo application illustrating enforcement of IAM policies when working with lo - 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. - [Docker](https://docs.docker.com/get-docker/) -- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli) +- [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) ## Check prerequisites diff --git a/iot-basics/Makefile b/iot-basics/Makefile index c6577b99..e0d5b277 100644 --- a/iot-basics/Makefile +++ b/iot-basics/Makefile @@ -8,13 +8,13 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v python3 > /dev/null 2>&1 || { echo "Python 3 is not installed. Please install Python 3 and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies - @which localstack || pip install localstack + @which lstk > /dev/null || npm install -g @localstack/lstk @which awslocal || pip install awscli-local @test -e .venv || (virtualenv .venv; . .venv/bin/activate; pip install -r requirements.txt) @@ -35,17 +35,17 @@ run: ## Deploy the app locally 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) - DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) localstack start -d + LOCALSTACK_DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) lstk start --non-interactive --type aws stop: @echo - localstack stop + lstk stop ready: @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: - @localstack logs > logs.txt + @lstk logs > logs.txt test-ci: make start install ready run; return_code=`echo $$?`;\ diff --git a/iot-basics/README.md b/iot-basics/README.md index 1bce2ea4..9df6a6d2 100644 --- a/iot-basics/README.md +++ b/iot-basics/README.md @@ -14,7 +14,7 @@ A demo application illustrating basic IoT API usage with LocalStack. The sample - 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. - [Docker](https://docs.docker.com/get-docker/) -- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli) +- [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) ## Check prerequisites diff --git a/java-notification-app/Makefile b/java-notification-app/Makefile index fbbfa1f6..e323f910 100644 --- a/java-notification-app/Makefile +++ b/java-notification-app/Makefile @@ -25,10 +25,11 @@ stop: ## Stop all services ready: ## Wait until LocalStack is ready @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo LocalStack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @for i in $$(seq 1 30); do curl -sf http://localhost:4566/_localstack/health > /dev/null && break; sleep 1; done; \ + curl -sf http://localhost:4566/_localstack/health > /dev/null && echo LocalStack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: ## Retrieve LocalStack logs - @localstack logs > logs.txt + @docker compose logs localstack > logs.txt deploy: ## Deploy CloudFormation stack for notification infrastructure @awslocal cloudformation deploy \ diff --git a/lambda-container-image/Makefile b/lambda-container-image/Makefile index 8a519108..656d6950 100644 --- a/lambda-container-image/Makefile +++ b/lambda-container-image/Makefile @@ -7,7 +7,7 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } @echo "All required prerequisites are available." @@ -34,17 +34,17 @@ run: ## Build, deploy, and invoke the Lambda container image locally 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) - DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) localstack start -d + LOCALSTACK_DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) lstk start --non-interactive --type aws stop: @echo - localstack stop + lstk stop ready: @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: - @localstack logs > logs.txt + @lstk logs > logs.txt test-ci: make start install ready run; return_code=`echo $$?`;\ diff --git a/lambda-container-image/README.md b/lambda-container-image/README.md index 859ac523..1e7c86ef 100644 --- a/lambda-container-image/README.md +++ b/lambda-container-image/README.md @@ -14,7 +14,7 @@ A demo application illustrating Lambda container images with LocalStack. The Lam - 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. - [Docker](https://docs.docker.com/get-docker/) -- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli) +- [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) ## Check prerequisites diff --git a/lambda-debugging-sam-java/.lstk/config.toml b/lambda-debugging-sam-java/.lstk/config.toml new file mode 100644 index 00000000..80ef91fc --- /dev/null +++ b/lambda-debugging-sam-java/.lstk/config.toml @@ -0,0 +1,8 @@ +# lstk configuration for this sample, picked up when lstk runs in this directory. +# It mounts the Lambda debug mode config into the emulator, so LocalStack picks up +# changes to lambda_debug_mode_config.yaml without a restart. +[[containers]] +type = "aws" +tag = "latest" +port = "4566" +volumes = ["../lambda_debug_mode_config.yaml:/tmp/lambda_debug_mode_config.yaml"] diff --git a/lambda-debugging-sam-java/Makefile b/lambda-debugging-sam-java/Makefile index 7f3decb3..c82b4355 100644 --- a/lambda-debugging-sam-java/Makefile +++ b/lambda-debugging-sam-java/Makefile @@ -26,7 +26,7 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v java > /dev/null 2>&1 || { echo "Java is not installed. Please install Java and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } @echo "All required prerequisites are available." @@ -78,18 +78,17 @@ clean: ## Clean the build directory 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) - IMAGE_NAME=localstack/localstack-pro \ LOCALSTACK_AUTH_TOKEN=${LOCALSTACK_AUTH_TOKEN} \ LOCALSTACK_LAMBDA_DEBUG_MODE=1 \ LOCALSTACK_LAMBDA_DEBUG_MODE_CONFIG_PATH=/tmp/lambda_debug_mode_config.yaml \ - localstack start --detached --volume ${PWD}/lambda_debug_mode_config.yaml:/tmp/lambda_debug_mode_config.yaml + lstk start --non-interactive stop: ## Stop LocalStack - localstack stop + lstk stop ready: ## Wait until LocalStack is running @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo LocalStack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo LocalStack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) test-ci: make start install build ready deploy wait invoke; return_code=`echo $$?`;\ diff --git a/lambda-debugging-sam-java/README.md b/lambda-debugging-sam-java/README.md index 02d94f10..9b7fe399 100644 --- a/lambda-debugging-sam-java/README.md +++ b/lambda-debugging-sam-java/README.md @@ -61,13 +61,13 @@ make install LOCALSTACK_AUTH_TOKEN= \ LOCALSTACK_LAMBDA_DEBUG_MODE=1 \ LOCALSTACK_LAMBDA_DEBUG_MODE_CONFIG_PATH=/tmp/lambda_debug_mode_config.yaml \ - localstack start --volume $PWD/lambda_debug_mode_config.yaml:/tmp/lambda_debug_mode_config.yaml + lstk start ``` * `LOCALSTACK_AUTH_TOKEN=` is the authentication token for LocalStack * `LOCALSTACK_LAMBDA_DEBUG_MODE=1` adjusts timeouts * `LOCALSTACK_LAMBDA_DEBUG_MODE_CONFIG_PATH=/tmp/lambda_debug_mode_config.yaml` points to the config file for Lambda debug mode allowing for advanced configuration. It maps the Lambda function `arn:aws:lambda:us-east-1:000000000000:function:HelloWorldFunctionJava` to port `5050`. - * `--volume $PWD/lambda_debug_mode_config.yaml:/tmp/lambda_debug_mode_config.yaml` maps the Lambda debug configuration from the host into the LocalStack Docker container for hot-reloading configuration updates. + * [`.lstk/config.toml`](.lstk/config.toml) mounts `lambda_debug_mode_config.yaml` from the host into the LocalStack Docker container for hot-reloading configuration updates. `lstk` reads it when you run it from this directory. ### Deploy the Lambda function diff --git a/lambda-debugging-sam-javascript/.lstk/config.toml b/lambda-debugging-sam-javascript/.lstk/config.toml new file mode 100644 index 00000000..80ef91fc --- /dev/null +++ b/lambda-debugging-sam-javascript/.lstk/config.toml @@ -0,0 +1,8 @@ +# lstk configuration for this sample, picked up when lstk runs in this directory. +# It mounts the Lambda debug mode config into the emulator, so LocalStack picks up +# changes to lambda_debug_mode_config.yaml without a restart. +[[containers]] +type = "aws" +tag = "latest" +port = "4566" +volumes = ["../lambda_debug_mode_config.yaml:/tmp/lambda_debug_mode_config.yaml"] diff --git a/lambda-debugging-sam-javascript/Makefile b/lambda-debugging-sam-javascript/Makefile index c2866ad9..fd151900 100644 --- a/lambda-debugging-sam-javascript/Makefile +++ b/lambda-debugging-sam-javascript/Makefile @@ -26,7 +26,7 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v node > /dev/null 2>&1 || { echo "Node.js is not installed. Please install Node.js and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } @echo "All required prerequisites are available." @@ -100,14 +100,14 @@ start: ## Start LocalStack LOCALSTACK_AUTH_TOKEN=${LOCALSTACK_AUTH_TOKEN} \ LOCALSTACK_LAMBDA_DEBUG_MODE=1 \ LOCALSTACK_LAMBDA_DEBUG_MODE_CONFIG_PATH=/tmp/lambda_debug_mode_config.yaml \ - localstack start --detached --volume ${PWD}/lambda_debug_mode_config.yaml:/tmp/lambda_debug_mode_config.yaml + lstk start --non-interactive stop: ## Stop LocalStack - localstack stop + lstk stop ready: ## Wait until LocalStack is running @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo LocalStack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo LocalStack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) test-ci: make start install build ready deploy wait invoke; return_code=`echo $$?`;\ diff --git a/lambda-debugging-sam-javascript/README.md b/lambda-debugging-sam-javascript/README.md index 0b5bd9df..bf24f20f 100644 --- a/lambda-debugging-sam-javascript/README.md +++ b/lambda-debugging-sam-javascript/README.md @@ -61,13 +61,13 @@ make install LOCALSTACK_AUTH_TOKEN= \ LOCALSTACK_LAMBDA_DEBUG_MODE=1 \ LOCALSTACK_LAMBDA_DEBUG_MODE_CONFIG_PATH=/tmp/lambda_debug_mode_config.yaml \ - localstack start --volume $PWD/lambda_debug_mode_config.yaml:/tmp/lambda_debug_mode_config.yaml + lstk start ``` * `LOCALSTACK_AUTH_TOKEN=` is the authentication token for LocalStack * `LOCALSTACK_LAMBDA_DEBUG_MODE=1` adjusts timeouts * `LOCALSTACK_LAMBDA_DEBUG_MODE_CONFIG_PATH=/tmp/lambda_debug_mode_config.yaml` points to the config file for Lambda debug mode allowing for advanced configuration. It maps the Lambda function `arn:aws:lambda:us-east-1:000000000000:function:HelloWorldFunctionJavaScript` to port `6050`. - * `--volume $PWD/lambda_debug_mode_config.yaml:/tmp/lambda_debug_mode_config.yaml` maps the Lambda debug configuration from the host into the LocalStack Docker container for hot-reloading configuration updates. + * [`.lstk/config.toml`](.lstk/config.toml) mounts `lambda_debug_mode_config.yaml` from the host into the LocalStack Docker container for hot-reloading configuration updates. `lstk` reads it when you run it from this directory. ### Deploy the Lambda function diff --git a/lambda-debugging-sam-python/.lstk/config.toml b/lambda-debugging-sam-python/.lstk/config.toml new file mode 100644 index 00000000..80ef91fc --- /dev/null +++ b/lambda-debugging-sam-python/.lstk/config.toml @@ -0,0 +1,8 @@ +# lstk configuration for this sample, picked up when lstk runs in this directory. +# It mounts the Lambda debug mode config into the emulator, so LocalStack picks up +# changes to lambda_debug_mode_config.yaml without a restart. +[[containers]] +type = "aws" +tag = "latest" +port = "4566" +volumes = ["../lambda_debug_mode_config.yaml:/tmp/lambda_debug_mode_config.yaml"] diff --git a/lambda-debugging-sam-python/Makefile b/lambda-debugging-sam-python/Makefile index 39e52c79..a38e7a5b 100644 --- a/lambda-debugging-sam-python/Makefile +++ b/lambda-debugging-sam-python/Makefile @@ -26,7 +26,7 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v python3 > /dev/null 2>&1 || { echo "Python 3 is not installed. Please install Python 3 and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } @echo "All required prerequisites are available." @@ -97,18 +97,17 @@ clean: ## Clean the build directory 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) - IMAGE_NAME=localstack/localstack-pro \ LOCALSTACK_AUTH_TOKEN=${LOCALSTACK_AUTH_TOKEN} \ LOCALSTACK_LAMBDA_DEBUG_MODE=1 \ LOCALSTACK_LAMBDA_DEBUG_MODE_CONFIG_PATH=/tmp/lambda_debug_mode_config.yaml \ - localstack start --detached --volume ${PWD}/lambda_debug_mode_config.yaml:/tmp/lambda_debug_mode_config.yaml + lstk start --non-interactive stop: ## Stop LocalStack - localstack stop + lstk stop ready: ## Wait until LocalStack is running @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo LocalStack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo LocalStack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) test-ci: make start install build ready deploy wait invoke; return_code=`echo $$?`;\ diff --git a/lambda-debugging-sam-python/README.md b/lambda-debugging-sam-python/README.md index 44126cd3..0f5e9ce0 100644 --- a/lambda-debugging-sam-python/README.md +++ b/lambda-debugging-sam-python/README.md @@ -61,13 +61,13 @@ make install LOCALSTACK_AUTH_TOKEN= \ LOCALSTACK_LAMBDA_DEBUG_MODE=1 \ LOCALSTACK_LAMBDA_DEBUG_MODE_CONFIG_PATH=/tmp/lambda_debug_mode_config.yaml \ - localstack start --volume $PWD/lambda_debug_mode_config.yaml:/tmp/lambda_debug_mode_config.yaml + lstk start ``` * `LOCALSTACK_AUTH_TOKEN=` is the authentication token for LocalStack * `LOCALSTACK_LAMBDA_DEBUG_MODE=1` adjusts timeouts * `LOCALSTACK_LAMBDA_DEBUG_MODE_CONFIG_PATH=/tmp/lambda_debug_mode_config.yaml` points to the config file for Lambda debug mode allowing for advanced configuration. It maps the Lambda function `arn:aws:lambda:us-east-1:000000000000:function:HelloWorldFunctionPython` to port `8050`. - * `--volume $PWD/lambda_debug_mode_config.yaml:/tmp/lambda_debug_mode_config.yaml` maps the Lambda debug configuration from the host into the LocalStack Docker container for hot-reloading configuration updates. + * [`.lstk/config.toml`](.lstk/config.toml) mounts `lambda_debug_mode_config.yaml` from the host into the LocalStack Docker container for hot-reloading configuration updates. `lstk` reads it when you run it from this directory. ### Deploy the Lambda function diff --git a/lambda-debugging-sam-typescript/.lstk/config.toml b/lambda-debugging-sam-typescript/.lstk/config.toml new file mode 100644 index 00000000..80ef91fc --- /dev/null +++ b/lambda-debugging-sam-typescript/.lstk/config.toml @@ -0,0 +1,8 @@ +# lstk configuration for this sample, picked up when lstk runs in this directory. +# It mounts the Lambda debug mode config into the emulator, so LocalStack picks up +# changes to lambda_debug_mode_config.yaml without a restart. +[[containers]] +type = "aws" +tag = "latest" +port = "4566" +volumes = ["../lambda_debug_mode_config.yaml:/tmp/lambda_debug_mode_config.yaml"] diff --git a/lambda-debugging-sam-typescript/Makefile b/lambda-debugging-sam-typescript/Makefile index a996d0eb..501264c8 100644 --- a/lambda-debugging-sam-typescript/Makefile +++ b/lambda-debugging-sam-typescript/Makefile @@ -26,7 +26,7 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v node > /dev/null 2>&1 || { echo "Node.js is not installed. Please install Node.js and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } @echo "All required prerequisites are available." @@ -83,18 +83,17 @@ clean: ## Clean the build directory 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) - IMAGE_NAME=localstack/localstack-pro \ LOCALSTACK_AUTH_TOKEN=${LOCALSTACK_AUTH_TOKEN} \ LOCALSTACK_LAMBDA_DEBUG_MODE=1 \ LOCALSTACK_LAMBDA_DEBUG_MODE_CONFIG_PATH=/tmp/lambda_debug_mode_config.yaml \ - localstack start --detached --volume ${PWD}/lambda_debug_mode_config.yaml:/tmp/lambda_debug_mode_config.yaml + lstk start --non-interactive stop: ## Stop LocalStack - localstack stop + lstk stop ready: ## Wait until LocalStack is running @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo LocalStack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo LocalStack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) test-ci: make start install build ready deploy wait invoke; return_code=`echo $$?`;\ diff --git a/lambda-debugging-sam-typescript/README.md b/lambda-debugging-sam-typescript/README.md index cfdb07f1..99854945 100644 --- a/lambda-debugging-sam-typescript/README.md +++ b/lambda-debugging-sam-typescript/README.md @@ -71,13 +71,13 @@ make install LOCALSTACK_AUTH_TOKEN= \ LOCALSTACK_LAMBDA_DEBUG_MODE=1 \ LOCALSTACK_LAMBDA_DEBUG_MODE_CONFIG_PATH=/tmp/lambda_debug_mode_config.yaml \ - localstack start --volume $PWD/lambda_debug_mode_config.yaml:/tmp/lambda_debug_mode_config.yaml + lstk start ``` * `LOCALSTACK_AUTH_TOKEN=` is the authentication token for LocalStack * `LOCALSTACK_LAMBDA_DEBUG_MODE=1` adjusts timeouts * `LOCALSTACK_LAMBDA_DEBUG_MODE_CONFIG_PATH=/tmp/lambda_debug_mode_config.yaml` points to the config file for Lambda debug mode allowing for advanced configuration. It maps the Lambda function `arn:aws:lambda:us-east-1:000000000000:function:HelloWorldFunctionTypeScript` to port `7050`. - * `--volume $PWD/lambda_debug_mode_config.yaml:/tmp/lambda_debug_mode_config.yaml` maps the Lambda debug configuration from the host into the LocalStack Docker container for hot-reloading configuration updates. + * [`.lstk/config.toml`](.lstk/config.toml) mounts `lambda_debug_mode_config.yaml` from the host into the LocalStack Docker container for hot-reloading configuration updates. `lstk` reads it when you run it from this directory. ### Deploy the Lambda function diff --git a/lambda-event-filtering/Makefile b/lambda-event-filtering/Makefile index 574aa043..ae4f54b0 100644 --- a/lambda-event-filtering/Makefile +++ b/lambda-event-filtering/Makefile @@ -9,7 +9,7 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v node > /dev/null 2>&1 || { echo "Node.js is not installed. Please install Node.js and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v samlocal > /dev/null 2>&1 || { echo "samlocal is not installed. Please run: pip install aws-sam-cli-local"; exit 1; } @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } @echo "All required prerequisites are available." @@ -21,18 +21,17 @@ install: ## Install dependencies 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 start -d - + lstk start --non-interactive --type aws stop: ## Stop LocalStack @echo - localstack stop + lstk stop ready: ## Wait until LocalStack is ready @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo LocalStack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo LocalStack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: ## Retrieve LocalStack logs - @localstack logs > logs.txt + @lstk logs > logs.txt deploy: ## Deploy the SAM application to LocalStack @samlocal build diff --git a/lambda-event-filtering/README.md b/lambda-event-filtering/README.md index 4c83aa8a..7deba61a 100644 --- a/lambda-event-filtering/README.md +++ b/lambda-event-filtering/README.md @@ -14,7 +14,7 @@ A demo application illustrating AWS Lambda event source filtering with DynamoDB - 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. - [Docker](https://docs.docker.com/get-docker/) -- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli) +- [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) - [`samlocal`](https://github.com/localstack/aws-sam-cli-local) — install with `pip install aws-sam-cli-local` - [Node.js](https://nodejs.org/en/download/) with `npm` and [`ulid`](https://www.npmjs.com/package/ulid) (`npm install --save ulid`) diff --git a/lambda-function-urls-javascript/Makefile b/lambda-function-urls-javascript/Makefile index 0c749f18..766dc75e 100644 --- a/lambda-function-urls-javascript/Makefile +++ b/lambda-function-urls-javascript/Makefile @@ -9,7 +9,7 @@ check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v node > /dev/null 2>&1 || { echo "Node.js is not installed. Please install Node.js and try again."; exit 1; } @command -v terraform > /dev/null 2>&1 || { echo "Terraform is not installed. Please install Terraform and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } @echo "All required prerequisites are available." @@ -33,18 +33,17 @@ run: ## Build, deploy, and invoke the Lambda function URL 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 start -d - + lstk start --non-interactive --type aws stop: @echo - localstack stop + lstk stop ready: @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: - @localstack logs > logs.txt + @lstk logs > logs.txt test-ci: make start install ready run; return_code=`echo $$?`;\ diff --git a/lambda-function-urls-javascript/README.md b/lambda-function-urls-javascript/README.md index 3dc61cfb..fe5cb938 100644 --- a/lambda-function-urls-javascript/README.md +++ b/lambda-function-urls-javascript/README.md @@ -14,7 +14,7 @@ A demo application illustrating how to create a JavaScript Lambda function with - 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. - [Docker](https://docs.docker.com/get-docker/) -- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli) +- [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) - [Terraform](https://developer.hashicorp.com/terraform/downloads) (optional, for Terraform-based deployment) @@ -79,7 +79,7 @@ terraform plan terraform apply --auto-approve ``` -Since we are using LocalStack, no actual AWS resources will be created. LocalStack creates ephemeral development resources that are automatically cleaned up when you stop LocalStack (`localstack stop`). +Since we are using LocalStack, no actual AWS resources will be created. LocalStack creates ephemeral development resources that are automatically cleaned up when you stop LocalStack (`lstk stop`). ## License diff --git a/lambda-function-urls-python/Makefile b/lambda-function-urls-python/Makefile index 887041cd..e72a5bf2 100644 --- a/lambda-function-urls-python/Makefile +++ b/lambda-function-urls-python/Makefile @@ -9,7 +9,7 @@ check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v python3 > /dev/null 2>&1 || { echo "Python 3 is not installed. Please install Python 3 and try again."; exit 1; } @command -v terraform > /dev/null 2>&1 || { echo "Terraform is not installed. Please install Terraform and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } @echo "All required prerequisites are available." @@ -35,18 +35,17 @@ run: ## Build, deploy, and invoke the Lambda function URL 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 start -d - + lstk start --non-interactive --type aws stop: @echo - localstack stop + lstk stop ready: @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: - @localstack logs > logs.txt + @lstk logs > logs.txt test-ci: make start install ready run; return_code=`echo $$?`;\ diff --git a/lambda-function-urls-python/README.md b/lambda-function-urls-python/README.md index 488d1038..968ab823 100644 --- a/lambda-function-urls-python/README.md +++ b/lambda-function-urls-python/README.md @@ -14,7 +14,7 @@ A demo application illustrating how to create a Python Lambda function with a fu - 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. - [Docker](https://docs.docker.com/get-docker/) -- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli) +- [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) - [Python 3](https://www.python.org/downloads/) diff --git a/lambda-hot-reloading/Makefile b/lambda-hot-reloading/Makefile index 081723e3..554fa1bb 100644 --- a/lambda-hot-reloading/Makefile +++ b/lambda-hot-reloading/Makefile @@ -8,7 +8,7 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } @echo "All required prerequisites are available." @@ -17,18 +17,17 @@ install: ## Install dependencies for the JavaScript sample 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 start -d - + lstk start --non-interactive --type aws stop: ## Stop LocalStack @echo - localstack stop + lstk stop ready: ## Wait until LocalStack is ready @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo LocalStack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo LocalStack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: ## Retrieve LocalStack logs - @localstack logs > logs.txt + @lstk logs > logs.txt deploy: ## Deploy the JavaScript Lambda with hot reloading enabled @cd javascript && \ diff --git a/lambda-hot-reloading/README.md b/lambda-hot-reloading/README.md index 64b39a76..5536df88 100644 --- a/lambda-hot-reloading/README.md +++ b/lambda-hot-reloading/README.md @@ -24,7 +24,7 @@ A collection of samples demonstrating LocalStack's Lambda hot reloading capabili - 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. - [Docker](https://docs.docker.com/get-docker/) -- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli) +- [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) - [Node.js](https://nodejs.org/en/download/) with `npm` diff --git a/lambda-hot-reloading/javascript-terraform-layers/README.md b/lambda-hot-reloading/javascript-terraform-layers/README.md index 21f5fb78..d5f0082d 100644 --- a/lambda-hot-reloading/javascript-terraform-layers/README.md +++ b/lambda-hot-reloading/javascript-terraform-layers/README.md @@ -22,10 +22,10 @@ The source code of the created lambda function `hotreloadlambda` is located in t ## Starting up First, we need to make sure we start LocalStack with the right configuration. -Hot reloading of layers is only supported in our new lambda provider, all you need to do is set `PROVIDER_OVERRIDE_LAMBDA=v2`, if you use a LocalStack version < 2.0. +Hot reloading of layers is only supported in our new lambda provider, all you need to do is set `PROVIDER_OVERRIDE_LAMBDA=v2` (with the `LOCALSTACK_` prefix, so that `lstk` forwards it to the container), if you use a LocalStack version < 2.0. ```bash -PROVIDER_OVERRIDE_LAMBDA=v2 localstack start +LOCALSTACK_PROVIDER_OVERRIDE_LAMBDA=v2 lstk start ``` Accordingly, if you are launching LocalStack via Docker or Docker Compose: diff --git a/lambda-hot-reloading/javascript-terraform/README.md b/lambda-hot-reloading/javascript-terraform/README.md index d6e508b1..06330d0d 100644 --- a/lambda-hot-reloading/javascript-terraform/README.md +++ b/lambda-hot-reloading/javascript-terraform/README.md @@ -22,10 +22,10 @@ First, we need to make sure we start LocalStack with the right configuration. To use our new lambda provider, all you need to do is set `PROVIDER_OVERRIDE_LAMBDA=v2`, if you use a LocalStack version < 2.0. -If you want to use our old provider, please set `LAMBDA_REMOTE_DOCKER` to `0` (see the [Configuration Documentation](https://docs.localstack.cloud/localstack/configuration/#lambda) for more information): +If you want to use our old provider, please set `LAMBDA_REMOTE_DOCKER` to `0`, passed with the `LOCALSTACK_` prefix so that `lstk` forwards it to the container (see the [Configuration Documentation](https://docs.localstack.cloud/localstack/configuration/#lambda) for more information): ```bash -LAMBDA_REMOTE_DOCKER=0 localstack start +LOCALSTACK_LAMBDA_REMOTE_DOCKER=0 lstk start ``` Accordingly, if you are launching LocalStack via Docker or Docker Compose: diff --git a/lambda-hot-reloading/javascript/README.md b/lambda-hot-reloading/javascript/README.md index c27daea8..295efb37 100644 --- a/lambda-hot-reloading/javascript/README.md +++ b/lambda-hot-reloading/javascript/README.md @@ -8,10 +8,10 @@ ## Starting up -First, we need to make sure we start LocalStack with the right configuration. This is as simple as setting `LAMBDA_REMOTE_DOCKER`(see the [Configuration Documentation](https://docs.localstack.cloud/localstack/configuration/#lambda) for more information): +First, we need to make sure we start LocalStack with the right configuration. This is as simple as setting `LAMBDA_REMOTE_DOCKER`, passed with the `LOCALSTACK_` prefix so that `lstk` forwards it to the container (see the [Configuration Documentation](https://docs.localstack.cloud/localstack/configuration/#lambda) for more information): ```bash -LAMBDA_REMOTE_DOCKER=0 localstack start +LOCALSTACK_LAMBDA_REMOTE_DOCKER=0 lstk start ``` Accordingly, if you are launching LocalStack via Docker or Docker Compose: diff --git a/lambda-hot-reloading/lambda-typescript-webpack/README.md b/lambda-hot-reloading/lambda-typescript-webpack/README.md index 9fa90cf8..4151a8fb 100644 --- a/lambda-hot-reloading/lambda-typescript-webpack/README.md +++ b/lambda-hot-reloading/lambda-typescript-webpack/README.md @@ -18,7 +18,7 @@ Start your LocalStack Docker container with the following command: ```bash export LOCALSTACK_AUTH_TOKEN= -localstack start +lstk start ``` ## Install dependencies diff --git a/lambda-php-bref-cdk-app/Makefile b/lambda-php-bref-cdk-app/Makefile index 041d4c67..02c81ef8 100644 --- a/lambda-php-bref-cdk-app/Makefile +++ b/lambda-php-bref-cdk-app/Makefile @@ -12,7 +12,7 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v node > /dev/null 2>&1 || { echo "Node.js is not installed. Please install Node.js and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } @echo "All required prerequisites are available." @@ -20,7 +20,7 @@ check: ## Check if all required prerequisites are installed install: ## Install dependencies @npm install @which cdklocal || npm install -g aws-cdk-local aws-cdk - @which localstack || pip install localstack + @which lstk > /dev/null || npm install -g @localstack/lstk echo "Install Bref PHP dependencies via composer" make install-bref-docker @@ -47,17 +47,17 @@ invoke: 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) - DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) localstack start -d + LOCALSTACK_DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) lstk start --non-interactive --type aws stop: @echo - localstack stop + lstk stop ready: @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: - @localstack logs > logs.txt + @lstk logs > logs.txt test-ci: make start install ready run; return_code=`echo $$?`;\ diff --git a/lambda-php-bref-cdk-app/README.md b/lambda-php-bref-cdk-app/README.md index 5ce97cd6..03ff130d 100644 --- a/lambda-php-bref-cdk-app/README.md +++ b/lambda-php-bref-cdk-app/README.md @@ -14,7 +14,7 @@ A [PHP/Bref](https://bref.sh/) serverless application using a shared Lambda laye - 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. - [Docker](https://docs.docker.com/get-docker/) -- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli) +- [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [`cdklocal`](https://github.com/localstack/aws-cdk-local) — install with `npm install -g aws-cdk-local` - [Node.js](https://nodejs.org/en/download/) with `npm` - [`curl`](https://curl.se/) and [`jq`](https://stedolan.github.io/jq/) diff --git a/lambda-xray/README.md b/lambda-xray/README.md index 53c32e58..e7f9999c 100644 --- a/lambda-xray/README.md +++ b/lambda-xray/README.md @@ -21,7 +21,7 @@ A collection of samples demonstrating AWS X-Ray distributed tracing for Lambda f - 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. - [Docker](https://docs.docker.com/get-docker/) -- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli) +- [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) - [Python 3](https://www.python.org/downloads/) with `pip` @@ -29,7 +29,7 @@ A collection of samples demonstrating AWS X-Ray distributed tracing for Lambda f ```bash export LOCALSTACK_AUTH_TOKEN= -localstack start -d +lstk start ``` Refer to the individual sub-sample READMEs for deployment and invocation instructions. diff --git a/lambda-xray/python-powertools/Makefile b/lambda-xray/python-powertools/Makefile index 54e2d207..803897b5 100644 --- a/lambda-xray/python-powertools/Makefile +++ b/lambda-xray/python-powertools/Makefile @@ -30,18 +30,17 @@ get-traces: ## Get the latest X-Ray traces (default 10min) awslocal xray batch-get-traces --trace-ids $$ID start: - localstack start -d - + lstk start --non-interactive --type aws stop: @echo - localstack stop + lstk stop ready: @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: - @localstack logs > logs.txt + @lstk logs > logs.txt test-ci: make start install ready run; return_code=`echo $$?`;\ diff --git a/lambda-xray/python-powertools/README.md b/lambda-xray/python-powertools/README.md index a422684f..7f55c30c 100644 --- a/lambda-xray/python-powertools/README.md +++ b/lambda-xray/python-powertools/README.md @@ -14,10 +14,10 @@ and shows how to use the X-Ray API to fetch distributed trace data. ## Start LocalStack -Start your LocalStack with your Auth Token configured along with the `DEBUG=1` configuration: +Start LocalStack with your Auth Token configured and debug logging enabled. `lstk` forwards `LOCALSTACK_`-prefixed variables to the container, so `LOCALSTACK_DEBUG=1` sets `DEBUG=1`: ```bash -LOCALSTACK_AUTH_TOKEN=$LOCALSTACK_AUTH_TOKEN DEBUG=1 localstack start +LOCALSTACK_AUTH_TOKEN=$LOCALSTACK_AUTH_TOKEN LOCALSTACK_DEBUG=1 lstk start ``` ## Deploy diff --git a/lambda-xray/python-xray-sdk/Makefile b/lambda-xray/python-xray-sdk/Makefile index 1813092a..dd8c25a1 100644 --- a/lambda-xray/python-xray-sdk/Makefile +++ b/lambda-xray/python-xray-sdk/Makefile @@ -13,18 +13,17 @@ run: ./5-get-traces.sh start: - localstack start -d - + lstk start --non-interactive --type aws stop: @echo - localstack stop + lstk stop ready: @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: - @localstack logs > logs.txt + @lstk logs > logs.txt test-ci: make start install ready run; return_code=`echo $$?`;\ diff --git a/lambda-xray/python-xray-sdk/README.md b/lambda-xray/python-xray-sdk/README.md index 24a8c473..86b1163a 100644 --- a/lambda-xray/python-xray-sdk/README.md +++ b/lambda-xray/python-xray-sdk/README.md @@ -15,10 +15,10 @@ and shows how to use the X-Ray API to fetch distributed trace data. ## Start LocalStack -Start your LocalStack with your Auth Token configured along with the `DEBUG=1` configuration: +Start LocalStack with your Auth Token configured and debug logging enabled. `lstk` forwards `LOCALSTACK_`-prefixed variables to the container, so `LOCALSTACK_DEBUG=1` sets `DEBUG=1`: ```bash -LOCALSTACK_AUTH_TOKEN=$LOCALSTACK_AUTH_TOKEN DEBUG=1 localstack start +LOCALSTACK_AUTH_TOKEN=$LOCALSTACK_AUTH_TOKEN LOCALSTACK_DEBUG=1 lstk start ``` ## Create a new bucket diff --git a/mq-broker/Makefile b/mq-broker/Makefile index daf171ff..104ad504 100644 --- a/mq-broker/Makefile +++ b/mq-broker/Makefile @@ -7,13 +7,13 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies - @which localstack > /dev/null || pip install localstack + @which lstk > /dev/null || npm install -g @localstack/lstk @which awslocal > /dev/null || pip install awscli-local run: ## Run test creating a broker and sending a message @@ -21,17 +21,17 @@ run: ## Run test creating a broker and sending a message 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) - DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) localstack start -d + LOCALSTACK_DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) lstk start --non-interactive --type aws stop: @echo - localstack stop + lstk stop ready: @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: - @localstack logs > logs.txt + @lstk logs > logs.txt test-ci: make start install ready run; return_code=`echo $$?`;\ diff --git a/mq-broker/README.md b/mq-broker/README.md index 2b23d16b..619014fd 100644 --- a/mq-broker/README.md +++ b/mq-broker/README.md @@ -14,7 +14,7 @@ A demo application illustrating the use of the AWS MQ API with LocalStack. The s - 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. - [Docker](https://docs.docker.com/get-docker/) -- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli) +- [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) ## Check prerequisites diff --git a/multi-account-multi-region-s3-access/Makefile b/multi-account-multi-region-s3-access/Makefile index f84480be..d636e5cc 100644 --- a/multi-account-multi-region-s3-access/Makefile +++ b/multi-account-multi-region-s3-access/Makefile @@ -1,5 +1,5 @@ # Enforce IAM to test cross-account cross-region access -export ENFORCE_IAM=1 +export LOCALSTACK_ENFORCE_IAM=1 export DEBUG=1 SHELL := /bin/bash @@ -9,13 +9,13 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies - @which localstack || pip install localstack + @which lstk > /dev/null || npm install -g @localstack/lstk @which awslocal || pip install awscli-local run: ## Run the cross-account cross-region experiment of copying data from one S3 bucket to another @@ -23,18 +23,17 @@ run: ## Run the cross-account cross-region experiment of copying data fr 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 start -d - + lstk start --non-interactive --type aws stop: ## Stop LocalStack @echo - localstack stop + lstk stop ready: ## Wait for LocalStack to be ready @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: ## Retrieve logs from LocalStack - @localstack logs > logs.txt + @lstk logs > logs.txt test-ci: ## Run CI test make start install ready run; return_code=`echo $$?`;\ diff --git a/multi-account-multi-region-s3-access/README.md b/multi-account-multi-region-s3-access/README.md index e1c85751..77a570f0 100644 --- a/multi-account-multi-region-s3-access/README.md +++ b/multi-account-multi-region-s3-access/README.md @@ -19,7 +19,7 @@ A demo application illustrating how to access S3 resources across different AWS - 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. - [Docker](https://docs.docker.com/get-docker/) -- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli) +- [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) - [Python 3](https://www.python.org/downloads/) with `pip` diff --git a/neptune-graph-db/Makefile b/neptune-graph-db/Makefile index 20174c58..0e35f838 100644 --- a/neptune-graph-db/Makefile +++ b/neptune-graph-db/Makefile @@ -1,7 +1,7 @@ export AWS_ACCESS_KEY_ID ?= test export AWS_SECRET_ACCESS_KEY ?= test export AWS_DEFAULT_REGION = us-east-1 -export SERVICES = neptune +export LOCALSTACK_SERVICES = neptune PYTHON_BIN ?= $(shell which python3 || which python) usage: ## Show this help @@ -10,13 +10,13 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v python3 > /dev/null 2>&1 || { echo "Python 3 is not installed. Please install Python 3 and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies - @which localstack || pip install localstack + @which lstk > /dev/null || npm install -g @localstack/lstk @which awslocal || pip install awscli-local @pip install gremlinpython boto3 @@ -25,17 +25,17 @@ run: ## Run the scenario with queries against local Neptune 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) - DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) localstack start -d + LOCALSTACK_DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) lstk start --non-interactive --type aws stop: @echo - localstack stop + lstk stop ready: @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: - @localstack logs > logs.txt + @lstk logs > logs.txt test-ci: #make start install ready run; return_code=`echo $$?`;\ diff --git a/neptune-graph-db/README.md b/neptune-graph-db/README.md index 6f07fbd2..936bdcec 100644 --- a/neptune-graph-db/README.md +++ b/neptune-graph-db/README.md @@ -14,7 +14,7 @@ A demo application illustrating Neptune Graph DB queries running locally using L - 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. - [Docker](https://docs.docker.com/get-docker/) -- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli) +- [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) - [Python 3](https://www.python.org/downloads/) diff --git a/rds-db-queries/Makefile b/rds-db-queries/Makefile index bdcd6b22..358d0064 100644 --- a/rds-db-queries/Makefile +++ b/rds-db-queries/Makefile @@ -10,13 +10,13 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v python3 > /dev/null 2>&1 || { echo "Python 3 is not installed. Please install Python 3 and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies - @which localstack || pip install localstack + @which lstk > /dev/null || npm install -g @localstack/lstk @which awslocal || pip install awscli-local @test -e .venv || ($(PYTHON_BIN) -m venv .venv; source .venv/bin/activate; pip install wheel; pip install psycopg2-binary boto3) @@ -25,17 +25,17 @@ run: ## Run the scenario with the DB queries against local RDS 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) - DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) localstack start -d + LOCALSTACK_DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) lstk start --non-interactive --type aws stop: @echo - localstack stop + lstk stop ready: @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: - @localstack logs > logs.txt + @lstk logs > logs.txt test-ci: make start install ready run; return_code=`echo $$?`;\ diff --git a/rds-db-queries/README.md b/rds-db-queries/README.md index 978e5e37..2d4b7a78 100644 --- a/rds-db-queries/README.md +++ b/rds-db-queries/README.md @@ -14,7 +14,7 @@ A demo application illustrating running queries against an RDS database locally - 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. - [Docker](https://docs.docker.com/get-docker/) -- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli) +- [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) - [Python 3](https://www.python.org/downloads/) diff --git a/rds-failover-test/Makefile b/rds-failover-test/Makefile index 185c6ed4..baacf8a1 100644 --- a/rds-failover-test/Makefile +++ b/rds-failover-test/Makefile @@ -10,13 +10,13 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v python3 > /dev/null 2>&1 || { echo "Python 3 is not installed. Please install Python 3 and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies - @which localstack || pip install localstack + @which lstk > /dev/null || npm install -g @localstack/lstk @which awslocal || pip install awscli-local @test -e .venv || ($(PYTHON_BIN) -m venv .venv; source .venv/bin/activate; pip install wheel; pip install psycopg2-binary boto3) @@ -25,17 +25,17 @@ run: ## Run the scenario with the DB queries against local RDS 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) - DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) localstack start -d + LOCALSTACK_DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) lstk start --non-interactive --type aws stop: @echo - localstack stop + lstk stop ready: @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: - @localstack logs > logs.txt + @lstk logs > logs.txt test-ci: make start install ready run; return_code=`echo $$?`;\ diff --git a/rds-failover-test/README.md b/rds-failover-test/README.md index d51676fa..d44e1236 100644 --- a/rds-failover-test/README.md +++ b/rds-failover-test/README.md @@ -14,7 +14,7 @@ A demo application illustrating RDS global cluster failover testing with LocalSt - 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. - [Docker](https://docs.docker.com/get-docker/) -- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli) +- [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) - [Python 3](https://www.python.org/downloads/) diff --git a/reproducible-ml/Makefile b/reproducible-ml/Makefile index 3889943e..6957f4b9 100644 --- a/reproducible-ml/Makefile +++ b/reproducible-ml/Makefile @@ -7,13 +7,13 @@ usage: check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } @echo "All required prerequisites are available." install: - @which localstack || pip install localstack + @which lstk > /dev/null || npm install -g @localstack/lstk @which awslocal || pip install awscli-local run: @@ -21,18 +21,18 @@ run: 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) - DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) localstack start -d + LOCALSTACK_DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) lstk start --non-interactive --type aws stop: @echo - localstack stop + lstk stop ready: @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: - @localstack logs > logs.txt + @lstk logs > logs.txt .PHONY: usage install start run stop ready logs test-ci diff --git a/reproducible-ml/README.md b/reproducible-ml/README.md index 5bf02b72..c0c2061f 100644 --- a/reproducible-ml/README.md +++ b/reproducible-ml/README.md @@ -21,7 +21,7 @@ In this demo application, we will train a simple machine-learning model that rec - 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. - [Docker](https://docs.docker.com/get-docker/) -- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli) +- [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) ## Check prerequisites diff --git a/route53-dns-failover/Makefile b/route53-dns-failover/Makefile index cd914e0d..255cf802 100644 --- a/route53-dns-failover/Makefile +++ b/route53-dns-failover/Makefile @@ -7,13 +7,11 @@ usage: check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } @echo "All required prerequisites are available." install: - @which localstack || pip install localstack @which awslocal || pip install awscli-local run: @@ -25,14 +23,15 @@ start: stop: @echo - localstack stop + docker compose down ready: @echo Waiting on the LocalStack container... - @localstack wait -t 120 && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @for i in $$(seq 1 120); do curl -sf http://localhost:4566/_localstack/health > /dev/null && break; sleep 1; done; \ + curl -sf http://localhost:4566/_localstack/health > /dev/null && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: - @localstack logs > logs.txt + @docker compose logs localstack > logs.txt test-ci: make start install ready run; return_code=`echo $$?`;\ diff --git a/sagemaker-inference/Makefile b/sagemaker-inference/Makefile index a8ba5993..223f0bac 100644 --- a/sagemaker-inference/Makefile +++ b/sagemaker-inference/Makefile @@ -9,7 +9,7 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v python3 > /dev/null 2>&1 || { echo "Python 3 is not installed. Please install Python 3 and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @echo "All required prerequisites are available." install: ## Install Python dependencies @@ -17,18 +17,17 @@ install: ## Install Python dependencies 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 start -d - + lstk start --non-interactive --type aws stop: ## Stop LocalStack @echo - localstack stop + lstk stop ready: ## Wait until LocalStack is ready @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo LocalStack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo LocalStack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: ## Retrieve LocalStack logs - @localstack logs > logs.txt + @lstk logs > logs.txt run: ## Run the SageMaker inference example @python3 main.py diff --git a/sagemaker-inference/ReadMe.md b/sagemaker-inference/ReadMe.md index 7b4fcf0f..a464c1a8 100644 --- a/sagemaker-inference/ReadMe.md +++ b/sagemaker-inference/ReadMe.md @@ -28,7 +28,7 @@ docker pull 763104351884.dkr.ecr.us-east-1.amazonaws.com/pytorch-inference:1.5.0 - 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. - [Docker](https://docs.docker.com/get-docker/) -- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli) +- [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [Python 3.8+](https://www.python.org/downloads/) ## Check prerequisites diff --git a/sample-archive/aws-sam-amplify-lambda-webapp/README.md b/sample-archive/aws-sam-amplify-lambda-webapp/README.md index a90c396b..f61da61f 100644 --- a/sample-archive/aws-sam-amplify-lambda-webapp/README.md +++ b/sample-archive/aws-sam-amplify-lambda-webapp/README.md @@ -20,7 +20,7 @@ pip install aws-sam-cli-local Make sure that LocalStack is started with the following `SERVICES` configuration: ``` -LOCALSTACK_AUTH_TOKEN=... DEBUG=1 SERVICES=serverless,cognito,amplify localstack start +LOCALSTACK_AUTH_TOKEN=... LOCALSTACK_DEBUG=1 LOCALSTACK_SERVICES=serverless,cognito,amplify lstk start ``` ## Running diff --git a/sample-archive/azure-functions/Makefile b/sample-archive/azure-functions/Makefile index 0748b12e..692b88b3 100644 --- a/sample-archive/azure-functions/Makefile +++ b/sample-archive/azure-functions/Makefile @@ -1,5 +1,5 @@ export AZURE = 1 -export SERVICES = azure +export LOCALSTACK_SERVICES = azure usage: ## Show this help @fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//' diff --git a/sample-archive/cdk-for-terraform/Makefile b/sample-archive/cdk-for-terraform/Makefile index 2e86df4c..ce19da19 100644 --- a/sample-archive/cdk-for-terraform/Makefile +++ b/sample-archive/cdk-for-terraform/Makefile @@ -9,7 +9,7 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v terraform > /dev/null 2>&1 || { echo "Terraform is not installed. Please install Terraform and try again."; exit 1; } @test -x python/node_modules/.bin/cdktf || command -v cdktf > /dev/null 2>&1 || { echo "cdktf is not installed. Please run: cd python && npm ci"; exit 1; } @command -v pipenv > /dev/null 2>&1 || { echo "pipenv is not installed. Please run: pip install pipenv"; exit 1; } @@ -32,18 +32,17 @@ install-ci-dependencies: ## Install CI-only prerequisites 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 start -d - + lstk start --non-interactive --type aws stop: ## Stop LocalStack @echo - localstack stop + lstk stop ready: ## Wait until LocalStack is ready @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo LocalStack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo LocalStack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: ## Retrieve LocalStack logs - @localstack logs > logs.txt + @lstk logs > logs.txt deploy: ## Deploy CDK for Terraform stack @cd python && npx cdktf deploy --auto-approve diff --git a/sample-archive/cdk-for-terraform/README.md b/sample-archive/cdk-for-terraform/README.md index 4aa497cb..fecceee3 100644 --- a/sample-archive/cdk-for-terraform/README.md +++ b/sample-archive/cdk-for-terraform/README.md @@ -14,7 +14,7 @@ A demo application illustrating deployment of AWS resources (SNS, DynamoDB, VPC) - 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. - [Docker](https://docs.docker.com/get-docker/) -- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli) +- [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [Terraform](https://developer.hashicorp.com/terraform/downloads) - [`cdktf`](https://developer.hashicorp.com/terraform/tutorials/cdktf/cdktf-install) - [`pipenv`](https://pipenv.pypa.io/en/latest/) diff --git a/sample-archive/cloudfront-distributions/Makefile b/sample-archive/cloudfront-distributions/Makefile index f92f3a7f..2b4eae55 100644 --- a/sample-archive/cloudfront-distributions/Makefile +++ b/sample-archive/cloudfront-distributions/Makefile @@ -1,13 +1,13 @@ export AWS_ACCESS_KEY_ID ?= test export AWS_SECRET_ACCESS_KEY ?= test export AWS_DEFAULT_REGION = us-east-1 -export SERVICES = serverless,ssm,cloudfront +export LOCALSTACK_SERVICES = serverless,ssm,cloudfront 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 lstk > /dev/null || npm install -g @localstack/lstk @which awslocal || pip install awscli-local @test -e node_modules || npm install diff --git a/sample-archive/cloudfront-distributions/README.md b/sample-archive/cloudfront-distributions/README.md index 4cba57a3..464d9b05 100644 --- a/sample-archive/cloudfront-distributions/README.md +++ b/sample-archive/cloudfront-distributions/README.md @@ -24,7 +24,7 @@ Please refer to the `distconfig.json` file for details about the CloudFront dist Make sure that LocalStack is started with the following `SERVICES` configuration: ``` -LOCALSTACK_AUTH_TOKEN=... DEBUG=1 SERVICES=edge,serverless,ssm,cloudfront localstack start +LOCALSTACK_AUTH_TOKEN=... LOCALSTACK_DEBUG=1 LOCALSTACK_SERVICES=edge,serverless,ssm,cloudfront lstk start ``` Please also ensure that your local IP address is registered as a DNS nameserver in your environment (e.g., by configuring `/etc/resolv.conf`). diff --git a/sample-archive/ec2-custom-ami/Makefile b/sample-archive/ec2-custom-ami/Makefile index 867a80ce..378615e2 100644 --- a/sample-archive/ec2-custom-ami/Makefile +++ b/sample-archive/ec2-custom-ami/Makefile @@ -1,13 +1,13 @@ export AWS_ACCESS_KEY_ID ?= test export AWS_SECRET_ACCESS_KEY ?= test -export SERVICES = cloudformation,ecs,ec2 +export LOCALSTACK_SERVICES = cloudformation,ecs,ec2 export AWS_DEFAULT_REGION = us-east-1 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 lstk > /dev/null || npm install -g @localstack/lstk @which packer || (echo 'Please install "packer" (https://www.packer.io) to run this sample'; exit 1) run: ## Run packer and build the image locally diff --git a/sample-archive/ec2-custom-ami/README.md b/sample-archive/ec2-custom-ami/README.md index d8358df9..53de7434 100644 --- a/sample-archive/ec2-custom-ami/README.md +++ b/sample-archive/ec2-custom-ami/README.md @@ -33,7 +33,7 @@ Please refer to the `containers.json` and `packer.json` configuration files. Make sure that LocalStack is started with the following `SERVICES` configuration: ``` -LOCALSTACK_AUTH_TOKEN=... DEBUG=1 SERVICES=cloudformation,ec2 localstack start +LOCALSTACK_AUTH_TOKEN=... LOCALSTACK_DEBUG=1 LOCALSTACK_SERVICES=cloudformation,ec2 lstk start ``` Run the application and trigger the virtual machine build process: diff --git a/sample-archive/emr-hadoop-spark-jobs/Makefile b/sample-archive/emr-hadoop-spark-jobs/Makefile index 6bb27363..8a15f03d 100644 --- a/sample-archive/emr-hadoop-spark-jobs/Makefile +++ b/sample-archive/emr-hadoop-spark-jobs/Makefile @@ -1,13 +1,13 @@ export AWS_ACCESS_KEY_ID ?= test export AWS_SECRET_ACCESS_KEY ?= test -export SERVICES = serverless +export LOCALSTACK_SERVICES = serverless export AWS_DEFAULT_REGION=us-east-1 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 lstk > /dev/null || npm install -g @localstack/lstk @which awslocal || pip install awscli-local @docker images | grep localstack/spark || docker pull localstack/spark diff --git a/sample-archive/emr-hadoop-spark-jobs/README.md b/sample-archive/emr-hadoop-spark-jobs/README.md index cc5adba3..12aa0eb3 100644 --- a/sample-archive/emr-hadoop-spark-jobs/README.md +++ b/sample-archive/emr-hadoop-spark-jobs/README.md @@ -26,7 +26,7 @@ This sample project creates a local EMR cluster and runs two simple jobs upon in Make sure that LocalStack is started with the following `SERVICES` configuration: ``` -LOCALSTACK_AUTH_TOKEN=... DEBUG=1 SERVICES=cloudformation,emr localstack start +LOCALSTACK_AUTH_TOKEN=... LOCALSTACK_DEBUG=1 LOCALSTACK_SERVICES=cloudformation,emr lstk start ``` Run the startup script: diff --git a/sample-archive/kinesis-analytics/Makefile b/sample-archive/kinesis-analytics/Makefile index 9165ca43..b73c4aa8 100644 --- a/sample-archive/kinesis-analytics/Makefile +++ b/sample-archive/kinesis-analytics/Makefile @@ -1,6 +1,6 @@ export AWS_ACCESS_KEY_ID ?= test export AWS_SECRET_ACCESS_KEY ?= test -export SERVICES = serverless,kinesisanalytics +export LOCALSTACK_SERVICES = serverless,kinesisanalytics export AWS_DEFAULT_REGION=us-east-1 usage: ## Show this help @@ -8,7 +8,7 @@ usage: ## Show this help install: ## Install dependencies #@npm install - @which localstack || pip install localstack + @which lstk > /dev/null || npm install -g @localstack/lstk @which awslocal || pip install awscli-local deploy: diff --git a/sample-archive/kinesis-analytics/README.md b/sample-archive/kinesis-analytics/README.md index b772ae71..96d58ba5 100644 --- a/sample-archive/kinesis-analytics/README.md +++ b/sample-archive/kinesis-analytics/README.md @@ -19,7 +19,7 @@ make install Make sure that LocalStack is started with the following `SERVICES` configuration: ``` -LOCALSTACK_AUTH_TOKEN=... DEBUG=1 SERVICES=cloudformation,kinesisanalytics,kinesis localstack start +LOCALSTACK_AUTH_TOKEN=... LOCALSTACK_DEBUG=1 LOCALSTACK_SERVICES=cloudformation,kinesisanalytics,kinesis lstk start ``` Deploy the app locally and run a Lambda test invocation: diff --git a/sample-archive/mediastore-uploads/Makefile b/sample-archive/mediastore-uploads/Makefile index b415bdcd..5d09cba9 100644 --- a/sample-archive/mediastore-uploads/Makefile +++ b/sample-archive/mediastore-uploads/Makefile @@ -7,13 +7,13 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies - @which localstack > /dev/null || pip install localstack + @which lstk > /dev/null || npm install -g @localstack/lstk @which awslocal > /dev/null || pip install awscli-local run: ## Run tests uploading objects via MediaStore API @@ -21,17 +21,17 @@ run: ## Run tests uploading objects via MediaStore API 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) - DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) localstack start -d + LOCALSTACK_DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) lstk start --non-interactive --type aws stop: @echo - localstack stop + lstk stop ready: @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: - @localstack logs > logs.txt + @lstk logs > logs.txt test-ci: @echo "Skipping CI: MediaStore APIs are currently unsupported by LocalStack." diff --git a/sample-archive/mediastore-uploads/README.md b/sample-archive/mediastore-uploads/README.md index 0a869af5..ef554a48 100644 --- a/sample-archive/mediastore-uploads/README.md +++ b/sample-archive/mediastore-uploads/README.md @@ -14,7 +14,7 @@ A demo application illustrating the use of the AWS MediaStore API with LocalStac - 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. - [Docker](https://docs.docker.com/get-docker/) -- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli) +- [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) ## Check prerequisites diff --git a/sample-archive/qldb-ledger-queries/Makefile b/sample-archive/qldb-ledger-queries/Makefile index 469c18ec..b4c90e33 100644 --- a/sample-archive/qldb-ledger-queries/Makefile +++ b/sample-archive/qldb-ledger-queries/Makefile @@ -10,13 +10,13 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v python3 > /dev/null 2>&1 || { echo "Python 3 is not installed. Please install Python 3 and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies - @which localstack || pip install localstack + @which lstk > /dev/null || npm install -g @localstack/lstk @which awslocal || pip install awscli-local @test -e .venv || $(PYTHON_BIN) -m venv .venv @.venv/bin/python -m pip install -r requirements.txt @@ -26,17 +26,17 @@ run: ## Run the sample queries against the local QLDB API 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) - DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) localstack start -d + LOCALSTACK_DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) lstk start --non-interactive --type aws stop: @echo - localstack stop + lstk stop ready: @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: - @localstack logs > logs.txt + @lstk logs > logs.txt test-ci: make start install ready run; return_code=`echo $$?`;\ diff --git a/sample-archive/qldb-ledger-queries/README.md b/sample-archive/qldb-ledger-queries/README.md index c56893c5..f38a6f0c 100644 --- a/sample-archive/qldb-ledger-queries/README.md +++ b/sample-archive/qldb-ledger-queries/README.md @@ -14,7 +14,7 @@ A demo application illustrating running queries against a Quantum Ledger Databas - 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. - [Docker](https://docs.docker.com/get-docker/) -- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli) +- [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) - [Python 3](https://www.python.org/downloads/) diff --git a/sample-archive/sagemaker-ml-jobs/Makefile b/sample-archive/sagemaker-ml-jobs/Makefile index b8a90f6a..5c6aff95 100644 --- a/sample-archive/sagemaker-ml-jobs/Makefile +++ b/sample-archive/sagemaker-ml-jobs/Makefile @@ -1,14 +1,14 @@ export AWS_ACCESS_KEY_ID ?= test export AWS_SECRET_ACCESS_KEY ?= test export AWS_DEFAULT_REGION = us-east-1 -export SERVICES = sagemaker,s3,logs,sts,iam +export LOCALSTACK_SERVICES = sagemaker,s3,logs,sts,iam PYTHON_BIN ?= $(shell which python3 || which python) 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 lstk > /dev/null || npm install -g @localstack/lstk @which awslocal || pip install awscli-local @test -e .venv || virtualenv --python $(PYTHON_BIN) .venv @. .venv/bin/activate; pip install tensorflow==1.15.0 sagemaker localstack 'requests>=2.20.0' diff --git a/sample-archive/sagemaker-ml-jobs/README.md b/sample-archive/sagemaker-ml-jobs/README.md index 94acc837..7e42e0ce 100644 --- a/sample-archive/sagemaker-ml-jobs/README.md +++ b/sample-archive/sagemaker-ml-jobs/README.md @@ -22,7 +22,7 @@ make install Make sure that LocalStack is started with the following `SERVICES` configuration: ``` -LOCALSTACK_AUTH_TOKEN=... DEBUG=1 SERVICES=sagemaker,s3,logs,sts,iam localstack start +LOCALSTACK_AUTH_TOKEN=... LOCALSTACK_DEBUG=1 LOCALSTACK_SERVICES=sagemaker,s3,logs,sts,iam lstk start ``` ## Running diff --git a/sample-archive/serverless-request-workers/Makefile b/sample-archive/serverless-request-workers/Makefile index 5d1401fd..a92c7b06 100644 --- a/sample-archive/serverless-request-workers/Makefile +++ b/sample-archive/serverless-request-workers/Makefile @@ -1,7 +1,7 @@ export AWS_ACCESS_KEY_ID ?= test export AWS_SECRET_ACCESS_KEY ?= test export DOCKER_BRIDGE ?= $(shell (uname -a | grep Linux > /dev/null) && echo 172.17.0.1 || echo docker.for.mac.localhost) -export SERVICES = edge,serverless,cloudformation,sts,stepfunctions,sqs +export LOCALSTACK_SERVICES = edge,serverless,cloudformation,sts,stepfunctions,sqs export START_WEB ?= 1 usage: ## Show this help @@ -10,7 +10,7 @@ usage: ## Show this help install: ## Install dependencies @npm install @which serverless || npm install -g serverless - @which localstack || pip install localstack + @which lstk > /dev/null || npm install -g @localstack/lstk run: ## Deploy and start the app locally @make install; \ diff --git a/serverless-lambda-layers/Makefile b/serverless-lambda-layers/Makefile index 905db661..e2de600e 100644 --- a/serverless-lambda-layers/Makefile +++ b/serverless-lambda-layers/Makefile @@ -8,7 +8,7 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v node > /dev/null 2>&1 || { echo "Node.js is not installed. Please install Node.js and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } @echo "All required prerequisites are available." @@ -17,7 +17,7 @@ install: ## Install dependencies @npm install @which serverless || npm install -g serverless @npm install --save-dev serverless-localstack - @which localstack || pip install localstack + @which lstk > /dev/null || npm install -g @localstack/lstk @which awslocal || pip install awscli-local run: ## Deploy the app locally and run a Lambda test invocation @@ -29,17 +29,17 @@ run: ## Deploy the app locally and run a Lambda test invocation 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) - DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) localstack start -d + LOCALSTACK_DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) lstk start --non-interactive --type aws stop: @echo - localstack stop + lstk stop ready: @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: - @localstack logs > logs.txt + @lstk logs > logs.txt test-ci: make start install ready run; return_code=`echo $$?`;\ diff --git a/serverless-lambda-layers/README.md b/serverless-lambda-layers/README.md index 86335494..f2355f3a 100644 --- a/serverless-lambda-layers/README.md +++ b/serverless-lambda-layers/README.md @@ -14,7 +14,7 @@ A demo application illustrating Lambda layers using LocalStack, deployed via the - 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. - [Docker](https://docs.docker.com/get-docker/) -- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli) +- [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [Node.js](https://nodejs.org/en/download/) with `npm` - [Serverless Framework](https://www.serverless.com/framework/docs/getting-started) diff --git a/serverless-websockets/Makefile b/serverless-websockets/Makefile index 342d4e91..b6220436 100644 --- a/serverless-websockets/Makefile +++ b/serverless-websockets/Makefile @@ -10,7 +10,7 @@ check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v node > /dev/null 2>&1 || { echo "Node.js is not installed. Please install Node.js and try again."; exit 1; } @command -v python3 > /dev/null 2>&1 || { echo "Python 3 is not installed. Please install Python 3 and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } @echo "All required prerequisites are available." @@ -18,7 +18,7 @@ check: ## Check if all required prerequisites are installed install: ## Install dependencies @npm install @which serverless || npm install -g serverless - @which localstack || pip install localstack + @which lstk > /dev/null || npm install -g @localstack/lstk @which awslocal || pip install awscli-local @test -e $(VENV_DIR) || virtualenv $(VENV_DIR) @. $(VENV_DIR)/bin/activate; pip install -r requirements.txt @@ -32,17 +32,17 @@ run: ## Deploy and run the app locally 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) - DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) localstack start -d + LOCALSTACK_DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) lstk start --non-interactive --type aws stop: @echo - localstack stop + lstk stop ready: @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: - @localstack logs > logs.txt + @lstk logs > logs.txt test-ci: make start install ready run; return_code=`echo $$?`;\ diff --git a/serverless-websockets/README.md b/serverless-websockets/README.md index 95ca944e..d793e006 100644 --- a/serverless-websockets/README.md +++ b/serverless-websockets/README.md @@ -14,7 +14,7 @@ A demo application illustrating API Gateway V2 WebSocket APIs using LocalStack, - 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. - [Docker](https://docs.docker.com/get-docker/) -- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli) +- [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [Node.js](https://nodejs.org/en/download/) with `npm` - [Serverless Framework](https://www.serverless.com/framework/docs/getting-started) diff --git a/stepfunctions-lambda/Makefile b/stepfunctions-lambda/Makefile index 0a297f60..6db833ee 100644 --- a/stepfunctions-lambda/Makefile +++ b/stepfunctions-lambda/Makefile @@ -8,7 +8,7 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v python3 > /dev/null 2>&1 || { echo "Python 3 is not installed. Please install Python 3 and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } @echo "All required prerequisites are available." @@ -58,18 +58,17 @@ create-lambdas: ## Create the Lambdas 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 start -d - + lstk start --non-interactive --type aws stop: @echo - localstack stop + lstk stop ready: @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: - @localstack logs > logs.txt + @lstk logs > logs.txt test-ci: make start install ready create-lambdas; return_code=`echo $$?`;\ diff --git a/stepfunctions-lambda/README.md b/stepfunctions-lambda/README.md index fdd573e4..4b1ddf57 100644 --- a/stepfunctions-lambda/README.md +++ b/stepfunctions-lambda/README.md @@ -14,7 +14,7 @@ A demo application illustrating how to orchestrate Lambda functions using AWS St - 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. - [Docker](https://docs.docker.com/get-docker/) -- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli) +- [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) ## Check prerequisites diff --git a/terraform-resources/Makefile b/terraform-resources/Makefile index 9d7e97d8..da8730f2 100644 --- a/terraform-resources/Makefile +++ b/terraform-resources/Makefile @@ -8,7 +8,7 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v terraform > /dev/null 2>&1 || { echo "Terraform is not installed. Please install Terraform and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } @echo "All required prerequisites are available." @@ -35,17 +35,17 @@ uninstall: 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) - DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) localstack start -d + LOCALSTACK_DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) lstk start --non-interactive --type aws stop: @echo - localstack stop + lstk stop ready: @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: - @localstack logs > logs.txt + @lstk logs > logs.txt test-ci: make start install ready run; return_code=`echo $$?`;\ diff --git a/terraform-resources/README.md b/terraform-resources/README.md index d956e852..6ff515d5 100644 --- a/terraform-resources/README.md +++ b/terraform-resources/README.md @@ -14,7 +14,7 @@ A demo application deploying various AWS resources to LocalStack via Terraform. - 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. - [Docker](https://docs.docker.com/get-docker/) -- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli) +- [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [Terraform](https://developer.hashicorp.com/terraform/downloads) ## Check prerequisites diff --git a/transfer-ftp-s3/Makefile b/transfer-ftp-s3/Makefile index 54788a5e..0c72a2b6 100644 --- a/transfer-ftp-s3/Makefile +++ b/transfer-ftp-s3/Makefile @@ -8,14 +8,14 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v python3 > /dev/null 2>&1 || { echo "Python 3 is not installed. Please install Python 3 and try again."; exit 1; } - @command -v localstack > /dev/null 2>&1 || { echo "LocalStack CLI is not installed. Please install it and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies # @npm install - @which localstack || pip install localstack + @which lstk > /dev/null || npm install -g @localstack/lstk @which awslocal || pip install awscli-local @test -e .venv || (virtualenv .venv; . .venv/bin/activate; pip install -r requirements.txt) @@ -25,17 +25,17 @@ run: ## Deploy and run the sample locally 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) - DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) localstack start -d + LOCALSTACK_DEBUG=1 LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) lstk start --non-interactive --type aws stop: @echo - localstack stop + lstk stop ready: @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) + @lstk status > /dev/null && echo Localstack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) logs: - @localstack logs > logs.txt + @lstk logs > logs.txt test-ci: make install start ready run; return_code=`echo $$?`;\ diff --git a/transfer-ftp-s3/README.md b/transfer-ftp-s3/README.md index 0c4e6613..fbafa830 100644 --- a/transfer-ftp-s3/README.md +++ b/transfer-ftp-s3/README.md @@ -14,7 +14,7 @@ A demo application illustrating the use of the AWS Transfer API with LocalStack. - 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. - [Docker](https://docs.docker.com/get-docker/) -- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli) +- [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) ## Check prerequisites From 4707e0d354996216117d514c09572c6080f414dd Mon Sep 17 00:00:00 2001 From: Harsh Mishra Date: Thu, 15 Oct 2026 18:04:21 +0530 Subject: [PATCH 2/8] Replace awslocal and tflocal with lstk aws and lstk tf lstk aws runs the AWS CLI against LocalStack with the endpoint, credentials and region set, and lstk tf runs Terraform with the LocalStack provider overrides, so the separate wrappers are no longer needed: - every awslocal call is now lstk aws, and every tflocal call lstk tf - check targets look for the aws binary lstk aws runs, and install targets no longer pip install awscli-local - README prerequisites list the AWS CLI and Terraform, used through lstk aws and lstk tf - CI installs the AWS CLI (v1, as awscli-local[ver1] did) instead of awscli-local Claude-Session: https://claude.ai/code/session_01DZfDmzUBPqNAu3yFKyfCNM --- .github/workflows/test.yml | 2 +- README.md | 3 +- apigw-custom-domain/Makefile | 5 +- apigw-custom-domain/README.md | 2 +- appsync-graphql-api/Makefile | 3 +- appsync-graphql-api/README.md | 4 +- appsync-graphql-api/run.sh | 6 +-- athena-s3-queries/Makefile | 3 +- athena-s3-queries/README.md | 2 +- athena-s3-queries/run.sh | 16 +++--- cdk-resources/Makefile | 2 +- cdk-resources/README.md | 2 +- cloudwatch-metrics-aws/Makefile | 3 +- cloudwatch-metrics-aws/README.md | 2 +- cloudwatch-metrics-aws/run.sh | 18 +++---- codecommit-git-repo/Makefile | 7 ++- codecommit-git-repo/README.md | 2 +- cognito-jwt/Makefile | 3 +- cognito-jwt/README.md | 2 +- cognito-jwt/test.sh | 34 ++++++------- ec2-docker-instances/Makefile | 2 +- ec2-docker-instances/README.md | 2 +- ec2-docker-instances/run.sh | 10 ++-- ecs-ecr-container-app/Makefile | 19 ++++--- ecs-ecr-container-app/README.md | 2 +- emr-serverless-python-dependencies/Makefile | 2 +- emr-serverless-python-dependencies/README.md | 2 +- .../start_job.sh | 2 +- .../stop-application.sh | 2 +- emr-serverless-sample/Makefile | 12 ++--- emr-serverless-sample/README.md | 2 +- emr-serverless-spark/Makefile | 12 ++--- emr-serverless-spark/README.md | 6 +-- glacier-s3-select/Makefile | 3 +- glacier-s3-select/README.md | 2 +- glacier-s3-select/test.sh | 20 ++++---- glue-etl-jobs/Makefile | 3 +- glue-etl-jobs/README.md | 2 +- glue-etl-jobs/run.sh | 50 +++++++++---------- glue-msk-schema-registry/Makefile | 3 +- glue-msk-schema-registry/README.md | 4 +- glue-msk-schema-registry/run.sh | 30 +++++------ glue-redshift-crawler/Makefile | 3 +- glue-redshift-crawler/README.md | 2 +- glue-redshift-crawler/run.sh | 30 +++++------ iam-policy-enforcement/Makefile | 3 +- iam-policy-enforcement/README.md | 2 +- iam-policy-enforcement/run.sh | 20 ++++---- iot-basics/Makefile | 13 +++-- iot-basics/README.md | 2 +- java-notification-app/Makefile | 8 +-- java-notification-app/README.md | 6 +-- lambda-container-image/Makefile | 11 ++-- lambda-container-image/README.md | 6 +-- lambda-debugging-sam-java/Makefile | 2 +- lambda-debugging-sam-javascript/Makefile | 2 +- lambda-debugging-sam-python/Makefile | 2 +- lambda-debugging-sam-typescript/Makefile | 2 +- lambda-event-filtering/Makefile | 4 +- lambda-event-filtering/README.md | 4 +- lambda-function-urls-javascript/Makefile | 7 ++- lambda-function-urls-javascript/README.md | 6 +-- lambda-function-urls-python/Makefile | 7 ++- lambda-function-urls-python/README.md | 2 +- lambda-hot-reloading/Makefile | 10 ++-- lambda-hot-reloading/README.md | 2 +- .../javascript-terraform-layers/README.md | 12 ++--- .../javascript-terraform/README.md | 14 +++--- lambda-hot-reloading/javascript/README.md | 8 +-- .../lambda-typescript-webpack/README.md | 8 +-- .../lambda-typescript-webpack/run.sh | 4 +- lambda-hot-reloading/typescript/README.md | 6 +-- lambda-php-bref-cdk-app/Makefile | 2 +- lambda-xray/README.md | 2 +- lambda-xray/python-powertools/Makefile | 5 +- lambda-xray/python-powertools/README.md | 2 +- .../python-xray-sdk/1-create-bucket.sh | 2 +- lambda-xray/python-xray-sdk/3-deploy.sh | 4 +- lambda-xray/python-xray-sdk/4-invoke.sh | 4 +- lambda-xray/python-xray-sdk/5-get-traces.sh | 6 +-- lambda-xray/python-xray-sdk/README.md | 4 +- mq-broker/Makefile | 3 +- mq-broker/README.md | 2 +- mq-broker/test.sh | 6 +-- multi-account-multi-region-s3-access/Makefile | 3 +- .../README.md | 2 +- multi-account-multi-region-s3-access/run.sh | 34 ++++++------- neptune-graph-db/Makefile | 3 +- neptune-graph-db/README.md | 2 +- rds-db-queries/Makefile | 3 +- rds-db-queries/README.md | 2 +- rds-failover-test/Makefile | 3 +- rds-failover-test/README.md | 2 +- reproducible-ml/Makefile | 3 +- reproducible-ml/README.md | 2 +- reproducible-ml/run.sh | 18 +++---- route53-dns-failover/Makefile | 3 +- route53-dns-failover/README.md | 2 +- route53-dns-failover/run.sh | 10 ++-- .../aws-sam-amplify-lambda-webapp/README.md | 4 +- .../cdk-for-terraform/python/README.md | 2 +- .../cloudfront-distributions/Makefile | 7 ++- .../cloudfront-distributions/README.md | 2 +- sample-archive/ec2-custom-ami/README.md | 2 +- sample-archive/ec2-custom-ami/run.sh | 6 +-- sample-archive/emr-hadoop-spark-jobs/Makefile | 19 ++++--- .../emr-hadoop-spark-jobs/README.md | 4 +- sample-archive/kinesis-analytics/Makefile | 19 ++++--- sample-archive/mediastore-uploads/Makefile | 3 +- sample-archive/mediastore-uploads/README.md | 2 +- sample-archive/mediastore-uploads/test.sh | 10 ++-- sample-archive/qldb-ledger-queries/Makefile | 3 +- sample-archive/qldb-ledger-queries/README.md | 2 +- sample-archive/sagemaker-ml-jobs/Makefile | 1 - sample-archive/sagemaker-ml-jobs/README.md | 4 +- .../serverless-request-workers/README.md | 4 +- serverless-lambda-layers/Makefile | 7 ++- serverless-websockets/Makefile | 3 +- stepfunctions-lambda/Makefile | 13 +++-- stepfunctions-lambda/README.md | 2 +- terraform-resources/Makefile | 2 +- terraform-resources/README.md | 2 +- transfer-ftp-s3/Makefile | 3 +- transfer-ftp-s3/README.md | 2 +- 124 files changed, 374 insertions(+), 409 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0f0c04ee..cb7cbce8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -41,7 +41,7 @@ jobs: - name: Install lstk and the AWS CLI wrapper run: | npm install -g @localstack/lstk - pip install awscli-local[ver1] virtualenv + pip install awscli virtualenv pip install --upgrade boto3 botocore - name: Setup config diff --git a/README.md b/README.md index 8b8d187e..82ea4f82 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Each example in the repository is prefixed with the name of the AWS service bein * [Docker](https://docs.docker.com/get-docker/) * [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/), which starts LocalStack: `npm install -g @localstack/lstk` or `brew install localstack/tap/lstk` -* [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) +* [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` * [Serverless](https://www.serverless.com/framework/docs/getting-started) * [Terraform](https://developer.hashicorp.com/terraform/downloads) * `make` & `jq` @@ -117,7 +117,6 @@ usage: ## Show this help install: ## Install dependencies @which lstk > /dev/null || npm install -g @localstack/lstk - @which awslocal || pip install awscli-local ## install whatever else you need, like node modules, python packages, etc. @test -e node_modules || npm install @test -e .venv || (python3 -m venv .venv; source .venv/bin/activate; pip install -r requirements.txt) diff --git a/apigw-custom-domain/Makefile b/apigw-custom-domain/Makefile index ef25408b..eece2712 100644 --- a/apigw-custom-domain/Makefile +++ b/apigw-custom-domain/Makefile @@ -16,7 +16,6 @@ check: ## Check if all required prerequisites are installed install: ## Install dependencies @which serverless || npm install -g serverless - @which awslocal || pip install awscli-local @if [ ! -d "node_modules" ]; then \ echo "node_modules not found. Running npm install..."; \ npm install; \ @@ -41,9 +40,9 @@ deploy: ## Deploy Serverless app to local environment with SSL setup for Ro @echo "Generating and importing test SSL certificate to ACM for Route53 domain test.example.com" @make cert @echo "Importing local test certificate into ACM API ..." - @awslocal acm import-certificate --certificate fileb://sslcert/server.crt --private-key fileb://sslcert/ssl.key + @lstk aws acm import-certificate --certificate fileb://sslcert/server.crt --private-key fileb://sslcert/ssl.key @echo "Creating Route53 hosted zone for test domain 'test.example.com' ..." - @awslocal route53 create-hosted-zone --name test.example.com --caller-reference r1 + @lstk aws route53 create-hosted-zone --name test.example.com --caller-reference r1 @echo "Deploying Serverless app to local environment" @SLS_DEBUG=1 npm run deploy @echo "Serverless app successfully deployed." diff --git a/apigw-custom-domain/README.md b/apigw-custom-domain/README.md index 50379e35..bccb26ab 100644 --- a/apigw-custom-domain/README.md +++ b/apigw-custom-domain/README.md @@ -17,7 +17,7 @@ Under the hood, the Serverless framework uses the [`serverless-localstack`](http - 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. - [Docker](https://docs.docker.com/get-docker/) - [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) -- [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) +- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` - [Node.js 18.x](https://nodejs.org/en/download/package-manager) with `npm` - [Serverless Framework](https://www.serverless.com/framework/docs/getting-started) 3.x - `openssl` diff --git a/appsync-graphql-api/Makefile b/appsync-graphql-api/Makefile index 0ed04540..bde56cd6 100644 --- a/appsync-graphql-api/Makefile +++ b/appsync-graphql-api/Makefile @@ -12,7 +12,7 @@ check: ## Check if all required prerequisites are installed @command -v node > /dev/null 2>&1 || { echo "Node.js is not installed. Please install Node.js and try again."; exit 1; } @command -v python3 > /dev/null 2>&1 || { echo "Python 3 is not installed. Please install Python 3 and try again."; exit 1; } @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } - @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } + @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @echo "All required prerequisites are available." @@ -20,7 +20,6 @@ install: ## Install dependencies @test -e node_modules || npm install @which serverless || npm install -g serverless @which lstk > /dev/null || npm install -g @localstack/lstk - @which awslocal || pip install awscli-local @test -e .venv || (python3 -m venv .venv; source .venv/bin/activate; pip install -r requirements.txt) run: ## Deploy the app locally and run an AppSync GraphQL test invocation diff --git a/appsync-graphql-api/README.md b/appsync-graphql-api/README.md index a6220533..9f666f3d 100644 --- a/appsync-graphql-api/README.md +++ b/appsync-graphql-api/README.md @@ -15,7 +15,7 @@ A demo application illustrating how to proxy data from different resources (Dyna - 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. - [Docker](https://docs.docker.com/get-docker/) - [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) -- [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) +- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` - [Python 3](https://www.python.org/downloads/) ## Check prerequisites @@ -63,7 +63,7 @@ You should see a success output in the terminal: The item should also have been added to your local DynamoDB table: ```bash -$ awslocal dynamodb scan --table-name table1 +$ lstk aws dynamodb scan --table-name table1 { "Items": [ { diff --git a/appsync-graphql-api/run.sh b/appsync-graphql-api/run.sh index 3a51cd36..47e51172 100755 --- a/appsync-graphql-api/run.sh +++ b/appsync-graphql-api/run.sh @@ -5,9 +5,9 @@ APPSYNC_URL=http://localhost:4566/graphql echo "Deploying Serverless app to local environment"; \ SLS_DEBUG=1 npm run deploy && \ echo "Serverless app successfully deployed." && \ -api_id=$(awslocal appsync list-graphql-apis | jq -r '(.graphqlApis[] | select(.name=="test-api")).apiId') && \ +api_id=$(lstk aws appsync list-graphql-apis | jq -r '(.graphqlApis[] | select(.name=="test-api")).apiId') && \ echo "DEBUG: api_id is: $api_id" && \ -api_key=$(awslocal appsync create-api-key --api-id $api_id | jq -r .apiKey.id) && \ +api_key=$(lstk aws appsync create-api-key --api-id $api_id | jq -r .apiKey.id) && \ echo "DEBUG: api_key is: $api_key" && \ echo "Starting a WebSocket client to subscribe to GraphQL mutation operations." && \ source .venv/bin/activate && \ @@ -16,7 +16,7 @@ echo "Now trying to invoke the AppSync API for DynamoDB integration under $APPSY curl -H "Content-Type: application/json" -H "x-api-key: $api_key" -d '{"query":"mutation {addPostDDB(id: \"id123\"){id}}"}' $APPSYNC_URL/$api_id && \ curl -H "Content-Type: application/json" -H "x-api-key: $api_key" -d '{"query":"query {getPostsDDB{id}}"}' $APPSYNC_URL/$api_id && \ echo "Scanning items from DynamoDB table - should include entry with 'id123':" && \ -awslocal dynamodb scan --table-name table1 && \ +lstk aws dynamodb scan --table-name table1 && \ echo "Now trying to invoke the AppSync API for RDS integration." && \ curl -H "Content-Type: application/json" -H "x-api-key: $api_key" -d '{"query":"mutation {addPostRDS(id: \"id123\"){id}}"}' $APPSYNC_URL/$api_id && \ curl -H "Content-Type: application/json" -H "x-api-key: $api_key" -d '{"query":"query {getPostsRDS{id}}"}' $APPSYNC_URL/$api_id diff --git a/athena-s3-queries/Makefile b/athena-s3-queries/Makefile index d25997df..956ab77a 100644 --- a/athena-s3-queries/Makefile +++ b/athena-s3-queries/Makefile @@ -9,14 +9,13 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } - @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } + @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies # @test -e node_modules || npm install @which lstk > /dev/null || npm install -g @localstack/lstk - @which awslocal || pip install awscli-local run: ## Set up database connections and run Athena queries locally @make install; \ diff --git a/athena-s3-queries/README.md b/athena-s3-queries/README.md index 642e2876..8bd88d7d 100644 --- a/athena-s3-queries/README.md +++ b/athena-s3-queries/README.md @@ -15,7 +15,7 @@ A demo application illustrating how to run Athena queries over S3 files locally - 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. - [Docker](https://docs.docker.com/get-docker/) - [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) -- [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) +- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` - [Node.js](https://nodejs.org/en/download/) with `npm` ## Check prerequisites diff --git a/athena-s3-queries/run.sh b/athena-s3-queries/run.sh index 87de00e6..079d2780 100755 --- a/athena-s3-queries/run.sh +++ b/athena-s3-queries/run.sh @@ -7,12 +7,12 @@ S3_INPUT=s3://$BUCKET/data/data.csv S3_OUTPUT=s3://$BUCKET/results echo Uploading test data to S3... -awslocal s3 mb s3://$BUCKET -awslocal s3 cp data/data.csv $S3_INPUT +lstk aws s3 mb s3://$BUCKET +lstk aws s3 cp data/data.csv $S3_INPUT function wait_for_query { for i in {1..50}; do - status=$(awslocal athena get-query-execution --query-execution-id $1 | jq -r '.QueryExecution.Status.State') + status=$(lstk aws athena get-query-execution --query-execution-id $1 | jq -r '.QueryExecution.Status.State') echo Waiting for completion status of query $1: $status if [ "$status" != "RUNNING" ]; then return @@ -25,20 +25,20 @@ function wait_for_query { echo Running queries to create database and table definitions... echo 'NOTE: This can take a very long time (several minutes) as the system is initializing' -queryId=$(awslocal athena start-query-execution --query-string "`cat queries/create_database.sql`" | jq -r '.QueryExecutionId') +queryId=$(lstk aws athena start-query-execution --query-string "`cat queries/create_database.sql`" | jq -r '.QueryExecutionId') wait_for_query $queryId -queryId=$(awslocal athena start-query-execution --query-string "`cat queries/create_tables.sql`" --query-execution-context Database=$DATABASE --result-configuration OutputLocation=$S3_OUTPUT | jq -r '.QueryExecutionId') +queryId=$(lstk aws athena start-query-execution --query-string "`cat queries/create_tables.sql`" --query-execution-context Database=$DATABASE --result-configuration OutputLocation=$S3_OUTPUT | jq -r '.QueryExecutionId') wait_for_query $queryId -queryId=$(awslocal athena start-query-execution --query-string "`cat queries/query_persons.sql`" --query-execution-context Database=$DATABASE --result-configuration OutputLocation=$S3_OUTPUT | jq -r '.QueryExecutionId') +queryId=$(lstk aws athena start-query-execution --query-string "`cat queries/query_persons.sql`" --query-execution-context Database=$DATABASE --result-configuration OutputLocation=$S3_OUTPUT | jq -r '.QueryExecutionId') echo Starting SELECT query over data in S3. Query ID: $queryId -outputLoc=$(awslocal athena get-query-execution --query-execution-id $queryId | jq -r '.QueryExecution.ResultConfiguration.OutputLocation') +outputLoc=$(lstk aws athena get-query-execution --query-execution-id $queryId | jq -r '.QueryExecution.ResultConfiguration.OutputLocation') echo S3 query output location: $outputLoc sleep 6 echo 'Waiting for query results to become available in S3 (this can take some time)' sleep 15 -awslocal s3 cp $outputLoc/results.csv /tmp/$queryId.results.csv +lstk aws s3 cp $outputLoc/results.csv /tmp/$queryId.results.csv echo Query result downloaded from S3: cat /tmp/$queryId.results.csv diff --git a/cdk-resources/Makefile b/cdk-resources/Makefile index 2434efc1..14803e3f 100644 --- a/cdk-resources/Makefile +++ b/cdk-resources/Makefile @@ -11,7 +11,7 @@ check: ## Check if all required prerequisites are installed @command -v node > /dev/null 2>&1 || { echo "Node.js is not installed. Please install Node.js and try again."; exit 1; } @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v cdklocal > /dev/null 2>&1 || { echo "cdklocal is not installed. Please run: npm install -g aws-cdk-local"; exit 1; } - @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } + @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies diff --git a/cdk-resources/README.md b/cdk-resources/README.md index 3966aa5e..6ab0e705 100644 --- a/cdk-resources/README.md +++ b/cdk-resources/README.md @@ -16,7 +16,7 @@ A demo application illustrating deployment of AWS resources locally using [AWS C - [Docker](https://docs.docker.com/get-docker/) - [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) - [`cdklocal`](https://github.com/localstack/aws-cdk-local) — install with `npm install -g aws-cdk-local` -- [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) +- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` - [Node.js](https://nodejs.org/en/download/) with `npm` ## Check prerequisites diff --git a/cloudwatch-metrics-aws/Makefile b/cloudwatch-metrics-aws/Makefile index 0278deda..050eb1e0 100644 --- a/cloudwatch-metrics-aws/Makefile +++ b/cloudwatch-metrics-aws/Makefile @@ -9,12 +9,11 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } - @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } + @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @command -v jq > /dev/null 2>&1 || { echo "jq is not installed. Please install jq and try again."; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies - @which awslocal || pip install awscli-local 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) diff --git a/cloudwatch-metrics-aws/README.md b/cloudwatch-metrics-aws/README.md index a33d1482..2c2a9939 100644 --- a/cloudwatch-metrics-aws/README.md +++ b/cloudwatch-metrics-aws/README.md @@ -21,7 +21,7 @@ To receive email notifications locally, you need a mock SMTP server such as [smt - 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. - [Docker](https://docs.docker.com/get-docker/) - [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) -- [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) +- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` - [`jq`](https://stedolan.github.io/jq/) ## Check prerequisites diff --git a/cloudwatch-metrics-aws/run.sh b/cloudwatch-metrics-aws/run.sh index 6b633863..a1f178f2 100755 --- a/cloudwatch-metrics-aws/run.sh +++ b/cloudwatch-metrics-aws/run.sh @@ -9,7 +9,7 @@ echo "using email $my_email for the example" echo 'creating lambda' zip failing-lambda.zip failing-lambda.py -awslocal lambda create-function \ +lstk aws lambda create-function \ --function-name my-failing-lambda \ --zip-file fileb://failing-lambda.zip \ --handler failing-lambda.lambda_handler \ @@ -17,12 +17,12 @@ awslocal lambda create-function \ --role arn:aws:iam::000000000000:role/my-role echo 'creating sns topic' -topic_arn=$(awslocal sns create-topic --name my-topic-alarm | jq -r .TopicArn) -awslocal sns subscribe --topic-arn $topic_arn --protocol email --notification-endpoint $my_email +topic_arn=$(lstk aws sns create-topic --name my-topic-alarm | jq -r .TopicArn) +lstk aws sns subscribe --topic-arn $topic_arn --protocol email --notification-endpoint $my_email echo 'creating cloud watch alarm' -awslocal cloudwatch put-metric-alarm \ +lstk aws cloudwatch put-metric-alarm \ --alarm-name my-lambda-alarm \ --metric-name Errors \ --namespace AWS/Lambda \ @@ -37,21 +37,21 @@ awslocal cloudwatch put-metric-alarm \ echo 'checking lambda state...' -state=$(awslocal lambda get-function --function-name my-failing-lambda | jq -r .Configuration.State) +state=$(lstk aws lambda get-function --function-name my-failing-lambda | jq -r .Configuration.State) while [ "$state" != Active ]; do sleep 1 - state=$(awslocal lambda get-function --function-name my-failing-lambda | jq -r .Configuration.State) + state=$(lstk aws lambda get-function --function-name my-failing-lambda | jq -r .Configuration.State) done echo 'lambda active, invoking lambda...' -awslocal lambda invoke --function-name my-failing-lambda out.txt +lstk aws lambda invoke --function-name my-failing-lambda out.txt -state=$(awslocal cloudwatch describe-alarms --alarm-names my-lambda-alarm | jq -r '.MetricAlarms[0].StateValue') +state=$(lstk aws cloudwatch describe-alarms --alarm-names my-lambda-alarm | jq -r '.MetricAlarms[0].StateValue') echo 'alarm state should change within the next minute.' while [ "$state" != ALARM ]; do echo 'checking alarm state...' sleep 10 - state=$(awslocal cloudwatch describe-alarms --alarm-names my-lambda-alarm | jq -r '.MetricAlarms[0].StateValue') + state=$(lstk aws cloudwatch describe-alarms --alarm-names my-lambda-alarm | jq -r '.MetricAlarms[0].StateValue') done echo '' diff --git a/codecommit-git-repo/Makefile b/codecommit-git-repo/Makefile index 6c9345e0..6536e406 100644 --- a/codecommit-git-repo/Makefile +++ b/codecommit-git-repo/Makefile @@ -10,18 +10,17 @@ check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v git > /dev/null 2>&1 || { echo "Git is not installed. Please install Git and try again."; exit 1; } @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } - @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } + @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies @which lstk > /dev/null || npm install -g @localstack/lstk - @which awslocal || pip install awscli-local run: ## Deploy and run the sample locally @echo "-----\nStep 1: Creating new CodeCommit git repository"; \ - awslocal codecommit create-repository --repository-name repo1; \ - gitUrl=$$(awslocal codecommit get-repository --repository-name repo1 | \ + lstk aws codecommit create-repository --repository-name repo1; \ + gitUrl=$$(lstk aws codecommit get-repository --repository-name repo1 | \ jq -r .repositoryMetadata.cloneUrlSsh); \ echo "-----\nStep 2: Cloning repo to temporary folder"; \ test -e $(REPO_FOLDER) || git clone $$gitUrl $(REPO_FOLDER); \ diff --git a/codecommit-git-repo/README.md b/codecommit-git-repo/README.md index 0f68d06e..17b37448 100644 --- a/codecommit-git-repo/README.md +++ b/codecommit-git-repo/README.md @@ -15,7 +15,7 @@ A demo application illustrating the use of the AWS CodeCommit API with LocalStac - 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. - [Docker](https://docs.docker.com/get-docker/) - [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) -- [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) +- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` - [Git](https://git-scm.com/) ## Check prerequisites diff --git a/cognito-jwt/Makefile b/cognito-jwt/Makefile index 21104898..448025b1 100644 --- a/cognito-jwt/Makefile +++ b/cognito-jwt/Makefile @@ -9,13 +9,12 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } - @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } + @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies @which lstk > /dev/null || npm install -g @localstack/lstk - @which awslocal || pip install awscli-local run: ## Run the scenario with the Cognito commands @./test.sh diff --git a/cognito-jwt/README.md b/cognito-jwt/README.md index f8389f83..46fb878b 100644 --- a/cognito-jwt/README.md +++ b/cognito-jwt/README.md @@ -22,7 +22,7 @@ To receive Cognito email verification codes locally, configure the following env - 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. - [Docker](https://docs.docker.com/get-docker/) - [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) -- [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) +- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` ## Check prerequisites diff --git a/cognito-jwt/test.sh b/cognito-jwt/test.sh index 2712f03a..175e1b9f 100755 --- a/cognito-jwt/test.sh +++ b/cognito-jwt/test.sh @@ -7,60 +7,60 @@ fi ## Create pool and client -pool_id=$(awslocal cognito-idp create-user-pool --pool-name test | jq -rc ".UserPool.Id") -client_id=$(awslocal cognito-idp create-user-pool-client --user-pool-id $pool_id --client-name test-client | jq -rc ".UserPoolClient.ClientId") +pool_id=$(lstk aws cognito-idp create-user-pool --pool-name test | jq -rc ".UserPool.Id") +client_id=$(lstk aws cognito-idp create-user-pool-client --user-pool-id $pool_id --client-name test-client | jq -rc ".UserPoolClient.ClientId") echo "Working with user pool ID $pool_id, user pool client ID $client_id" ## User sign up PASSWORD=12345678Aw! echo "Starting user signup flow" -awslocal cognito-idp sign-up --client-id $client_id --username example_user --password $PASSWORD --user-attributes Name=email,Value="$USER_EMAIL" +lstk aws cognito-idp sign-up --client-id $client_id --username example_user --password $PASSWORD --user-attributes Name=email,Value="$USER_EMAIL" echo "Please check email inbox for $USER_EMAIL, and enter the confirmation code below:" read code -awslocal cognito-idp confirm-sign-up --client-id $client_id --username example_user --confirmation-code $code +lstk aws cognito-idp confirm-sign-up --client-id $client_id --username example_user --confirmation-code $code # Alternative to the above line -# awslocal cognito-idp admin-confirm-sign-up --user-pool-id $pool_id --username example_user +# lstk aws cognito-idp admin-confirm-sign-up --user-pool-id $pool_id --username example_user # Update user attributes echo "Updating user attributes" -awslocal cognito-idp admin-update-user-attributes --user-pool-id $pool_id --username example_user --user-attributes Name=preferred_username,Value=nickname +lstk aws cognito-idp admin-update-user-attributes --user-pool-id $pool_id --username example_user --user-attributes Name=preferred_username,Value=nickname # Start auth flow echo "Starting auth flow" -awslocal cognito-idp initiate-auth --client-id $client_id --auth-flow USER_PASSWORD_AUTH --auth-parameters USERNAME=example_user,PASSWORD=$PASSWORD +lstk aws cognito-idp initiate-auth --client-id $client_id --auth-flow USER_PASSWORD_AUTH --auth-parameters USERNAME=example_user,PASSWORD=$PASSWORD # Restore forgotten password echo "Restore forgotten password" -awslocal cognito-idp forgot-password --client-id $client_id --username example_user +lstk aws cognito-idp forgot-password --client-id $client_id --username example_user echo "Please check email inbox for $USER_EMAIL, and enter the password reset code below:" read code NEW_PASSWORD=new_password123A! echo "Setting new password with the given verification code" -awslocal cognito-idp confirm-forgot-password --client-id $client_id --username example_user --confirmation-code $code --password $NEW_PASSWORD +lstk aws cognito-idp confirm-forgot-password --client-id $client_id --username example_user --confirmation-code $code --password $NEW_PASSWORD echo "Attempting to authenticate with the new password" -awslocal cognito-idp initiate-auth --client-id $client_id --auth-flow USER_PASSWORD_AUTH --auth-parameters USERNAME=example_user,PASSWORD=$NEW_PASSWORD +lstk aws cognito-idp initiate-auth --client-id $client_id --auth-flow USER_PASSWORD_AUTH --auth-parameters USERNAME=example_user,PASSWORD=$NEW_PASSWORD ## "Admin creates the user" with "admin initiates auth" workflow echo "Create new user as admin" -awslocal cognito-idp admin-create-user --user-pool-id $pool_id --username example_user2 +lstk aws cognito-idp admin-create-user --user-pool-id $pool_id --username example_user2 echo "Attempting to authenticate the not yet verified user - this request should FAIL" -awslocal cognito-idp admin-initiate-auth --user-pool-id $pool_id --client-id $client_id --auth-flow ADMIN_USER_PASSWORD_AUTH --auth-parameters USERNAME=example_user2,PASSWORD=$PASSWORD +lstk aws cognito-idp admin-initiate-auth --user-pool-id $pool_id --client-id $client_id --auth-flow ADMIN_USER_PASSWORD_AUTH --auth-parameters USERNAME=example_user2,PASSWORD=$PASSWORD echo $? echo "Setting password of new user" -awslocal cognito-idp admin-set-user-password --user-pool-id $pool_id --username example_user2 --password $PASSWORD --permanent +lstk aws cognito-idp admin-set-user-password --user-pool-id $pool_id --username example_user2 --password $PASSWORD --permanent echo "Attempting to authenticate the new user" -awslocal cognito-idp admin-initiate-auth --user-pool-id $pool_id --client-id $client_id --auth-flow ADMIN_USER_PASSWORD_AUTH --auth-parameters USERNAME=example_user2,PASSWORD=$PASSWORD +lstk aws cognito-idp admin-initiate-auth --user-pool-id $pool_id --client-id $client_id --auth-flow ADMIN_USER_PASSWORD_AUTH --auth-parameters USERNAME=example_user2,PASSWORD=$PASSWORD ## "Admin creates the user" with "user initiates auth" workflow -awslocal cognito-idp admin-create-user --user-pool-id "$pool_id" --username example_user3 --temporary-password "ChangeMe" +lstk aws cognito-idp admin-create-user --user-pool-id "$pool_id" --username example_user3 --temporary-password "ChangeMe" -session=$(awslocal cognito-idp initiate-auth --auth-flow "USER_PASSWORD_AUTH" --auth-parameters USERNAME=example_user3,PASSWORD="ChangeMe" --client-id "$client_id" | jq -r '.Session') +session=$(lstk aws cognito-idp initiate-auth --auth-flow "USER_PASSWORD_AUTH" --auth-parameters USERNAME=example_user3,PASSWORD="ChangeMe" --client-id "$client_id" | jq -r '.Session') -awslocal cognito-idp admin-respond-to-auth-challenge --user-pool-id "$pool_id" --client-id "$client_id" --challenge-responses "NEW_PASSWORD=FinalPassword,USERNAME=example_user3" --challenge-name NEW_PASSWORD_REQUIRED --session "$session" +lstk aws cognito-idp admin-respond-to-auth-challenge --user-pool-id "$pool_id" --client-id "$client_id" --challenge-responses "NEW_PASSWORD=FinalPassword,USERNAME=example_user3" --challenge-name NEW_PASSWORD_REQUIRED --session "$session" diff --git a/ec2-docker-instances/Makefile b/ec2-docker-instances/Makefile index af26aa25..ea726f69 100644 --- a/ec2-docker-instances/Makefile +++ b/ec2-docker-instances/Makefile @@ -2,7 +2,7 @@ check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } - @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } + @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @echo "All required prerequisites are available." diff --git a/ec2-docker-instances/README.md b/ec2-docker-instances/README.md index b3222523..55d1768d 100644 --- a/ec2-docker-instances/README.md +++ b/ec2-docker-instances/README.md @@ -17,7 +17,7 @@ A demo application illustrating LocalStack EC2 and SSM functionality using the D - 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. - [Docker](https://docs.docker.com/get-docker/) - [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) -- [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) +- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` - [`jq`](https://stedolan.github.io/jq/) ## Check prerequisites diff --git a/ec2-docker-instances/run.sh b/ec2-docker-instances/run.sh index 83483c2d..a42908c2 100755 --- a/ec2-docker-instances/run.sh +++ b/ec2-docker-instances/run.sh @@ -10,13 +10,13 @@ AMI_ID=ami-00a001 # Start an instance # printf '\e[31m%s\e[0m\n' "Starting an instance based on the Docker-backed AMI" -INSTANCE_ID=$(awslocal ec2 run-instances --image-id ${AMI_ID} --count 1 | jq --raw-output ".Instances[].InstanceId") +INSTANCE_ID=$(lstk aws ec2 run-instances --image-id ${AMI_ID} --count 1 | jq --raw-output ".Instances[].InstanceId") # # Send command using AWS Systems Manager # printf '\e[31m%s\e[0m\n' "Sending an SSM command to this instance" -COMMAND_ID=$(awslocal ssm send-command --document-name "AWS-RunShellScript" \ +COMMAND_ID=$(lstk aws ssm send-command --document-name "AWS-RunShellScript" \ --document-version "1" \ --instance-ids ${INSTANCE_ID} \ --parameters "commands='cat lsb-release',workingDirectory=/etc" \ @@ -29,16 +29,16 @@ sleep 2 # Retrieve the results of the command # printf '\e[31m%s\e[0m\n' "Results of the SSM command" -awslocal ssm get-command-invocation --command-id ${COMMAND_ID} --instance-id ${INSTANCE_ID} +lstk aws ssm get-command-invocation --command-id ${COMMAND_ID} --instance-id ${INSTANCE_ID} # # Create a new AMI based off this running instance # printf '\e[31m%s\e[0m\n' "Taking a snapshot of the running instance into a new AMI" -awslocal ec2 create-image --instance-id ${INSTANCE_ID} --name localstack-sample-${RANDOM} +lstk aws ec2 create-image --instance-id ${INSTANCE_ID} --name localstack-sample-${RANDOM} # # Terminate the instance # printf '\e[31m%s\e[0m\n' "Terminating the instance" -awslocal ec2 terminate-instances --instance-ids ${INSTANCE_ID} +lstk aws ec2 terminate-instances --instance-ids ${INSTANCE_ID} diff --git a/ecs-ecr-container-app/Makefile b/ecs-ecr-container-app/Makefile index ba038a19..ab3fbc79 100644 --- a/ecs-ecr-container-app/Makefile +++ b/ecs-ecr-container-app/Makefile @@ -9,34 +9,33 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } - @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } + @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies @which lstk > /dev/null || npm install -g @localstack/lstk - @which awslocal || pip install awscli-local run: ## Build and deploy the app locally echo "Creating a new ECR repository locally"; \ - repoUri=$$(awslocal ecr create-repository --repository-name repo1 | jq -r '.repository.repositoryUri'); \ + repoUri=$$(lstk aws ecr create-repository --repository-name repo1 | jq -r '.repository.repositoryUri'); \ echo "Building the Docker image, pushing it to local ECR URL: $$repoUri"; \ sleep 3; \ docker build -t "$$repoUri" .; \ docker push "$$repoUri"; \ docker rmi "$$repoUri"; \ echo "Creating ECS infrastructure locally"; \ - awslocal cloudformation create-stack --stack-name infra --template-body file://templates/ecs.infra.yml && \ - awslocal cloudformation wait stack-create-complete --stack-name infra && \ + lstk aws cloudformation create-stack --stack-name infra --template-body file://templates/ecs.infra.yml && \ + lstk aws cloudformation wait stack-create-complete --stack-name infra && \ echo "Deploying ECS app to local environment"; \ - awslocal cloudformation create-stack --stack-name sample \ + lstk aws cloudformation create-stack --stack-name sample \ --template-body file://templates/ecs.sample.yml \ --parameters ParameterKey=ImageUrl,ParameterValue=$$repoUri && \ - awslocal cloudformation wait stack-create-complete --stack-name sample && \ + lstk aws cloudformation wait stack-create-complete --stack-name sample && \ echo "ECS app successfully deployed. Trying to access app endpoint." && \ - cluster_arn=$$(awslocal ecs list-clusters | jq -r '.clusterArns[0]') && \ - for i in {1..5}; do task_arn=$$(awslocal ecs list-tasks --cluster $$cluster_arn | jq -r '.taskArns[0]'); if [ "$$task_arn" != "null" ]; then break; fi; sleep 2; done && \ - for i in {1..5}; do app_port=$$(awslocal ecs describe-tasks --cluster $$cluster_arn --tasks $$task_arn | jq -r '.tasks[0].containers[0].networkBindings[0].hostPort'); if [ "$$app_port" != "null" ]; then break; fi; sleep 2; done && \ + cluster_arn=$$(lstk aws ecs list-clusters | jq -r '.clusterArns[0]') && \ + for i in {1..5}; do task_arn=$$(lstk aws ecs list-tasks --cluster $$cluster_arn | jq -r '.taskArns[0]'); if [ "$$task_arn" != "null" ]; then break; fi; sleep 2; done && \ + for i in {1..5}; do app_port=$$(lstk aws ecs describe-tasks --cluster $$cluster_arn --tasks $$task_arn | jq -r '.tasks[0].containers[0].networkBindings[0].hostPort'); if [ "$$app_port" != "null" ]; then break; fi; sleep 2; done && \ echo "curling localhost:$$app_port" && \ curl localhost:$$app_port && \ echo "Sample app (nginx) successfully deployed. You can access it under http://localhost:$$app_port" diff --git a/ecs-ecr-container-app/README.md b/ecs-ecr-container-app/README.md index aa4ef2b0..7e06c63d 100644 --- a/ecs-ecr-container-app/README.md +++ b/ecs-ecr-container-app/README.md @@ -15,7 +15,7 @@ A demo application illustrating ECS container applications running locally using - 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. - [Docker](https://docs.docker.com/get-docker/) - [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) -- [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) +- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` ## Check prerequisites diff --git a/emr-serverless-python-dependencies/Makefile b/emr-serverless-python-dependencies/Makefile index a6d53af0..e058220d 100644 --- a/emr-serverless-python-dependencies/Makefile +++ b/emr-serverless-python-dependencies/Makefile @@ -8,7 +8,7 @@ check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v terraform > /dev/null 2>&1 || { echo "Terraform is not installed. Please install Terraform and try again."; exit 1; } @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } - @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } + @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @echo "All required prerequisites are available." install-ci-dependencies: diff --git a/emr-serverless-python-dependencies/README.md b/emr-serverless-python-dependencies/README.md index 2ba4daec..683c7ef9 100644 --- a/emr-serverless-python-dependencies/README.md +++ b/emr-serverless-python-dependencies/README.md @@ -15,7 +15,7 @@ A demo application illustrating how to add Python dependencies to an EMR Serverl - 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. - [Docker](https://docs.docker.com/get-docker/) - [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) -- [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) +- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` - [Terraform](https://developer.hashicorp.com/terraform/downloads) ~> 1.9.1 ## Check prerequisites diff --git a/emr-serverless-python-dependencies/start_job.sh b/emr-serverless-python-dependencies/start_job.sh index 12779f69..e4d5df0f 100755 --- a/emr-serverless-python-dependencies/start_job.sh +++ b/emr-serverless-python-dependencies/start_job.sh @@ -11,7 +11,7 @@ s3a_bucket="s3a://${bucket}" if [ $local = "local" ]; then # LocalStack doesn't yet support adding spark.archives, adding the environment from the volume added to localstack container env_path="/tmp/environment" - AWS=awslocal + AWS="lstk aws" fi if [ $local = "aws" ]; then env_path="environment" diff --git a/emr-serverless-python-dependencies/stop-application.sh b/emr-serverless-python-dependencies/stop-application.sh index 282c983c..585c6826 100755 --- a/emr-serverless-python-dependencies/stop-application.sh +++ b/emr-serverless-python-dependencies/stop-application.sh @@ -3,7 +3,7 @@ tfoutput=$(terraform output -json) application_id=$(echo $tfoutput | jq .application_id.value | tr -d '"') if [ $local = "local" ]; then - AWS=awslocal + AWS="lstk aws" fi if [ $local = "aws" ]; then AWS=aws diff --git a/emr-serverless-sample/Makefile b/emr-serverless-sample/Makefile index f8356b8f..74cb0c55 100644 --- a/emr-serverless-sample/Makefile +++ b/emr-serverless-sample/Makefile @@ -12,7 +12,7 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } - @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } + @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @command -v mvn > /dev/null 2>&1 || { echo "Maven is not installed. Please install Maven and try again."; exit 1; } @echo "All required prerequisites are available." @@ -34,18 +34,18 @@ logs: ## Retrieve LocalStack logs @lstk logs > logs.txt deploy: ## Create S3 bucket and upload the JAR file - @awslocal s3 mb s3://$(S3_BUCKET) || true - @awslocal s3 cp hello-world/target/hello-world-1.0.jar s3://$(S3_BUCKET)/code/hello-world-1.0.jar + @lstk aws s3 mb s3://$(S3_BUCKET) || true + @lstk aws s3 cp hello-world/target/hello-world-1.0.jar s3://$(S3_BUCKET)/code/hello-world-1.0.jar run: ## Create and run an EMR Serverless job - $(eval APP_ID := $(shell awslocal emr-serverless create-application \ + $(eval APP_ID := $(shell lstk aws emr-serverless create-application \ --type SPARK \ --name hello-world-demo \ --release-label emr-6.9.0 \ --query applicationId --output text)) @echo "Application ID: $(APP_ID)" - @awslocal emr-serverless start-application --application-id $(APP_ID) - @awslocal emr-serverless start-job-run \ + @lstk aws emr-serverless start-application --application-id $(APP_ID) + @lstk aws emr-serverless start-job-run \ --application-id $(APP_ID) \ --execution-role-arn $(JOB_ROLE_ARN) \ --job-driver '{"sparkSubmit": {"entryPoint": "s3://$(S3_BUCKET)/code/hello-world-1.0.jar"}}' diff --git a/emr-serverless-sample/README.md b/emr-serverless-sample/README.md index cb923207..d5b4e988 100644 --- a/emr-serverless-sample/README.md +++ b/emr-serverless-sample/README.md @@ -15,7 +15,7 @@ A demo application illustrating how to run a Java Spark job on EMR Serverless us - 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. - [Docker](https://docs.docker.com/get-docker/) - [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) -- [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) +- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` - [Java](https://openjdk.org/) and [Maven](https://maven.apache.org/) ## Check prerequisites diff --git a/emr-serverless-spark/Makefile b/emr-serverless-spark/Makefile index fa34432c..771f9ae2 100644 --- a/emr-serverless-spark/Makefile +++ b/emr-serverless-spark/Makefile @@ -12,7 +12,7 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } - @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } + @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @command -v mvn > /dev/null 2>&1 || { echo "Maven is not installed. Please install Maven and try again."; exit 1; } @echo "All required prerequisites are available." @@ -35,18 +35,18 @@ logs: ## Retrieve LocalStack logs @lstk logs > logs.txt deploy: ## Create S3 bucket and upload the JAR file - @awslocal s3 mb s3://$(S3_BUCKET) || true - @awslocal s3 cp java-demo-1.0.jar s3://$(S3_BUCKET)/code/java-spark/java-demo-1.0.jar + @lstk aws s3 mb s3://$(S3_BUCKET) || true + @lstk aws s3 cp java-demo-1.0.jar s3://$(S3_BUCKET)/code/java-spark/java-demo-1.0.jar run: ## Create and run an EMR Serverless Spark job - $(eval APP_ID := $(shell awslocal emr-serverless create-application \ + $(eval APP_ID := $(shell lstk aws emr-serverless create-application \ --type SPARK \ --name serverless-java-demo \ --release-label emr-6.9.0 \ --query applicationId --output text)) @echo "Application ID: $(APP_ID)" - @awslocal emr-serverless start-application --application-id $(APP_ID) - @awslocal emr-serverless start-job-run \ + @lstk aws emr-serverless start-application --application-id $(APP_ID) + @lstk aws emr-serverless start-job-run \ --application-id $(APP_ID) \ --execution-role-arn $(JOB_ROLE_ARN) \ --job-driver '{"sparkSubmit": {"entryPoint": "s3://$(S3_BUCKET)/code/java-spark/java-demo-1.0.jar", "sparkSubmitParameters": "--class HelloWorld"}}' diff --git a/emr-serverless-spark/README.md b/emr-serverless-spark/README.md index 2fac2195..41b775a4 100644 --- a/emr-serverless-spark/README.md +++ b/emr-serverless-spark/README.md @@ -15,7 +15,7 @@ A demo application illustrating how to run a Java Spark job on EMR Serverless us - 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. - [Docker](https://docs.docker.com/get-docker/) - [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) -- [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) +- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` - [Java](https://openjdk.org/) and [Maven](https://maven.apache.org/) ## Check prerequisites @@ -26,7 +26,7 @@ make check ## Configure a Custom AWS Profile (optional) -If not using `awslocal`, add the following profile to `~/.aws/config`: +If not using `lstk aws`, add the following profile to `~/.aws/config`: ```shell [profile localstack] @@ -92,7 +92,7 @@ The Spark job submits with: To stop the EMR Serverless application after the job completes: ```bash -awslocal emr-serverless stop-application --application-id $APPLICATION_ID +lstk aws emr-serverless stop-application --application-id $APPLICATION_ID ``` ## License diff --git a/glacier-s3-select/Makefile b/glacier-s3-select/Makefile index 3bc91119..4818aa10 100644 --- a/glacier-s3-select/Makefile +++ b/glacier-s3-select/Makefile @@ -9,13 +9,12 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } - @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } + @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies @which lstk > /dev/null || npm install -g @localstack/lstk - @which awslocal || pip install awscli-local run: ## Upload data and run Glacier/S3 Select queries locally ./test.sh diff --git a/glacier-s3-select/README.md b/glacier-s3-select/README.md index 35ecf4b5..7142d1fc 100644 --- a/glacier-s3-select/README.md +++ b/glacier-s3-select/README.md @@ -15,7 +15,7 @@ A demo application illustrating the use of the Glacier API and S3 Select queries - 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. - [Docker](https://docs.docker.com/get-docker/) - [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) -- [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) +- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` ## Check prerequisites diff --git a/glacier-s3-select/test.sh b/glacier-s3-select/test.sh index 43582f36..bbabb250 100755 --- a/glacier-s3-select/test.sh +++ b/glacier-s3-select/test.sh @@ -1,10 +1,10 @@ #!/bin/bash echo "Creating S3 bucket and Glacier vault in LocalStack" -awslocal s3 mb s3://test1 -awslocal s3 cp data.csv s3://test1/data.csv +lstk aws s3 mb s3://test1 +lstk aws s3 cp data.csv s3://test1/data.csv echo "Running S3 Select query against CSV file in bucket" -awslocal s3api select-object-content --bucket test1 --key data.csv \ +lstk aws s3api select-object-content --bucket test1 --key data.csv \ --expression 'select count(*), sum(Cost) from s3object' --expression-type SQL \ --input-serialization 'CSV={FileHeaderInfo=USE}' --output-serialization 'CSV={}' s3-result.csv @@ -16,26 +16,26 @@ echo '----' echo echo 'Creating new vault in local Glacier API' -awslocal glacier create-vault --account-id - --vault-name vault1 -awslocal s3 mb s3://glacier-results +lstk aws glacier create-vault --account-id - --vault-name vault1 +lstk aws s3 mb s3://glacier-results echo 'Uploading test CSV file to new Glacier vault' -archiveId=$(awslocal glacier upload-archive --vault-name vault1 --account-id - --body data.csv | jq -r '.archiveId') +archiveId=$(lstk aws glacier upload-archive --vault-name vault1 --account-id - --body data.csv | jq -r '.archiveId') echo 'Initiating new "select" job in Glacier to query data from CSV file in vault archive' #sed -i 's/"ArchiveId": ".*"/"ArchiveId": "'$archiveId'"/' glacier-params.json perl -i -pe 's/"ArchiveId": ".*"/"ArchiveId": "'$archiveId'"/' glacier-params.json -outPath=$(awslocal glacier initiate-job --account-id - --vault-name vault1 --job-parameters file://glacier-params.json | jq -r '.jobOutputPath') +outPath=$(lstk aws glacier initiate-job --account-id - --vault-name vault1 --job-parameters file://glacier-params.json | jq -r '.jobOutputPath') echo 'Sleep some time to wait for Glacier job to finish' sleep 3 echo echo 'Contents of result bucket after running Glacier query:' -awslocal s3 ls s3://glacier-results/$outPath/results/ +lstk aws s3 ls s3://glacier-results/$outPath/results/ echo echo 'Downloading test CSV file from new Glacier vault' -resultFile=$(awslocal s3 ls s3://glacier-results/$outPath/results/ | awk '{print $4}') -awslocal s3 cp s3://glacier-results/$outPath/results/$resultFile glacier-result.csv +resultFile=$(lstk aws s3 ls s3://glacier-results/$outPath/results/ | awk '{print $4}') +lstk aws s3 cp s3://glacier-results/$outPath/results/$resultFile glacier-result.csv echo 'Query results for S3 Select query below' echo '----' diff --git a/glue-etl-jobs/Makefile b/glue-etl-jobs/Makefile index e7d03452..d8e4a2f5 100644 --- a/glue-etl-jobs/Makefile +++ b/glue-etl-jobs/Makefile @@ -8,13 +8,12 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } - @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } + @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies @which lstk > /dev/null || npm install -g @localstack/lstk - @which awslocal || pip install awscli-local run: ## Prepare environment and run sample Glue PySpark ETL job ./run.sh diff --git a/glue-etl-jobs/README.md b/glue-etl-jobs/README.md index 7324d655..a2d67457 100644 --- a/glue-etl-jobs/README.md +++ b/glue-etl-jobs/README.md @@ -15,7 +15,7 @@ A demo application illustrating the use of the AWS Glue API to run local ETL (Ex - 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. - [Docker](https://docs.docker.com/get-docker/) - [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) -- [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) +- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` ## Check prerequisites diff --git a/glue-etl-jobs/run.sh b/glue-etl-jobs/run.sh index ebe26c56..5339199c 100755 --- a/glue-etl-jobs/run.sh +++ b/glue-etl-jobs/run.sh @@ -7,55 +7,55 @@ CLUSTER_IDENTIFIER=glue-etl-cluster1 CONNECTION_NAME=glue-etl-cluster1-connection echo Putting PySpark script to test S3 bucket ... -awslocal s3 mb "s3://$BUCKET" -awslocal s3 cp "job.py" "$S3_URL" -awslocal s3 mb "s3://glue-sample-target" +lstk aws s3 mb "s3://$BUCKET" +lstk aws s3 cp "job.py" "$S3_URL" +lstk aws s3 mb "s3://glue-sample-target" -awslocal rds create-db-cluster --db-cluster-identifier "$CLUSTER_IDENTIFIER" --engine aurora-postgresql --database-name test -awslocal rds wait db-cluster-available --db-cluster-identifier "$CLUSTER_IDENTIFIER" +lstk aws rds create-db-cluster --db-cluster-identifier "$CLUSTER_IDENTIFIER" --engine aurora-postgresql --database-name test +lstk aws rds wait db-cluster-available --db-cluster-identifier "$CLUSTER_IDENTIFIER" -db_port=$(awslocal rds describe-db-clusters --db-cluster-identifier "$CLUSTER_IDENTIFIER" | jq -r '.DBClusters[0].Port') +db_port=$(lstk aws rds describe-db-clusters --db-cluster-identifier "$CLUSTER_IDENTIFIER" | jq -r '.DBClusters[0].Port') echo Using local RDS database on port $db_port ... echo Creating Glue databases and tables ... -awslocal glue create-database --database-input '{"Name": "legislators"}' -awslocal glue create-table --database legislators \ +lstk aws glue create-database --database-input '{"Name": "legislators"}' +lstk aws glue create-table --database legislators \ --table-input '{"Name": "memberships_json", "Parameters": {"connectionName": "'$CONNECTION_NAME'"}, "StorageDescriptor": {"Location": "test.memberships"}}' -awslocal glue create-table --database legislators \ +lstk aws glue create-table --database legislators \ --table-input '{"Name": "persons_json", "Parameters": {"connectionName": "'$CONNECTION_NAME'"}, "StorageDescriptor": {"Location": "test.persons"}}' -awslocal glue create-table --database legislators \ +lstk aws glue create-table --database legislators \ --table-input '{"Name": "organizations_json", "Parameters": {"connectionName": "'$CONNECTION_NAME'"}, "StorageDescriptor": {"Location": "test.organizations"}}' -awslocal glue create-connection \ +lstk aws glue create-connection \ --connection-input '{"Name": "'$CONNECTION_NAME'", "ConnectionType": "JDBC", "ConnectionProperties": {"USERNAME": "test", "PASSWORD": "test", "JDBC_CONNECTION_URL": "jdbc:postgresql://localhost.localstack.cloud:'$db_port'/test"}}' -secret=$(awslocal secretsmanager create-secret --name pass --secret-string "test" | jq -r ".ARN") +secret=$(lstk aws secretsmanager create-secret --name pass --secret-string "test" | jq -r ".ARN") db_resource_arn="arn:aws:rds:us-east-1:000000000000:cluster:$CLUSTER_IDENTIFIER" echo Creating Postgres database tables with data ... -awslocal rds-data execute-statement --resource-arn "$db_resource_arn" --secret-arn "$secret" --database test --sql 'CREATE TABLE IF NOT EXISTS persons(id varchar, name varchar)' -awslocal rds-data execute-statement --resource-arn "$db_resource_arn" --secret-arn "$secret" --database test --sql 'CREATE TABLE IF NOT EXISTS organizations(org_id varchar, org_name varchar)' -awslocal rds-data execute-statement --resource-arn "$db_resource_arn" --secret-arn "$secret" --database test --sql 'CREATE TABLE IF NOT EXISTS memberships(person_id varchar, organization_id varchar)' -awslocal rds-data execute-statement --resource-arn "$db_resource_arn" --secret-arn "$secret" --database test --sql "insert into persons(id, name) VALUES('p1', 'person 1')" -awslocal rds-data execute-statement --resource-arn "$db_resource_arn" --secret-arn "$secret" --database test --sql "insert into organizations(org_id, org_name) VALUES('o1', 'org1')" -awslocal rds-data execute-statement --resource-arn "$db_resource_arn" --secret-arn "$secret" --database test --sql "insert into memberships(person_id, organization_id) VALUES('p1', 'o1')" -awslocal rds-data execute-statement --resource-arn "$db_resource_arn" --secret-arn "$secret" --database test --sql 'CREATE TABLE IF NOT EXISTS hist_root(id varchar, name varchar, org_id varchar, org_name varchar, person_id varchar, organization_id varchar)' +lstk aws rds-data execute-statement --resource-arn "$db_resource_arn" --secret-arn "$secret" --database test --sql 'CREATE TABLE IF NOT EXISTS persons(id varchar, name varchar)' +lstk aws rds-data execute-statement --resource-arn "$db_resource_arn" --secret-arn "$secret" --database test --sql 'CREATE TABLE IF NOT EXISTS organizations(org_id varchar, org_name varchar)' +lstk aws rds-data execute-statement --resource-arn "$db_resource_arn" --secret-arn "$secret" --database test --sql 'CREATE TABLE IF NOT EXISTS memberships(person_id varchar, organization_id varchar)' +lstk aws rds-data execute-statement --resource-arn "$db_resource_arn" --secret-arn "$secret" --database test --sql "insert into persons(id, name) VALUES('p1', 'person 1')" +lstk aws rds-data execute-statement --resource-arn "$db_resource_arn" --secret-arn "$secret" --database test --sql "insert into organizations(org_id, org_name) VALUES('o1', 'org1')" +lstk aws rds-data execute-statement --resource-arn "$db_resource_arn" --secret-arn "$secret" --database test --sql "insert into memberships(person_id, organization_id) VALUES('p1', 'o1')" +lstk aws rds-data execute-statement --resource-arn "$db_resource_arn" --secret-arn "$secret" --database test --sql 'CREATE TABLE IF NOT EXISTS hist_root(id varchar, name varchar, org_id varchar, org_name varchar, person_id varchar, organization_id varchar)' echo Starting Glue job from PySpark script ... # NOTE: pass the cluster identifier (rather than the actual connection name) here on purpose, to # match the working configuration on master. Passing the real connection name currently triggers # a JobInitializationException in LocalStack's Glue executor, which makes the job fail at init # before the worker container even starts. -awslocal glue create-job --name $JOB_NAME --role r1 \ +lstk aws glue create-job --name $JOB_NAME --role r1 \ --command '{"Name": "pythonshell", "ScriptLocation": "'$S3_URL'"}' \ --connections '{"Connections": ["'$CLUSTER_IDENTIFIER'"]}' -run_id=$(awslocal glue start-job-run --job-name $JOB_NAME | jq -r .JobRunId) +run_id=$(lstk aws glue start-job-run --job-name $JOB_NAME | jq -r .JobRunId) -state=$(awslocal glue get-job-run --job-name $JOB_NAME --run-id $run_id | jq -r .JobRun.JobRunState) +state=$(lstk aws glue get-job-run --job-name $JOB_NAME --run-id $run_id | jq -r .JobRun.JobRunState) for i in {1..35}; do echo "Waiting for Glue job ID '$run_id' to finish (current status: $state) ..." sleep 4 - state=$(awslocal glue get-job-run --job-name $JOB_NAME --run-id $run_id | jq -r .JobRun.JobRunState) + state=$(lstk aws glue get-job-run --job-name $JOB_NAME --run-id $run_id | jq -r .JobRun.JobRunState) if [ "$state" == SUCCEEDED ]; then echo "Done - Glue job execution finished. Please check the LocalStack container logs for more details." exit 0 @@ -68,8 +68,8 @@ elif [ "$state" == FAILED ]; then # because Spark worker startup was slow enough that the wait loop timed out # before the job reached FAILED). Print diagnostic info and exit 0 so the # sample CI keeps passing until LocalStack exposes RDS to spawned containers. - awslocal glue get-job-run --job-name $JOB_NAME --run-id $run_id - awslocal logs filter-log-events --log-group-name /aws-glue/jobs || true + lstk aws glue get-job-run --job-name $JOB_NAME --run-id $run_id + lstk aws logs filter-log-events --log-group-name /aws-glue/jobs || true lstk logs || true echo "Glue job reached FAILED state (likely due to JDBC connectivity from the spawned Spark container) - see logs above for details." exit 0 diff --git a/glue-msk-schema-registry/Makefile b/glue-msk-schema-registry/Makefile index 5692217c..7cae8daa 100644 --- a/glue-msk-schema-registry/Makefile +++ b/glue-msk-schema-registry/Makefile @@ -10,13 +10,12 @@ check: ## Check if all required prerequisites are installed @command -v java > /dev/null 2>&1 || { echo "Java is not installed. Please install Java and try again."; exit 1; } @command -v mvn > /dev/null 2>&1 || { echo "Maven is not installed. Please install Maven and try again."; exit 1; } @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } - @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } + @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies @which lstk > /dev/null || npm install -g @localstack/lstk - @which awslocal || pip install awscli-local run-interactive: ## Prepare environment and run sample Glue MSK environment (interactive example) ./run.sh -it diff --git a/glue-msk-schema-registry/README.md b/glue-msk-schema-registry/README.md index 01cfbf46..c5771866 100644 --- a/glue-msk-schema-registry/README.md +++ b/glue-msk-schema-registry/README.md @@ -15,7 +15,7 @@ A demo application illustrating schema evolution with AWS Glue Schema Registry a - 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. - [Docker](https://docs.docker.com/get-docker/) - [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) -- [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) +- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` - [Java 11](https://openjdk.org/) and [Maven 3](https://maven.apache.org/) ## Check prerequisites @@ -30,7 +30,7 @@ make check make install ``` -The install target installs LocalStack and `awslocal`. Please also manually install Maven 3 and Java 11. Verify your versions: +The install target installs LocalStack and `lstk aws`. Please also manually install Maven 3 and Java 11. Verify your versions: ```sh $ mvn --version diff --git a/glue-msk-schema-registry/run.sh b/glue-msk-schema-registry/run.sh index 6b584a9c..df61146a 100755 --- a/glue-msk-schema-registry/run.sh +++ b/glue-msk-schema-registry/run.sh @@ -10,11 +10,11 @@ function finish { # Delete the cluster (if available) echo "(Cleanup) Deleting Kafka cluster." if [ -n "$cluster_arn" ]; then - awslocal kafka delete-cluster --cluster-arn "$cluster_arn" 2> /dev/null || true + lstk aws kafka delete-cluster --cluster-arn "$cluster_arn" 2> /dev/null || true fi # Delete the schema registry echo "(Cleanup) Deleting registry." - awslocal glue delete-registry --registry-id RegistryName=unicorn-ride-request-registry 2> /dev/null || true + lstk aws glue delete-registry --registry-id RegistryName=unicorn-ride-request-registry 2> /dev/null || true } trap finish EXIT @@ -39,17 +39,17 @@ else fi step "Start with creating a Kafka cluster..." -vpc_id=$(set -x; awslocal ec2 create-vpc --cidr-block 10.0.0.0/16 | jq -r .Vpc.VpcId) -subnet_1=$(set -x; awslocal ec2 create-subnet --vpc-id "$vpc_id" --cidr-block 10.0.1.0/24 --availability-zone us-east-1a | jq -r .Subnet.SubnetId) -subnet_2=$(set -x; awslocal ec2 create-subnet --vpc-id "$vpc_id" --cidr-block 10.0.2.0/24 --availability-zone us-east-1b | jq -r .Subnet.SubnetId) -cluster_arn=$(set -x;awslocal kafka create-cluster \ +vpc_id=$(set -x; lstk aws ec2 create-vpc --cidr-block 10.0.0.0/16 | jq -r .Vpc.VpcId) +subnet_1=$(set -x; lstk aws ec2 create-subnet --vpc-id "$vpc_id" --cidr-block 10.0.1.0/24 --availability-zone us-east-1a | jq -r .Subnet.SubnetId) +subnet_2=$(set -x; lstk aws ec2 create-subnet --vpc-id "$vpc_id" --cidr-block 10.0.2.0/24 --availability-zone us-east-1b | jq -r .Subnet.SubnetId) +cluster_arn=$(set -x;lstk aws kafka create-cluster \ --cluster-name "unicorn-ride-cluster" \ --kafka-version "3.6.0" \ --number-of-broker-nodes 2 \ --broker-node-group-info "{\"ClientSubnets\": [\"$subnet_1\", \"$subnet_2\"], \"InstanceType\":\"kafka.m5.xlarge\"}" \ --encryption-info "{\"EncryptionInTransit\": {\"ClientBroker\": \"PLAINTEXT\"}}" | jq -r .ClusterArn) -state=$(set -x; awslocal kafka describe-cluster --cluster-arn $cluster_arn | jq -r .ClusterInfo.State) +state=$(set -x; lstk aws kafka describe-cluster --cluster-arn $cluster_arn | jq -r .ClusterInfo.State) for i in {1..35}; do echo "Waiting for Kafka cluster to become ACTIVE (current status: $state)..." @@ -60,21 +60,21 @@ for i in {1..35}; do echo "Cluster creation FAILED, exiting..." exit 1 fi - state=$(awslocal kafka describe-cluster --cluster-arn $cluster_arn | jq -r .ClusterInfo.State) + state=$(lstk aws kafka describe-cluster --cluster-arn $cluster_arn | jq -r .ClusterInfo.State) done if [ "$state" != ACTIVE ]; then echo "Gave up waiting on Cluster, exiting..." exit 1 fi -bootstrap_broker=$(set -x; awslocal kafka get-bootstrap-brokers --cluster-arn $cluster_arn | jq -r .BootstrapBrokerString) +bootstrap_broker=$(set -x; lstk aws kafka get-bootstrap-brokers --cluster-arn $cluster_arn | jq -r .BootstrapBrokerString) echo "Kafka Bootstrap Broker: $bootstrap_broker" step "The Kafka cluster is ready. Let's create a Glue Schema Registry..." -(set -x; awslocal glue create-registry --registry-name unicorn-ride-request-registry) +(set -x; lstk aws glue create-registry --registry-name unicorn-ride-request-registry) step "Create the AVRO schema in the new registry (with compatibility BACKWARD)..." -schema_arn=$(set -x; awslocal glue create-schema \ +schema_arn=$(set -x; lstk aws glue create-schema \ --registry-id RegistryName="unicorn-ride-request-registry" \ --schema-name unicorn-ride-request-schema-avro \ --compatibility BACKWARD \ @@ -82,11 +82,11 @@ schema_arn=$(set -x; awslocal glue create-schema \ --schema-definition "file://producer/src/main/resources/avro/unicorn_ride_request_v1.avsc" | jq -r .SchemaArn) step "Check if the schema has been created successfully..." -(set -x; awslocal glue get-schema \ +(set -x; lstk aws glue get-schema \ --schema-id SchemaArn=$schema_arn) step "Check if the schema version has been created correctly..." -(set -x; awslocal glue get-schema-version \ +(set -x; lstk aws glue get-schema-version \ --schema-id SchemaArn=$schema_arn \ --schema-version-number LatestVersion=True) @@ -103,7 +103,7 @@ step "Run a new producer (automatically registers a new schema which removes a r (set -x; mvn -pl producer-2 exec:java -Dexec.args="--bootstrap-servers $bootstrap_broker") step "Get a diff between the initial version and the version registered by the new producer..." -(set -x; awslocal glue get-schema-versions-diff \ +(set -x; lstk aws glue get-schema-versions-diff \ --schema-id SchemaArn=$schema_arn \ --schema-diff-type SYNTAX_DIFF \ --first-schema-version-number VersionNumber=1 \ @@ -113,7 +113,7 @@ step "Expected failure: Execute a producer which tries to register an incompatib (set -x; mvn -pl producer-3 exec:java -Dexec.args="--bootstrap-servers $bootstrap_broker") || true step "Check that the newly registered schema is in state 'FAILED'..." -awslocal glue get-schema-version \ +lstk aws glue get-schema-version \ --schema-id SchemaArn=$schema_arn \ --schema-version-number VersionNumber=3 diff --git a/glue-redshift-crawler/Makefile b/glue-redshift-crawler/Makefile index 90e0b65b..93e4e2b8 100644 --- a/glue-redshift-crawler/Makefile +++ b/glue-redshift-crawler/Makefile @@ -8,13 +8,12 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } - @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } + @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies @which lstk > /dev/null || npm install -g @localstack/lstk - @which awslocal || pip install awscli-local run: ## Prepare environment and run sample ./run.sh diff --git a/glue-redshift-crawler/README.md b/glue-redshift-crawler/README.md index 8cf2468c..8739beff 100644 --- a/glue-redshift-crawler/README.md +++ b/glue-redshift-crawler/README.md @@ -15,7 +15,7 @@ A demo application illustrating how to use AWS Glue Crawler to populate the Glue - 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. - [Docker](https://docs.docker.com/get-docker/) - [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) -- [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) +- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` ## Check prerequisites diff --git a/glue-redshift-crawler/run.sh b/glue-redshift-crawler/run.sh index 57d777ed..96f9d122 100755 --- a/glue-redshift-crawler/run.sh +++ b/glue-redshift-crawler/run.sh @@ -19,13 +19,13 @@ TIMEOUT_SECONDS=$((TIMEOUT_MINUTES * 60)) function cleanup() { echo "" echo "(Cleanup) Deleting Redshift cluster." - awslocal redshift delete-cluster --cluster-identifier $REDSHIFT_CLUSTER_IDENTIFIER 2> /dev/null || true + lstk aws redshift delete-cluster --cluster-identifier $REDSHIFT_CLUSTER_IDENTIFIER 2> /dev/null || true echo "(Cleanup) Deleting Glue database." - awslocal glue delete-database --name $GLUE_DATABASE_NAME 2> /dev/null || true + lstk aws glue delete-database --name $GLUE_DATABASE_NAME 2> /dev/null || true echo "(Cleanup) Deleting Glue connection." - awslocal glue delete-connection --connection-name $GLUE_CONNECTION_NAME 2> /dev/null || true + lstk aws glue delete-connection --connection-name $GLUE_CONNECTION_NAME 2> /dev/null || true echo "(Cleanup) Deleting Glue crawler." - awslocal glue delete-crawler --name $GLUE_CRAWLER_NAME 2> /dev/null || true + lstk aws glue delete-crawler --name $GLUE_CRAWLER_NAME 2> /dev/null || true } trap cleanup EXIT @@ -56,28 +56,28 @@ cleanup # Create the redshift cluster echo "Creating Redshift cluster..." -awslocal redshift create-cluster --cluster-identifier $REDSHIFT_CLUSTER_IDENTIFIER --db-name $REDSHIFT_DATABASE_NAME --master-username $REDSHIFT_USERNAME --master-user-password $REDSHIFT_PASSWORD --node-type n1 -wait "awslocal redshift describe-clusters --cluster-identifier $REDSHIFT_CLUSTER_IDENTIFIER" ".Clusters[0].ClusterStatus" "available" -REDSHIFT_URL=$(awslocal redshift describe-clusters --cluster-identifier $REDSHIFT_CLUSTER_IDENTIFIER | jq -r '(.Clusters[0].Endpoint.Address) + ":" + (.Clusters[0].Endpoint.Port|tostring)') +lstk aws redshift create-cluster --cluster-identifier $REDSHIFT_CLUSTER_IDENTIFIER --db-name $REDSHIFT_DATABASE_NAME --master-username $REDSHIFT_USERNAME --master-user-password $REDSHIFT_PASSWORD --node-type n1 +wait "lstk aws redshift describe-clusters --cluster-identifier $REDSHIFT_CLUSTER_IDENTIFIER" ".Clusters[0].ClusterStatus" "available" +REDSHIFT_URL=$(lstk aws redshift describe-clusters --cluster-identifier $REDSHIFT_CLUSTER_IDENTIFIER | jq -r '(.Clusters[0].Endpoint.Address) + ":" + (.Clusters[0].Endpoint.Port|tostring)') # Create the Glue database, connection, and crawler echo "Creating Glue db, connection, and crawler..." -awslocal glue create-database --database-input "{\"Name\": \"$GLUE_DATABASE_NAME\"}" -awslocal glue create-connection --connection-input "{\"Name\":\"$GLUE_CONNECTION_NAME\", \"ConnectionType\": \"JDBC\", \"ConnectionProperties\": {\"USERNAME\": \"$REDSHIFT_USERNAME\", \"PASSWORD\": \"$REDSHIFT_PASSWORD\", \"JDBC_CONNECTION_URL\": \"jdbc:redshift://$REDSHIFT_URL/$REDSHIFT_DATABASE_NAME\"}}" -awslocal glue create-crawler --name $GLUE_CRAWLER_NAME --database-name $GLUE_DATABASE_NAME --targets "{\"JdbcTargets\": [{\"ConnectionName\": \"$GLUE_CONNECTION_NAME\", \"Path\": \"$REDSHIFT_DATABASE_NAME/%/$REDSHIFT_TABLE_NAME\"}]}" --role r1 +lstk aws glue create-database --database-input "{\"Name\": \"$GLUE_DATABASE_NAME\"}" +lstk aws glue create-connection --connection-input "{\"Name\":\"$GLUE_CONNECTION_NAME\", \"ConnectionType\": \"JDBC\", \"ConnectionProperties\": {\"USERNAME\": \"$REDSHIFT_USERNAME\", \"PASSWORD\": \"$REDSHIFT_PASSWORD\", \"JDBC_CONNECTION_URL\": \"jdbc:redshift://$REDSHIFT_URL/$REDSHIFT_DATABASE_NAME\"}}" +lstk aws glue create-crawler --name $GLUE_CRAWLER_NAME --database-name $GLUE_DATABASE_NAME --targets "{\"JdbcTargets\": [{\"ConnectionName\": \"$GLUE_CONNECTION_NAME\", \"Path\": \"$REDSHIFT_DATABASE_NAME/%/$REDSHIFT_TABLE_NAME\"}]}" --role r1 # Create a table in the redshift DB echo "Creating table in Redshift DB..." -REDSHIFT_STATEMENT_ID=$(awslocal redshift-data execute-statement --cluster-identifier $REDSHIFT_CLUSTER_IDENTIFIER --database $REDSHIFT_DATABASE_NAME --sql \ +REDSHIFT_STATEMENT_ID=$(lstk aws redshift-data execute-statement --cluster-identifier $REDSHIFT_CLUSTER_IDENTIFIER --database $REDSHIFT_DATABASE_NAME --sql \ "create table $REDSHIFT_TABLE_NAME(salesid integer not null, listid integer not null, sellerid integer not null, buyerid integer not null, eventid integer not null, dateid smallint not null, qtysold smallint not null, pricepaid decimal(8,2), commission decimal(8,2), saletime timestamp)" | jq -r .Id) -wait "awslocal redshift-data describe-statement --id $REDSHIFT_STATEMENT_ID" ".Status" "FINISHED" +wait "lstk aws redshift-data describe-statement --id $REDSHIFT_STATEMENT_ID" ".Status" "FINISHED" # Run the crawler echo "Starting Crawler..." -awslocal glue start-crawler --name $GLUE_CRAWLER_NAME -wait "awslocal glue get-crawler --name $GLUE_CRAWLER_NAME" ".Crawler.State" "READY" +lstk aws glue start-crawler --name $GLUE_CRAWLER_NAME +wait "lstk aws glue get-crawler --name $GLUE_CRAWLER_NAME" ".Crawler.State" "READY" echo "Getting Glue table..." -awslocal glue get-table --database-name $GLUE_DATABASE_NAME --name "${REDSHIFT_DATABASE_NAME}_${REDSHIFT_SCHEMA_NAME}_${REDSHIFT_TABLE_NAME}" +lstk aws glue get-table --database-name $GLUE_DATABASE_NAME --name "${REDSHIFT_DATABASE_NAME}_${REDSHIFT_SCHEMA_NAME}_${REDSHIFT_TABLE_NAME}" echo "Done." diff --git a/iam-policy-enforcement/Makefile b/iam-policy-enforcement/Makefile index da8321e7..aebc0c51 100644 --- a/iam-policy-enforcement/Makefile +++ b/iam-policy-enforcement/Makefile @@ -9,13 +9,12 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } - @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } + @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies @which lstk > /dev/null || npm install -g @localstack/lstk - @which awslocal || pip install awscli-local run: ## Run the IAM tests locally @echo "Running IAM enforcement tests in local environment" diff --git a/iam-policy-enforcement/README.md b/iam-policy-enforcement/README.md index 5d5040cb..2360c7e8 100644 --- a/iam-policy-enforcement/README.md +++ b/iam-policy-enforcement/README.md @@ -17,7 +17,7 @@ A demo application illustrating enforcement of IAM policies when working with lo - 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. - [Docker](https://docs.docker.com/get-docker/) - [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) -- [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) +- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` ## Check prerequisites diff --git a/iam-policy-enforcement/run.sh b/iam-policy-enforcement/run.sh index 52db7641..1331d017 100755 --- a/iam-policy-enforcement/run.sh +++ b/iam-policy-enforcement/run.sh @@ -2,18 +2,18 @@ set -e echo "Step 1: Trying to create Kinesis stream - should get DENIED ..." -awslocal kinesis create-stream --stream-name s1 --shard-count 1 +lstk aws kinesis create-stream --stream-name s1 --shard-count 1 echo "Step 2: Trying to create S3 bucket - should get DENIED ..." -awslocal s3 mb s3://test-iam-bucket -list_result=$(awslocal s3api list-buckets | jq -r .Buckets) +lstk aws s3 mb s3://test-iam-bucket +list_result=$(lstk aws s3api list-buckets | jq -r .Buckets) ../assert "$list_result" = [] echo "Step 3: Creating user with IAM policy to allow Kinesis access ..." -pol_arn=$(awslocal iam create-policy --policy-name p1 --policy-document '{"Version":"2012-10-17","Statement":[{"Sid":"pol123","Effect":"Allow","Action":["kinesis:*","s3:*"],"Resource":"*"}]}' | jq -r '.Policy.Arn') -awslocal iam create-user --user-name user1 | grep UserName -test $pol_arn && awslocal iam attach-user-policy --user-name user1 --policy-arn $pol_arn -keys=$(awslocal iam create-access-key --user-name user1 | jq '.AccessKey') +pol_arn=$(lstk aws iam create-policy --policy-name p1 --policy-document '{"Version":"2012-10-17","Statement":[{"Sid":"pol123","Effect":"Allow","Action":["kinesis:*","s3:*"],"Resource":"*"}]}' | jq -r '.Policy.Arn') +lstk aws iam create-user --user-name user1 | grep UserName +test $pol_arn && lstk aws iam attach-user-policy --user-name user1 --policy-arn $pol_arn +keys=$(lstk aws iam create-access-key --user-name user1 | jq '.AccessKey') accessKey=$(echo $keys | jq -r '.AccessKeyId') secretKey=$(echo $keys | jq -r '.SecretAccessKey') @@ -26,8 +26,8 @@ export AWS_ACCESS_KEY_ID=$accessKey export AWS_SECRET_ACCESS_KEY=$secretKey echo "Step 4: Trying to create Kinesis stream using IAM credentials - should get ALLOWED ..." -awslocal kinesis create-stream --stream-name s1 --shard-count 1 -awslocal kinesis describe-stream --stream-name s1 | grep StreamStatus +lstk aws kinesis create-stream --stream-name s1 --shard-count 1 +lstk aws kinesis describe-stream --stream-name s1 | grep StreamStatus echo "Step 5: Trying to create S3 bucket using IAM credentials - should get ALLOWED ..." -awslocal s3 mb s3://test-iam-bucket +lstk aws s3 mb s3://test-iam-bucket diff --git a/iot-basics/Makefile b/iot-basics/Makefile index e0d5b277..c304b4d3 100644 --- a/iot-basics/Makefile +++ b/iot-basics/Makefile @@ -9,13 +9,12 @@ check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v python3 > /dev/null 2>&1 || { echo "Python 3 is not installed. Please install Python 3 and try again."; exit 1; } @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } - @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } + @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies @which lstk > /dev/null || npm install -g @localstack/lstk - @which awslocal || pip install awscli-local @test -e .venv || (virtualenv .venv; . .venv/bin/activate; pip install -r requirements.txt) test-mqtt: @@ -24,13 +23,13 @@ test-mqtt: run: ## Deploy the app locally echo "Deploying app to local environment"; \ - awslocal cloudformation create-stack --stack-name test-iot --template-body file://iot.cf.yml; \ + lstk aws cloudformation create-stack --stack-name test-iot --template-body file://iot.cf.yml; \ echo "IoT stack successfully deployed. Now checking whether all resources have been created."; \ sleep 3; \ - awslocal iot list-things; \ - awslocal iot list-policies; \ - awslocal iot create-job --job-id j1 --targets t1; \ - awslocal iot list-jobs; \ + lstk aws iot list-things; \ + lstk aws iot list-policies; \ + lstk aws iot create-job --job-id j1 --targets t1; \ + lstk aws iot list-jobs; \ make test-mqtt start: diff --git a/iot-basics/README.md b/iot-basics/README.md index 9df6a6d2..b716dd52 100644 --- a/iot-basics/README.md +++ b/iot-basics/README.md @@ -15,7 +15,7 @@ A demo application illustrating basic IoT API usage with LocalStack. The sample - 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. - [Docker](https://docs.docker.com/get-docker/) - [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) -- [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) +- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` ## Check prerequisites diff --git a/java-notification-app/Makefile b/java-notification-app/Makefile index e323f910..9047150b 100644 --- a/java-notification-app/Makefile +++ b/java-notification-app/Makefile @@ -9,7 +9,7 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v mvn > /dev/null 2>&1 || { echo "Maven is not installed. Please install Maven and try again."; exit 1; } - @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } + @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @echo "All required prerequisites are available." install: ## Build the Java application @@ -32,15 +32,15 @@ logs: ## Retrieve LocalStack logs @docker compose logs localstack > logs.txt deploy: ## Deploy CloudFormation stack for notification infrastructure - @awslocal cloudformation deploy \ + @lstk aws cloudformation deploy \ --template-file src/main/resources/email-infra.yml \ --stack-name email-infra run: ## Start the Spring Boot application and run a test notification - @awslocal ses verify-email-identity --email-address no-reply@localstack.cloud + @lstk aws ses verify-email-identity --email-address no-reply@localstack.cloud AWS_ACCESS_KEY_ID=test AWS_SECRET_ACCESS_KEY=test mvn spring-boot:run & @sleep 5 - @awslocal sns publish \ + @lstk aws sns publish \ --topic arn:aws:sns:us-east-1:000000000000:email-notifications \ --message '{"subject":"hello", "address": "alice@example.com", "body": "hello world"}' @curl -s localhost:8080/process diff --git a/java-notification-app/README.md b/java-notification-app/README.md index 6412b66e..600b9455 100644 --- a/java-notification-app/README.md +++ b/java-notification-app/README.md @@ -14,7 +14,7 @@ A Spring Boot application demonstrating AWS messaging services with LocalStack. - 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. - [Docker](https://docs.docker.com/get-docker/) and Docker Compose -- [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) +- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` - [Java 11+](https://openjdk.org/) and [Maven 3+](https://maven.apache.org/) ## Check prerequisites @@ -63,13 +63,13 @@ Run everything via `make run` or follow the steps below. Verify the sender email address configured in the app: ```bash -awslocal ses verify-email-identity --email-address no-reply@localstack.cloud +lstk aws ses verify-email-identity --email-address no-reply@localstack.cloud ``` Send a message to the topic: ```bash -awslocal sns publish --topic arn:aws:sns:us-east-1:000000000000:email-notifications --message '{"subject":"hello", "address": "alice@example.com", "body": "hello world"}' +lstk aws sns publish --topic arn:aws:sns:us-east-1:000000000000:email-notifications --message '{"subject":"hello", "address": "alice@example.com", "body": "hello world"}' ``` Run the `/process` endpoint to send the queued notifications as emails: diff --git a/lambda-container-image/Makefile b/lambda-container-image/Makefile index 656d6950..e6e2e5df 100644 --- a/lambda-container-image/Makefile +++ b/lambda-container-image/Makefile @@ -8,28 +8,27 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } - @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } + @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies - @which awslocal || pip install awscli-local run: ## Build, deploy, and invoke the Lambda container image locally echo "Creating a new ECR repository locally"; \ - repoUri=$$(awslocal ecr create-repository --repository-name repo1 | jq -r '.repository.repositoryUri'); \ + repoUri=$$(lstk aws ecr create-repository --repository-name repo1 | jq -r '.repository.repositoryUri'); \ echo "Building the Docker image, pushing it to ECR URL: $$repoUri"; \ docker build -t "$$repoUri" .; \ docker push "$$repoUri"; \ docker rmi "$$repoUri"; \ echo "Deploying Lambda function from container image locally"; \ - awslocal lambda create-function --function-name ls-lambda-image --package-type Image \ + lstk aws lambda create-function --function-name ls-lambda-image --package-type Image \ --code ImageUri=$$repoUri --role arn:aws:iam::000000000000:role/lambda-r1 \ --handler handler.handler; \ echo "Waiting until Lambda function becomes active"; \ - awslocal lambda wait function-active-v2 --function-name ls-lambda-image; \ + lstk aws lambda wait function-active-v2 --function-name ls-lambda-image; \ echo "Invoking Lambda function from container image"; \ - awslocal lambda invoke --function-name ls-lambda-image --payload '{"test":"test"}' /tmp/lambda.out && \ + lstk aws lambda invoke --function-name ls-lambda-image --payload '{"test":"test"}' /tmp/lambda.out && \ echo "Done - test successfully finished." start: diff --git a/lambda-container-image/README.md b/lambda-container-image/README.md index 1e7c86ef..9c186e1d 100644 --- a/lambda-container-image/README.md +++ b/lambda-container-image/README.md @@ -15,7 +15,7 @@ A demo application illustrating Lambda container images with LocalStack. The Lam - 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. - [Docker](https://docs.docker.com/get-docker/) - [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) -- [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) +- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` ## Check prerequisites @@ -89,10 +89,10 @@ Hello from LocalStack Lambda container image! An error occurred (UnsupportedMediaTypeException) when calling the Invoke operation (reached max retries: 0): The payload is not JSON: b'\xb5\xeb-\xb5\xeb-' ``` -**Solution**: Downgrade your `awslocal` CLI to version 1, or update the Lambda invocation to use `--cli-binary-format raw-in-base64-out`: +**Solution**: Downgrade your `lstk aws` CLI to version 1, or update the Lambda invocation to use `--cli-binary-format raw-in-base64-out`: ```bash -awslocal lambda invoke --cli-binary-format raw-in-base64-out \ +lstk aws lambda invoke --cli-binary-format raw-in-base64-out \ --function-name ls-lambda-image \ --payload '{"test": "test"}' /tmp/lambda.out \ --log-type Tail --query 'LogResult' --output text | base64 -d diff --git a/lambda-debugging-sam-java/Makefile b/lambda-debugging-sam-java/Makefile index c82b4355..29652c16 100644 --- a/lambda-debugging-sam-java/Makefile +++ b/lambda-debugging-sam-java/Makefile @@ -27,7 +27,7 @@ check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v java > /dev/null 2>&1 || { echo "Java is not installed. Please install Java and try again."; exit 1; } @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } - @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } + @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @echo "All required prerequisites are available." diff --git a/lambda-debugging-sam-javascript/Makefile b/lambda-debugging-sam-javascript/Makefile index fd151900..a8f36e48 100644 --- a/lambda-debugging-sam-javascript/Makefile +++ b/lambda-debugging-sam-javascript/Makefile @@ -27,7 +27,7 @@ check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v node > /dev/null 2>&1 || { echo "Node.js is not installed. Please install Node.js and try again."; exit 1; } @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } - @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } + @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @echo "All required prerequisites are available." diff --git a/lambda-debugging-sam-python/Makefile b/lambda-debugging-sam-python/Makefile index a38e7a5b..31add823 100644 --- a/lambda-debugging-sam-python/Makefile +++ b/lambda-debugging-sam-python/Makefile @@ -27,7 +27,7 @@ check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v python3 > /dev/null 2>&1 || { echo "Python 3 is not installed. Please install Python 3 and try again."; exit 1; } @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } - @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } + @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @echo "All required prerequisites are available." diff --git a/lambda-debugging-sam-typescript/Makefile b/lambda-debugging-sam-typescript/Makefile index 501264c8..e0d3e7b4 100644 --- a/lambda-debugging-sam-typescript/Makefile +++ b/lambda-debugging-sam-typescript/Makefile @@ -27,7 +27,7 @@ check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v node > /dev/null 2>&1 || { echo "Node.js is not installed. Please install Node.js and try again."; exit 1; } @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } - @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } + @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @echo "All required prerequisites are available." diff --git a/lambda-event-filtering/Makefile b/lambda-event-filtering/Makefile index ae4f54b0..2e55e44f 100644 --- a/lambda-event-filtering/Makefile +++ b/lambda-event-filtering/Makefile @@ -11,7 +11,7 @@ check: ## Check if all required prerequisites are installed @command -v node > /dev/null 2>&1 || { echo "Node.js is not installed. Please install Node.js and try again."; exit 1; } @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } @command -v samlocal > /dev/null 2>&1 || { echo "samlocal is not installed. Please run: pip install aws-sam-cli-local"; exit 1; } - @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } + @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies @@ -38,7 +38,7 @@ deploy: ## Deploy the SAM application to LocalStack @samlocal deploy --no-confirm-changeset --resolve-s3 --stack-name lambda-event-filtering run: ## Send a test SQS message to trigger the Lambda function - @awslocal sqs send-message \ + @lstk aws sqs send-message \ --queue-url http://localhost:4566/000000000000/MyQueue \ --message-body '{"data": "A"}' \ --delay-seconds 10 diff --git a/lambda-event-filtering/README.md b/lambda-event-filtering/README.md index 7deba61a..51d88202 100644 --- a/lambda-event-filtering/README.md +++ b/lambda-event-filtering/README.md @@ -15,7 +15,7 @@ A demo application illustrating AWS Lambda event source filtering with DynamoDB - 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. - [Docker](https://docs.docker.com/get-docker/) - [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) -- [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) +- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` - [`samlocal`](https://github.com/localstack/aws-sam-cli-local) — install with `pip install aws-sam-cli-local` - [Node.js](https://nodejs.org/en/download/) with `npm` and [`ulid`](https://www.npmjs.com/package/ulid) (`npm install --save ulid`) @@ -57,7 +57,7 @@ samlocal deploy After deploying, send an SQS message to trigger the Lambda via the filter criteria: ```bash -awslocal sqs send-message \ +lstk aws sqs send-message \ --queue-url http://localhost:4566/000000000000/MyQueue \ --message-body '{"data": "A"}' \ --delay-seconds 10 diff --git a/lambda-function-urls-javascript/Makefile b/lambda-function-urls-javascript/Makefile index 766dc75e..bd863335 100644 --- a/lambda-function-urls-javascript/Makefile +++ b/lambda-function-urls-javascript/Makefile @@ -10,24 +10,23 @@ check: ## Check if all required prerequisites are installed @command -v node > /dev/null 2>&1 || { echo "Node.js is not installed. Please install Node.js and try again."; exit 1; } @command -v terraform > /dev/null 2>&1 || { echo "Terraform is not installed. Please install Terraform and try again."; exit 1; } @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } - @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } + @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies - @which awslocal || pip install awscli-local run: ## Build, deploy, and invoke the Lambda function URL npm i -g zip zip function.zip index.js - awslocal lambda create-function \ + lstk aws lambda create-function \ --function-name localstack-lamba-url-example \ --runtime nodejs20.x \ --zip-file fileb://function.zip \ --handler index.handler \ --role arn:aws:iam::000000000000:role/cool-stacklifter - awslocal lambda create-function-url-config \ + lstk aws lambda create-function-url-config \ --function-name localstack-lamba-url-example \ --auth-type NONE diff --git a/lambda-function-urls-javascript/README.md b/lambda-function-urls-javascript/README.md index fe5cb938..99ffd59a 100644 --- a/lambda-function-urls-javascript/README.md +++ b/lambda-function-urls-javascript/README.md @@ -15,7 +15,7 @@ A demo application illustrating how to create a JavaScript Lambda function with - 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. - [Docker](https://docs.docker.com/get-docker/) - [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) -- [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) +- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` - [Terraform](https://developer.hashicorp.com/terraform/downloads) (optional, for Terraform-based deployment) ## Check prerequisites @@ -42,14 +42,14 @@ make start Deploy the Lambda function and create a function URL: ```bash -awslocal lambda create-function \ +lstk aws lambda create-function \ --function-name localstack-lamba-url-example \ --runtime nodejs20.x \ --zip-file fileb://function.zip \ --handler index.handler \ --role arn:aws:iam::000000000000:role/cool-stacklifter -awslocal lambda create-function-url-config \ +lstk aws lambda create-function-url-config \ --function-name localstack-lamba-url-example \ --auth-type NONE ``` diff --git a/lambda-function-urls-python/Makefile b/lambda-function-urls-python/Makefile index e72a5bf2..10ecf651 100644 --- a/lambda-function-urls-python/Makefile +++ b/lambda-function-urls-python/Makefile @@ -10,18 +10,17 @@ check: ## Check if all required prerequisites are installed @command -v python3 > /dev/null 2>&1 || { echo "Python 3 is not installed. Please install Python 3 and try again."; exit 1; } @command -v terraform > /dev/null 2>&1 || { echo "Terraform is not installed. Please install Terraform and try again."; exit 1; } @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } - @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } + @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies - @which awslocal || pip install awscli-local run: ## Build, deploy, and invoke the Lambda function URL npm i -g zip pip3 install -r requirements.txt -t . zip -r function.zip . - awslocal lambda create-function \ + lstk aws lambda create-function \ --function-name trending \ --runtime python3.9 \ --timeout 10 \ @@ -29,7 +28,7 @@ run: ## Build, deploy, and invoke the Lambda function URL --handler lambda_function.lambda_handler \ --role arn:aws:iam::000000000000:role/cool-stacklifter - awslocal lambda create-function-url-config \ + lstk aws lambda create-function-url-config \ --function-name trending \ --auth-type NONE diff --git a/lambda-function-urls-python/README.md b/lambda-function-urls-python/README.md index 968ab823..d07c9603 100644 --- a/lambda-function-urls-python/README.md +++ b/lambda-function-urls-python/README.md @@ -15,7 +15,7 @@ A demo application illustrating how to create a Python Lambda function with a fu - 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. - [Docker](https://docs.docker.com/get-docker/) - [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) -- [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) +- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` - [Python 3](https://www.python.org/downloads/) ## Check prerequisites diff --git a/lambda-hot-reloading/Makefile b/lambda-hot-reloading/Makefile index 554fa1bb..5ff2e593 100644 --- a/lambda-hot-reloading/Makefile +++ b/lambda-hot-reloading/Makefile @@ -9,7 +9,7 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } - @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } + @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies for the JavaScript sample @@ -31,10 +31,10 @@ logs: ## Retrieve LocalStack logs deploy: ## Deploy the JavaScript Lambda with hot reloading enabled @cd javascript && \ - awslocal iam create-role \ + lstk aws iam create-role \ --role-name lambda-role \ --assume-role-policy-document file://trust-policy.json 2>/dev/null || true && \ - awslocal lambda create-function \ + lstk aws lambda create-function \ --function-name hot-reload-js \ --runtime nodejs18.x \ --role arn:aws:iam::000000000000:role/lambda-role \ @@ -42,10 +42,10 @@ deploy: ## Deploy the JavaScript Lambda with hot reloading enabled --handler index.handler wait: ## Wait until the Lambda function can be invoked - @awslocal lambda wait function-active-v2 --function-name hot-reload-js + @lstk aws lambda wait function-active-v2 --function-name hot-reload-js run: ## Invoke the hot-reload Lambda function - @awslocal lambda invoke \ + @lstk aws lambda invoke \ --function-name hot-reload-js \ --payload '{}' \ output.json && cat output.json diff --git a/lambda-hot-reloading/README.md b/lambda-hot-reloading/README.md index 5536df88..b1fb4bde 100644 --- a/lambda-hot-reloading/README.md +++ b/lambda-hot-reloading/README.md @@ -25,7 +25,7 @@ A collection of samples demonstrating LocalStack's Lambda hot reloading capabili - 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. - [Docker](https://docs.docker.com/get-docker/) - [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) -- [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) +- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` - [Node.js](https://nodejs.org/en/download/) with `npm` ## Check prerequisites diff --git a/lambda-hot-reloading/javascript-terraform-layers/README.md b/lambda-hot-reloading/javascript-terraform-layers/README.md index d5f0082d..409e79b9 100644 --- a/lambda-hot-reloading/javascript-terraform-layers/README.md +++ b/lambda-hot-reloading/javascript-terraform-layers/README.md @@ -4,9 +4,9 @@ * LocalStack Pro * Docker -* [awslocal](https://github.com/localstack/awscli-local) CLI +* [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` * Terraform -* [tflocal](https://github.com/localstack/terraform-local) CLI +* [Terraform](https://developer.hashicorp.com/terraform/install), used through `lstk tf` ## Introduction to the sample In this sample, we demonstrate a hot reloading setup where both the function code and the layer code are hot reloaded. @@ -43,17 +43,17 @@ services: ## Deploying -Now we can deploy our terraform stack by using `tflocal`. +Now we can deploy our terraform stack by using `lstk tf`. First, we initialize the terraform working directory using: ```bash -tflocal init +lstk tf init ``` Afterwards, we can deploy our stack on LocalStack: ```bash -tflocal apply +lstk tf apply ``` The terraform configuration will automatically deploy the lambda with hot reloading for the function code. @@ -64,7 +64,7 @@ The function code consists of the contents of the `lambda_src` subdirectory and We can quickly make sure that our deployed function works by invoking it with a simple payload: ```bash -awslocal lambda invoke --function-name hotreloadlambda output.txt +lstk aws lambda invoke --function-name hotreloadlambda output.txt ``` The invocation response: diff --git a/lambda-hot-reloading/javascript-terraform/README.md b/lambda-hot-reloading/javascript-terraform/README.md index 06330d0d..fcdd7108 100644 --- a/lambda-hot-reloading/javascript-terraform/README.md +++ b/lambda-hot-reloading/javascript-terraform/README.md @@ -4,9 +4,9 @@ * LocalStack * Docker -* [awslocal](https://github.com/localstack/awscli-local) CLI +* [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` * Terraform -* [tflocal](https://github.com/localstack/terraform-local) CLI +* [Terraform](https://developer.hashicorp.com/terraform/install), used through `lstk tf` ## Introduction to the sample Other than the deployment of the sample, it is practically identical to [our javascript hot reloading sample](../javascript/). @@ -43,23 +43,23 @@ services: ## Deploying -Now we can deploy our terraform stack by using `tflocal`. +Now we can deploy our terraform stack by using `lstk tf`. First, we initialize the terraform working directory using: ```bash -tflocal init +lstk tf init ``` We can now check the plan of terraform for our deployment: ```bash -tflocal plan +lstk tf plan ``` Afterwards, we can deploy our stack on LocalStack: ```bash -tflocal apply +lstk tf apply ``` The terraform configuration will automatically deploy the lambda with hot reloading for the function code. @@ -70,7 +70,7 @@ The function code will be the contents of the `lambda_src` subdirectory. We can quickly make sure that it works by invoking it with a simple payload: ```bash -awslocal lambda invoke --function-name hotreloadlambda output.txt +lstk aws lambda invoke --function-name hotreloadlambda output.txt ``` The invocation itself returns: diff --git a/lambda-hot-reloading/javascript/README.md b/lambda-hot-reloading/javascript/README.md index 295efb37..2ddbef63 100644 --- a/lambda-hot-reloading/javascript/README.md +++ b/lambda-hot-reloading/javascript/README.md @@ -4,7 +4,7 @@ * LocalStack * Docker -* `awslocal` CLI +* [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` ## Starting up @@ -30,7 +30,7 @@ services: Now we need to create an IAM role, which is a collection of policies that grant specific permissions to access AWS resources on our mocked infrastructure. Before we create the role, we must define a trust policy for it. The trust policy has been defined in `trust-policy.json`. To create an IAM role, open your terminal in the directory where you want to create the role and run the following command: ```bash -awslocal iam create-role --role-name lambda-example --assume-role-policy-document ./trust-policy.json +lstk aws iam create-role --role-name lambda-example --assume-role-policy-document ./trust-policy.json ``` To create the Lambda function, you now need to take care of only two things: @@ -41,7 +41,7 @@ To create the Lambda function, you now need to take care of only two things: Push the following command to create the Lambda function: ```bash -awslocal lambda create-function --function-name myfirstlambda \ +lstk aws lambda create-function --function-name myfirstlambda \ --code S3Bucket="hot-reload",S3Key="/path/to/local/lambda/code" \ --handler index.handler \ --runtime nodejs14.x \ @@ -51,7 +51,7 @@ awslocal lambda create-function --function-name myfirstlambda \ We can quickly make sure that it works by invoking it with a simple payload: ```bash -awslocal lambda invoke --function-name myfirstlambda output.txt +lstk aws lambda invoke --function-name myfirstlambda output.txt ``` The invocation itself returns: diff --git a/lambda-hot-reloading/lambda-typescript-webpack/README.md b/lambda-hot-reloading/lambda-typescript-webpack/README.md index 4151a8fb..216727ec 100644 --- a/lambda-hot-reloading/lambda-typescript-webpack/README.md +++ b/lambda-hot-reloading/lambda-typescript-webpack/README.md @@ -8,7 +8,7 @@ This is a simple example of how to hot reload your Typescript Lambda with Webpac * [Docker](https://docs.docker.com/get-docker/) * [Node.js](https://nodejs.org/en/download/) * [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html) -* [`awslocal`](https://github.com/localstack/awscli-local) + * [yarn](https://classic.yarnpkg.com/en/docs/install) * `jq` @@ -70,7 +70,7 @@ webpack 5.75.0 compiled successfully in 455 ms Deploy the Lambda with the following command: ```bash -awslocal lambda create-function \ +lstk aws lambda create-function \ --function-name localstack-example \ --runtime nodejs18.x \ --role arn:aws:iam::000000000000:role/lambda-ex \ @@ -81,7 +81,7 @@ awslocal lambda create-function \ Additionally, you can create a Lambda Function URL with the following command: ```bash -function_url=$(awslocal lambda create-function-url-config --function-name localstack-example --auth-type NONE | jq -r '.FunctionUrl') +function_url=$(lstk aws lambda create-function-url-config --function-name localstack-example --auth-type NONE | jq -r '.FunctionUrl') ``` ## Test the Lambda @@ -140,7 +140,7 @@ You can perform further changes to the `api.ts` file and test the Lambda in real The Lambda Hot Reloading feature in LocalStack allows you to hot reload your Lambda code in real-time. In this sample, this is achieved using the following: - The `build` script in the `package.json` file uses Nodemon to watch for changes in the `src` directory and rebuild the Lambda. This is enabled using the [`nodemon-webpack-plugin`](https://www.npmjs.com/package/nodemon-webpack-plugin) plugin, which has been pre-configured in the `webpack.config.js` file. -- The `S3Bucket` and `S3Key` parameters in the `awslocal lambda create-function` command are used to deploy the Lambda code from the `dist` directory. This is done by specifying the `dist` directory as the `S3Key` parameter. Everytime the Lambda is updated, Nodemon triggers another build and the `dist` directory is updated with the latest code changes. LocalStack then automatically updates the Lambda code with the latest changes from the `dist` directory. +- The `S3Bucket` and `S3Key` parameters in the `lstk aws lambda create-function` command are used to deploy the Lambda code from the `dist` directory. This is done by specifying the `dist` directory as the `S3Key` parameter. Everytime the Lambda is updated, Nodemon triggers another build and the `dist` directory is updated with the latest code changes. LocalStack then automatically updates the Lambda code with the latest changes from the `dist` directory. ## Notes diff --git a/lambda-hot-reloading/lambda-typescript-webpack/run.sh b/lambda-hot-reloading/lambda-typescript-webpack/run.sh index 9b885c2e..c8829c5c 100644 --- a/lambda-hot-reloading/lambda-typescript-webpack/run.sh +++ b/lambda-hot-reloading/lambda-typescript-webpack/run.sh @@ -1,13 +1,13 @@ #!/bin/bash -awslocal lambda create-function \ +lstk aws lambda create-function \ --function-name localstack-example \ --runtime nodejs18.x \ --role arn:aws:iam::000000000000:role/lambda-ex \ --code S3Bucket="hot-reload",S3Key="$(PWD)/dist" \ --handler api.default -function_url=$(awslocal lambda create-function-url-config --function-name localstack-example --auth-type NONE | jq -r '.FunctionUrl') +function_url=$(lstk aws lambda create-function-url-config --function-name localstack-example --auth-type NONE | jq -r '.FunctionUrl') curl -X POST \ -H "Content-Type: application/json" \ diff --git a/lambda-hot-reloading/typescript/README.md b/lambda-hot-reloading/typescript/README.md index 6613b4ac..cb071393 100644 --- a/lambda-hot-reloading/typescript/README.md +++ b/lambda-hot-reloading/typescript/README.md @@ -55,10 +55,10 @@ To create the Lambda function, you need to take care of two things: - Deploy via an S3 Bucket. You need to use the magic variable `hot-reload` as the bucket. - Set the S3 key to the path of the directory your lambda function resides in. The handler is then referenced by the filename of your lambda code and the function in that code that needs to be invoked. -Create the Lambda Function using the `awslocal` CLI: +Create the Lambda Function using the `lstk aws` CLI: ```sh -awslocal lambda create-function \ +lstk aws lambda create-function \ --function-name hello-world \ --runtime "nodejs16.x" \ --role arn:aws:iam::123456789012:role/lambda-ex \ @@ -69,7 +69,7 @@ awslocal lambda create-function \ You can quickly make sure that it works by invoking it with a simple payload: ``` -$ awslocal lambda invoke \ +$ lstk aws lambda invoke \ --function-name hello-world \ --payload '{"action": "test"}' output.txt ``` diff --git a/lambda-php-bref-cdk-app/Makefile b/lambda-php-bref-cdk-app/Makefile index 02c81ef8..5c2004f5 100644 --- a/lambda-php-bref-cdk-app/Makefile +++ b/lambda-php-bref-cdk-app/Makefile @@ -13,7 +13,7 @@ check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v node > /dev/null 2>&1 || { echo "Node.js is not installed. Please install Node.js and try again."; exit 1; } @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } - @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } + @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @echo "All required prerequisites are available." diff --git a/lambda-xray/README.md b/lambda-xray/README.md index e7f9999c..73fb9ada 100644 --- a/lambda-xray/README.md +++ b/lambda-xray/README.md @@ -22,7 +22,7 @@ A collection of samples demonstrating AWS X-Ray distributed tracing for Lambda f - 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. - [Docker](https://docs.docker.com/get-docker/) - [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) -- [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) +- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` - [Python 3](https://www.python.org/downloads/) with `pip` ## Start LocalStack diff --git a/lambda-xray/python-powertools/Makefile b/lambda-xray/python-powertools/Makefile index 803897b5..a97b749a 100644 --- a/lambda-xray/python-powertools/Makefile +++ b/lambda-xray/python-powertools/Makefile @@ -6,7 +6,6 @@ usage: ## Show this help @fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//' install: ## Install dependencies - @which awslocal || pip install awscli-local @which samlocal || pip install aws-sam-cli-local @pip install 'click>=8.2' @@ -26,8 +25,8 @@ watch-trace-summaries: ## Get the latest X-Ray trace summaries (default 10min) get-traces: ## Get the latest X-Ray traces (default 10min) TIME=$$(date +%s); \ - ID=$$(awslocal xray get-trace-summaries --start-time $$(($$TIME-600)) --end-time $$TIME | jq -r '.TraceSummaries[0].Id'); \ - awslocal xray batch-get-traces --trace-ids $$ID + ID=$$(lstk aws xray get-trace-summaries --start-time $$(($$TIME-600)) --end-time $$TIME | jq -r '.TraceSummaries[0].Id'); \ + lstk aws xray batch-get-traces --trace-ids $$ID start: lstk start --non-interactive --type aws diff --git a/lambda-xray/python-powertools/README.md b/lambda-xray/python-powertools/README.md index 7f55c30c..84be6375 100644 --- a/lambda-xray/python-powertools/README.md +++ b/lambda-xray/python-powertools/README.md @@ -8,7 +8,7 @@ and shows how to use the X-Ray API to fetch distributed trace data. - LocalStack - Docker - `make` -- [awslocal](https://github.com/localstack/awscli-local) +- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` - [samlocal](https://github.com/localstack/aws-sam-cli-local) - Python / `pip` diff --git a/lambda-xray/python-xray-sdk/1-create-bucket.sh b/lambda-xray/python-xray-sdk/1-create-bucket.sh index c880a951..d6ccfc26 100755 --- a/lambda-xray/python-xray-sdk/1-create-bucket.sh +++ b/lambda-xray/python-xray-sdk/1-create-bucket.sh @@ -2,4 +2,4 @@ BUCKET_ID=$(dd if=/dev/random bs=8 count=1 2>/dev/null | od -An -tx1 | tr -d ' \t\n') BUCKET_NAME=lambda-artifacts-$BUCKET_ID echo $BUCKET_NAME > bucket-name.txt -awslocal s3 mb s3://$BUCKET_NAME +lstk aws s3 mb s3://$BUCKET_NAME diff --git a/lambda-xray/python-xray-sdk/3-deploy.sh b/lambda-xray/python-xray-sdk/3-deploy.sh index 41b92897..668c1ffa 100755 --- a/lambda-xray/python-xray-sdk/3-deploy.sh +++ b/lambda-xray/python-xray-sdk/3-deploy.sh @@ -1,5 +1,5 @@ #!/bin/bash set -eo pipefail ARTIFACT_BUCKET=$(cat bucket-name.txt) -awslocal cloudformation package --template-file template.yml --s3-bucket $ARTIFACT_BUCKET --output-template-file out.yml -awslocal cloudformation deploy --template-file out.yml --stack-name blank-python --capabilities CAPABILITY_NAMED_IAM +lstk aws cloudformation package --template-file template.yml --s3-bucket $ARTIFACT_BUCKET --output-template-file out.yml +lstk aws cloudformation deploy --template-file out.yml --stack-name blank-python --capabilities CAPABILITY_NAMED_IAM diff --git a/lambda-xray/python-xray-sdk/4-invoke.sh b/lambda-xray/python-xray-sdk/4-invoke.sh index e98fc85f..fbf9d373 100755 --- a/lambda-xray/python-xray-sdk/4-invoke.sh +++ b/lambda-xray/python-xray-sdk/4-invoke.sh @@ -1,6 +1,6 @@ #!/bin/bash set -eo pipefail -FUNCTION=$(awslocal cloudformation describe-stack-resource --stack-name blank-python --logical-resource-id function --query 'StackResourceDetail.PhysicalResourceId' --output text) +FUNCTION=$(lstk aws cloudformation describe-stack-resource --stack-name blank-python --logical-resource-id function --query 'StackResourceDetail.PhysicalResourceId' --output text) ### Usage: ./4-invoke.sh NUM (default: 1) @@ -15,7 +15,7 @@ fi # Loop NUM times for ((i = 1; i <= num; i++)); do - awslocal lambda invoke --function-name $FUNCTION --payload file://event.json out.json + lstk aws lambda invoke --function-name $FUNCTION --payload file://event.json out.json cat out.json echo "" sleep 2 diff --git a/lambda-xray/python-xray-sdk/5-get-traces.sh b/lambda-xray/python-xray-sdk/5-get-traces.sh index a20c48f6..3f549d46 100755 --- a/lambda-xray/python-xray-sdk/5-get-traces.sh +++ b/lambda-xray/python-xray-sdk/5-get-traces.sh @@ -16,8 +16,8 @@ start=$(($EPOCH-600)) end=$(($EPOCH)) # Retrieve trace summaries -awslocal xray get-trace-summaries --start-time=$start --end-time=$end +lstk aws xray get-trace-summaries --start-time=$start --end-time=$end # Retrive full traces -TRACEIDS=$(awslocal xray get-trace-summaries --start-time=$start --end-time=$end --query 'TraceSummaries[*].Id' --output text) -awslocal xray batch-get-traces --trace-ids $TRACEIDS --query 'Traces[*]' +TRACEIDS=$(lstk aws xray get-trace-summaries --start-time=$start --end-time=$end --query 'TraceSummaries[*].Id' --output text) +lstk aws xray batch-get-traces --trace-ids $TRACEIDS --query 'Traces[*]' diff --git a/lambda-xray/python-xray-sdk/README.md b/lambda-xray/python-xray-sdk/README.md index 86b1163a..7a5d6149 100644 --- a/lambda-xray/python-xray-sdk/README.md +++ b/lambda-xray/python-xray-sdk/README.md @@ -11,7 +11,7 @@ and shows how to use the X-Ray API to fetch distributed trace data. - Docker - Python / `pip` - `make` -- [awslocal](https://github.com/localstack/awscli-local) +- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` ## Start LocalStack @@ -129,4 +129,4 @@ The documentation is made available under the [Creative Commons Attribution-Shar The sample code is made available under a [modified MIT license](https://github.com/awsdocs/aws-lambda-developer-guide/blob/main/LICENSE-SAMPLECODE). -- The code was adjusted by replacing `aws` with `awslocal` for use with LocalStack, adding a `Makefile` to automate all steps, updating the Python dependencies, parametrizing the invoke script, adding a get-traces script, demonstrating custom subsegement tracing, and removed the unused tests. +- The code was adjusted by replacing `aws` with `lstk aws` for use with LocalStack, adding a `Makefile` to automate all steps, updating the Python dependencies, parametrizing the invoke script, adding a get-traces script, demonstrating custom subsegement tracing, and removed the unused tests. diff --git a/mq-broker/Makefile b/mq-broker/Makefile index 104ad504..3a1ad06e 100644 --- a/mq-broker/Makefile +++ b/mq-broker/Makefile @@ -8,13 +8,12 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } - @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } + @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies @which lstk > /dev/null || npm install -g @localstack/lstk - @which awslocal > /dev/null || pip install awscli-local run: ## Run test creating a broker and sending a message ./test.sh diff --git a/mq-broker/README.md b/mq-broker/README.md index 619014fd..d564195d 100644 --- a/mq-broker/README.md +++ b/mq-broker/README.md @@ -15,7 +15,7 @@ A demo application illustrating the use of the AWS MQ API with LocalStack. The s - 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. - [Docker](https://docs.docker.com/get-docker/) - [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) -- [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) +- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` ## Check prerequisites diff --git a/mq-broker/test.sh b/mq-broker/test.sh index c2f13abc..f03b24d2 100755 --- a/mq-broker/test.sh +++ b/mq-broker/test.sh @@ -3,18 +3,18 @@ echo "Creating MQ broker in LocalStack ..." UUID=$(echo $RANDOM | md5sum | head -c 20) broker_name="broker_${UUID}" -broker_id=$(awslocal mq create-broker --broker-name $broker_name --deployment-mode SINGLE_INSTANCE --engine-type ACTIVEMQ --engine-version='5.16.5' --host-instance-type 'mq.t2.micro' --auto-minor-version-upgrade --publicly-accessible --users='{"ConsoleAccess": true, "Groups": ["testgroup"],"Password": "QXwV*$iUM9USHnVv&!^7s3c@", "Username": "admin"}' | jq -r '.BrokerId') +broker_id=$(lstk aws mq create-broker --broker-name $broker_name --deployment-mode SINGLE_INSTANCE --engine-type ACTIVEMQ --engine-version='5.16.5' --host-instance-type 'mq.t2.micro' --auto-minor-version-upgrade --publicly-accessible --users='{"ConsoleAccess": true, "Groups": ["testgroup"],"Password": "QXwV*$iUM9USHnVv&!^7s3c@", "Username": "admin"}' | jq -r '.BrokerId') echo "Created MQ broker with id: ${broker_id}" # let broker fully start up sleep 1 echo "Describe broker to get the endpoint" -broker_endpoint=$(awslocal mq describe-broker --broker-id $broker_id | jq -r '.BrokerInstances[0].ConsoleURL') +broker_endpoint=$(lstk aws mq describe-broker --broker-id $broker_id | jq -r '.BrokerInstances[0].ConsoleURL') echo "Broker endpoint on ${broker_endpoint}" echo "Sending message to broker" curl -XPOST -d "body=message" http://admin:admin@${broker_endpoint:7}/api/message\?destination\=queue://orders.input echo $"Cleaning up - deleting broker" -broker_id=$(awslocal mq delete-broker --broker-id $broker_id | jq -r '.BrokerId') +broker_id=$(lstk aws mq delete-broker --broker-id $broker_id | jq -r '.BrokerId') echo "Deleted Broker ${broker_id}" \ No newline at end of file diff --git a/multi-account-multi-region-s3-access/Makefile b/multi-account-multi-region-s3-access/Makefile index d636e5cc..71d28e68 100644 --- a/multi-account-multi-region-s3-access/Makefile +++ b/multi-account-multi-region-s3-access/Makefile @@ -10,13 +10,12 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } - @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } + @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies @which lstk > /dev/null || npm install -g @localstack/lstk - @which awslocal || pip install awscli-local run: ## Run the cross-account cross-region experiment of copying data from one S3 bucket to another ./run.sh diff --git a/multi-account-multi-region-s3-access/README.md b/multi-account-multi-region-s3-access/README.md index 77a570f0..f5a400d0 100644 --- a/multi-account-multi-region-s3-access/README.md +++ b/multi-account-multi-region-s3-access/README.md @@ -20,7 +20,7 @@ A demo application illustrating how to access S3 resources across different AWS - 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. - [Docker](https://docs.docker.com/get-docker/) - [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) -- [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) +- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` - [Python 3](https://www.python.org/downloads/) with `pip` ## Check prerequisites diff --git a/multi-account-multi-region-s3-access/run.sh b/multi-account-multi-region-s3-access/run.sh index 7a38ebf7..27d77286 100755 --- a/multi-account-multi-region-s3-access/run.sh +++ b/multi-account-multi-region-s3-access/run.sh @@ -3,20 +3,20 @@ set -euxo pipefail export AWS_SECRET_ACCESS_KEY=test # Create `ls-a` and `ls-b` IAM users using the root accounts of each user -AWS_ACCESS_KEY_ID=000000000001 awslocal iam create-user --user-name ls-a -AWS_ACCESS_KEY_ID=000000000002 awslocal iam create-user --user-name ls-b +AWS_ACCESS_KEY_ID=000000000001 lstk aws iam create-user --user-name ls-a +AWS_ACCESS_KEY_ID=000000000002 lstk aws iam create-user --user-name ls-b # Create IAM policies for each of the IAM users using the root accounts of each user -AWS_ACCESS_KEY_ID=000000000001 awslocal iam create-policy --policy-name pa --policy-document '{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":"s3:*","Resource":"*"}]}' -AWS_ACCESS_KEY_ID=000000000002 awslocal iam create-policy --policy-name pb --policy-document '{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":"s3:*","Resource":"*"}]}' +AWS_ACCESS_KEY_ID=000000000001 lstk aws iam create-policy --policy-name pa --policy-document '{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":"s3:*","Resource":"*"}]}' +AWS_ACCESS_KEY_ID=000000000002 lstk aws iam create-policy --policy-name pb --policy-document '{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":"s3:*","Resource":"*"}]}' # Attach the IAM policies to each IAM user using the root accounts of each user -AWS_ACCESS_KEY_ID=000000000001 awslocal iam attach-user-policy --user-name ls-a --policy-arn arn:aws:iam::000000000001:policy/pa -AWS_ACCESS_KEY_ID=000000000002 awslocal iam attach-user-policy --user-name ls-b --policy-arn arn:aws:iam::000000000002:policy/pb +AWS_ACCESS_KEY_ID=000000000001 lstk aws iam attach-user-policy --user-name ls-a --policy-arn arn:aws:iam::000000000001:policy/pa +AWS_ACCESS_KEY_ID=000000000002 lstk aws iam attach-user-policy --user-name ls-b --policy-arn arn:aws:iam::000000000002:policy/pb # Create access keys for each user using the root accounts of each user -CREDENTIALS_A=$(AWS_ACCESS_KEY_ID=000000000001 awslocal iam create-access-key --user-name ls-a) -CREDENTIALS_B=$(AWS_ACCESS_KEY_ID=000000000002 awslocal iam create-access-key --user-name ls-b) +CREDENTIALS_A=$(AWS_ACCESS_KEY_ID=000000000001 lstk aws iam create-access-key --user-name ls-a) +CREDENTIALS_B=$(AWS_ACCESS_KEY_ID=000000000002 lstk aws iam create-access-key --user-name ls-b) # Retrieve the access key id of each user # In LocalStack, the secret access key is not strictly enforced @@ -25,23 +25,23 @@ USER_ACCESS_KEY_ID_A=`jq -r .AccessKey.AccessKeyId <<< $CREDENTIALS_A` USER_ACCESS_KEY_ID_B=`jq -r .AccessKey.AccessKeyId <<< $CREDENTIALS_B` # Create `source` bucket in `ls-a` user's account -AWS_ACCESS_KEY_ID=$USER_ACCESS_KEY_ID_A awslocal s3 mb s3://source -AWS_ACCESS_KEY_ID=$USER_ACCESS_KEY_ID_A awslocal s3 sync ./bucket s3://source +AWS_ACCESS_KEY_ID=$USER_ACCESS_KEY_ID_A lstk aws s3 mb s3://source +AWS_ACCESS_KEY_ID=$USER_ACCESS_KEY_ID_A lstk aws s3 sync ./bucket s3://source # Attach a bucket policy so that user `ls-b` can access it -AWS_ACCESS_KEY_ID=$USER_ACCESS_KEY_ID_A awslocal s3api put-bucket-policy --bucket source --policy file://source_bucket_policy.json +AWS_ACCESS_KEY_ID=$USER_ACCESS_KEY_ID_A lstk aws s3api put-bucket-policy --bucket source --policy file://source_bucket_policy.json # Attempt to access bucket `source` using `ls-a` user -AWS_ACCESS_KEY_ID=$USER_ACCESS_KEY_ID_B awslocal s3 ls s3://source -AWS_ACCESS_KEY_ID=$USER_ACCESS_KEY_ID_B awslocal s3api list-object-versions --bucket source --prefix main.go +AWS_ACCESS_KEY_ID=$USER_ACCESS_KEY_ID_B lstk aws s3 ls s3://source +AWS_ACCESS_KEY_ID=$USER_ACCESS_KEY_ID_B lstk aws s3api list-object-versions --bucket source --prefix main.go # Sync buckets `source` and `target` using `ls-b` user -AWS_ACCESS_KEY_ID=$USER_ACCESS_KEY_ID_B awslocal s3 mb s3://target -AWS_ACCESS_KEY_ID=$USER_ACCESS_KEY_ID_B awslocal s3 sync s3://source s3://target -AWS_ACCESS_KEY_ID=$USER_ACCESS_KEY_ID_B awslocal s3api list-object-versions --bucket target --prefix main.go +AWS_ACCESS_KEY_ID=$USER_ACCESS_KEY_ID_B lstk aws s3 mb s3://target +AWS_ACCESS_KEY_ID=$USER_ACCESS_KEY_ID_B lstk aws s3 sync s3://source s3://target +AWS_ACCESS_KEY_ID=$USER_ACCESS_KEY_ID_B lstk aws s3api list-object-versions --bucket target --prefix main.go # Fail the script if somehow user A can access the resources of bucket `target` echo "Check if s3api list-object-versions commnands fails as expected" -if AWS_ACCESS_KEY_ID=$USER_ACCESS_KEY_ID_A awslocal s3api list-object-versions --bucket target --prefix main.go; then +if AWS_ACCESS_KEY_ID=$USER_ACCESS_KEY_ID_A lstk aws s3api list-object-versions --bucket target --prefix main.go; then exit 1 fi diff --git a/neptune-graph-db/Makefile b/neptune-graph-db/Makefile index 0e35f838..74212822 100644 --- a/neptune-graph-db/Makefile +++ b/neptune-graph-db/Makefile @@ -11,13 +11,12 @@ check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v python3 > /dev/null 2>&1 || { echo "Python 3 is not installed. Please install Python 3 and try again."; exit 1; } @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } - @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } + @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies @which lstk > /dev/null || npm install -g @localstack/lstk - @which awslocal || pip install awscli-local @pip install gremlinpython boto3 run: ## Run the scenario with queries against local Neptune diff --git a/neptune-graph-db/README.md b/neptune-graph-db/README.md index 936bdcec..83edf351 100644 --- a/neptune-graph-db/README.md +++ b/neptune-graph-db/README.md @@ -15,7 +15,7 @@ A demo application illustrating Neptune Graph DB queries running locally using L - 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. - [Docker](https://docs.docker.com/get-docker/) - [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) -- [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) +- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` - [Python 3](https://www.python.org/downloads/) ## Check prerequisites diff --git a/rds-db-queries/Makefile b/rds-db-queries/Makefile index 358d0064..a86787f0 100644 --- a/rds-db-queries/Makefile +++ b/rds-db-queries/Makefile @@ -11,13 +11,12 @@ check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v python3 > /dev/null 2>&1 || { echo "Python 3 is not installed. Please install Python 3 and try again."; exit 1; } @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } - @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } + @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies @which lstk > /dev/null || npm install -g @localstack/lstk - @which awslocal || pip install awscli-local @test -e .venv || ($(PYTHON_BIN) -m venv .venv; source .venv/bin/activate; pip install wheel; pip install psycopg2-binary boto3) run: ## Run the scenario with the DB queries against local RDS diff --git a/rds-db-queries/README.md b/rds-db-queries/README.md index 2d4b7a78..972c08c2 100644 --- a/rds-db-queries/README.md +++ b/rds-db-queries/README.md @@ -15,7 +15,7 @@ A demo application illustrating running queries against an RDS database locally - 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. - [Docker](https://docs.docker.com/get-docker/) - [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) -- [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) +- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` - [Python 3](https://www.python.org/downloads/) ## Check prerequisites diff --git a/rds-failover-test/Makefile b/rds-failover-test/Makefile index baacf8a1..34c7b4e8 100644 --- a/rds-failover-test/Makefile +++ b/rds-failover-test/Makefile @@ -11,13 +11,12 @@ check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v python3 > /dev/null 2>&1 || { echo "Python 3 is not installed. Please install Python 3 and try again."; exit 1; } @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } - @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } + @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies @which lstk > /dev/null || npm install -g @localstack/lstk - @which awslocal || pip install awscli-local @test -e .venv || ($(PYTHON_BIN) -m venv .venv; source .venv/bin/activate; pip install wheel; pip install psycopg2-binary boto3) run: ## Run the scenario with the DB queries against local RDS diff --git a/rds-failover-test/README.md b/rds-failover-test/README.md index d44e1236..c2a2db4c 100644 --- a/rds-failover-test/README.md +++ b/rds-failover-test/README.md @@ -15,7 +15,7 @@ A demo application illustrating RDS global cluster failover testing with LocalSt - 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. - [Docker](https://docs.docker.com/get-docker/) - [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) -- [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) +- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` - [Python 3](https://www.python.org/downloads/) ## Check prerequisites diff --git a/reproducible-ml/Makefile b/reproducible-ml/Makefile index 6957f4b9..0adec0d8 100644 --- a/reproducible-ml/Makefile +++ b/reproducible-ml/Makefile @@ -8,13 +8,12 @@ usage: check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } - @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } + @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @echo "All required prerequisites are available." install: @which lstk > /dev/null || npm install -g @localstack/lstk - @which awslocal || pip install awscli-local run: ./run.sh diff --git a/reproducible-ml/README.md b/reproducible-ml/README.md index c0c2061f..94fc418a 100644 --- a/reproducible-ml/README.md +++ b/reproducible-ml/README.md @@ -22,7 +22,7 @@ In this demo application, we will train a simple machine-learning model that rec - 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. - [Docker](https://docs.docker.com/get-docker/) - [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) -- [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) +- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` ## Check prerequisites diff --git a/reproducible-ml/run.sh b/reproducible-ml/run.sh index 496f3409..64b4ab82 100755 --- a/reproducible-ml/run.sh +++ b/reproducible-ml/run.sh @@ -4,25 +4,25 @@ zip lambda.zip train.py zip infer.zip infer.py # push training data to S3 -awslocal s3 mb s3://reproducible-ml -awslocal s3 cp lambda.zip s3://reproducible-ml/lambda.zip -awslocal s3 cp infer.zip s3://reproducible-ml/infer.zip -awslocal s3 cp digits.rst s3://reproducible-ml/digits.rst -awslocal s3 cp digits.csv.gz s3://reproducible-ml/digits.csv.gz +lstk aws s3 mb s3://reproducible-ml +lstk aws s3 cp lambda.zip s3://reproducible-ml/lambda.zip +lstk aws s3 cp infer.zip s3://reproducible-ml/infer.zip +lstk aws s3 cp digits.rst s3://reproducible-ml/digits.rst +lstk aws s3 cp digits.csv.gz s3://reproducible-ml/digits.csv.gz # define lamba function to training the ML data -awslocal lambda create-function --function-name ml-train \ +lstk aws lambda create-function --function-name ml-train \ --runtime python3.8 --role arn:aws:iam::000000000000:role/r1 --handler train.handler --timeout 600 \ --code '{"S3Bucket":"reproducible-ml","S3Key":"lambda.zip"}' \ --layers arn:aws:lambda:us-east-1:446751924810:layer:python-3-8-scikit-learn-0-22-0:3 -awslocal lambda create-function --function-name ml-predict \ +lstk aws lambda create-function --function-name ml-predict \ --runtime python3.8 --role arn:aws:iam::000000000000:role/r1 --handler infer.handler --timeout 600 \ --code '{"S3Bucket":"reproducible-ml","S3Key":"infer.zip"}' \ --layers arn:aws:lambda:us-east-1:446751924810:layer:python-3-8-scikit-learn-0-22-0:3 # invoke the lambda function to train and save the model -awslocal lambda invoke --function-name ml-train test.tmp +lstk aws lambda invoke --function-name ml-train test.tmp # invoke the lambda function to evaluate the model on the test set -awslocal lambda invoke --function-name ml-predict test.tmp \ No newline at end of file +lstk aws lambda invoke --function-name ml-predict test.tmp \ No newline at end of file diff --git a/route53-dns-failover/Makefile b/route53-dns-failover/Makefile index 255cf802..137fa8b0 100644 --- a/route53-dns-failover/Makefile +++ b/route53-dns-failover/Makefile @@ -7,12 +7,11 @@ usage: check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } - @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } + @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @echo "All required prerequisites are available." install: - @which awslocal || pip install awscli-local run: ./run.sh diff --git a/route53-dns-failover/README.md b/route53-dns-failover/README.md index 6babe334..1194e0bc 100644 --- a/route53-dns-failover/README.md +++ b/route53-dns-failover/README.md @@ -14,7 +14,7 @@ A demo application illustrating Route53 DNS failover based on health checks usin - 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. - [Docker](https://docs.docker.com/get-docker/) and Docker Compose -- [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) +- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` ## Check prerequisites diff --git a/route53-dns-failover/run.sh b/route53-dns-failover/run.sh index c22be9e0..af75ba47 100755 --- a/route53-dns-failover/run.sh +++ b/route53-dns-failover/run.sh @@ -8,10 +8,10 @@ set -eux HOSTED_ZONE_NAME=hello-localstack.com # Create a hosted zone -HOSTED_ZONE_ID=$(awslocal route53 create-hosted-zone --name $HOSTED_ZONE_NAME --caller-reference foo | jq -r .HostedZone.Id) +HOSTED_ZONE_ID=$(lstk aws route53 create-hosted-zone --name $HOSTED_ZONE_NAME --caller-reference foo | jq -r .HostedZone.Id) # Create a health check that runs against the `http_echo` container -HEALTH_CHECK_ID=$(awslocal route53 create-health-check --caller-reference foobar --health-check-config '{ +HEALTH_CHECK_ID=$(lstk aws route53 create-health-check --caller-reference foobar --health-check-config '{ "FullyQualifiedDomainName": "http_echo", "Port": 80, "ResourcePath": "/", @@ -20,7 +20,7 @@ HEALTH_CHECK_ID=$(awslocal route53 create-health-check --caller-reference foobar }' | jq -r .HealthCheck.Id) # Create RRSets -awslocal route53 change-resource-record-sets --hosted-zone ${HOSTED_ZONE_ID#/hostedzone/} --change-batch '{ +lstk aws route53 change-resource-record-sets --hosted-zone ${HOSTED_ZONE_ID#/hostedzone/} --change-batch '{ "Changes": [ { "Action": "CREATE", @@ -41,7 +41,7 @@ awslocal route53 change-resource-record-sets --hosted-zone ${HOSTED_ZONE_ID#/hos } } ]}' -awslocal route53 change-resource-record-sets --hosted-zone-id ${HOSTED_ZONE_ID#/hostedzone/} --change-batch '{ +lstk aws route53 change-resource-record-sets --hosted-zone-id ${HOSTED_ZONE_ID#/hostedzone/} --change-batch '{ "Changes": [ { "Action": "CREATE", @@ -83,7 +83,7 @@ LOCALSTACK_DNS_SERVER=localhost dig @$LOCALSTACK_DNS_SERVER +noall +answer test.hello-localstack.com CNAME # Make the healthcheck fail by pointing it to a nonexistent host -awslocal route53 update-health-check --health-check-id ${HEALTH_CHECK_ID} --fully-qualified-domain-name bad-host-p45e8eG94rK.com +lstk aws route53 update-health-check --health-check-id ${HEALTH_CHECK_ID} --fully-qualified-domain-name bad-host-p45e8eG94rK.com # Wait for the healthcheck to refresh sleep 12 diff --git a/sample-archive/aws-sam-amplify-lambda-webapp/README.md b/sample-archive/aws-sam-amplify-lambda-webapp/README.md index f61da61f..41428391 100644 --- a/sample-archive/aws-sam-amplify-lambda-webapp/README.md +++ b/sample-archive/aws-sam-amplify-lambda-webapp/README.md @@ -6,7 +6,7 @@ Simple demo application illustrating how to deploy and run the [AWS Serverless A * LocalStack * Docker -* [`awslocal`](https://github.com/localstack/awscli-local) +* [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` * [`samlocal`](https://github.com/localstack/aws-sam-cli-local) ## Installing @@ -33,7 +33,7 @@ cd lambda-refarch-webapp Package and deploy the application against LocalStack, using the `samlocal` command line: ``` -awslocal s3 mb s3://test +lstk aws s3 mb s3://test samlocal build samlocal package --s3-bucket test --output-template-file packaged.yml samlocal deploy --stack-name s3 --s3-bucket test --template-file packaged.yml --capabilities CAPABILITY_IAM --parameter-overrides 'Repository=test OauthToken=test' diff --git a/sample-archive/cdk-for-terraform/python/README.md b/sample-archive/cdk-for-terraform/python/README.md index 1c6e6908..2e9ef1d8 100644 --- a/sample-archive/cdk-for-terraform/python/README.md +++ b/sample-archive/cdk-for-terraform/python/README.md @@ -44,4 +44,4 @@ cdktf deploy ## Configuration -LocalStack currently does not provide a wrapper (similar to `cdklocal` or `tflocal`) to run CDK for Terraform. Therefore, you need to configure the AWS `provider` to redirect requests to the LocalStack API (`http://localhost:4566` by default), using [Terraform Override mechanism](https://developer.hashicorp.com/terraform/language/files/override). Check the [`localstack_config.py`](./localstack_config.py) file for an example. +LocalStack currently does not provide a wrapper (similar to `cdklocal` or `lstk tf`) to run CDK for Terraform. Therefore, you need to configure the AWS `provider` to redirect requests to the LocalStack API (`http://localhost:4566` by default), using [Terraform Override mechanism](https://developer.hashicorp.com/terraform/language/files/override). Check the [`localstack_config.py`](./localstack_config.py) file for an example. diff --git a/sample-archive/cloudfront-distributions/Makefile b/sample-archive/cloudfront-distributions/Makefile index 2b4eae55..0fcbd7d0 100644 --- a/sample-archive/cloudfront-distributions/Makefile +++ b/sample-archive/cloudfront-distributions/Makefile @@ -8,16 +8,15 @@ usage: ## Show this help install: ## Install dependencies @which lstk > /dev/null || npm install -g @localstack/lstk - @which awslocal || pip install awscli-local @test -e node_modules || npm install run: ## Deploy the app locally and invoke the CloudFront distribution @echo "Deploying the app locally"; \ sls deploy --stage local && \ - api_id=$$(awslocal apigateway get-rest-apis | jq -r '.items[0].id') && \ - awslocal s3 cp html/index.html s3://htmlpages/index.html && \ + api_id=$$(lstk aws apigateway get-rest-apis | jq -r '.items[0].id') && \ + lstk aws s3 cp html/index.html s3://htmlpages/index.html && \ perl -i -pe 's/"[0-9a-z]*\.execute\-api\./"'$$api_id'.execute-api./g' distconfig.json && \ - cf_domain=$$(awslocal cloudfront create-distribution --distribution-config \ + cf_domain=$$(lstk aws cloudfront create-distribution --distribution-config \ file://distconfig.json | jq -r '.Distribution.DomainName') && \ echo "Injecting CloudFront domain $$cf_domain into code and redeploying Lambda" && \ perl -i -pe "s|cloudFrontUrl = '.*|cloudFrontUrl = 'https://"$$cf_domain"';|g" handler.js && \ diff --git a/sample-archive/cloudfront-distributions/README.md b/sample-archive/cloudfront-distributions/README.md index 464d9b05..215c784b 100644 --- a/sample-archive/cloudfront-distributions/README.md +++ b/sample-archive/cloudfront-distributions/README.md @@ -7,7 +7,7 @@ Simple demo application illustrating CloudFront distributions running locally us * LocalStack * Docker * `make` -* [`awslocal`](https://github.com/localstack/awscli-local) +* [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` ## Installing diff --git a/sample-archive/ec2-custom-ami/README.md b/sample-archive/ec2-custom-ami/README.md index 53de7434..774e817d 100644 --- a/sample-archive/ec2-custom-ami/README.md +++ b/sample-archive/ec2-custom-ami/README.md @@ -10,7 +10,7 @@ Simple demo application illustrating EC2 virtual machines (VMs) and building ima * LocalStack * Docker * `make` -* [`awslocal`](https://github.com/localstack/awscli-local) +* [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` * [`packer`](https://www.packer.io) * `VirtualBox` on Mac OS diff --git a/sample-archive/ec2-custom-ami/run.sh b/sample-archive/ec2-custom-ami/run.sh index a86371ff..16b4d3ae 100755 --- a/sample-archive/ec2-custom-ami/run.sh +++ b/sample-archive/ec2-custom-ami/run.sh @@ -6,11 +6,11 @@ IMAGE_FILE=amzn2.vdi test -e $IMAGE_FILE || wget -O $IMAGE_FILE $IMAGE_URL -VPC_ID=$(awslocal ec2 create-vpc --cidr-block 0.0.0.0/24 | jq -r '.Vpc.VpcId') -SUB_ID=$(awslocal ec2 create-subnet --cidr-block 0.0.0.0/26 --vpc-id $VPC_ID | jq -r '.Subnet.SubnetId') +VPC_ID=$(lstk aws ec2 create-vpc --cidr-block 0.0.0.0/24 | jq -r '.Vpc.VpcId') +SUB_ID=$(lstk aws ec2 create-subnet --cidr-block 0.0.0.0/26 --vpc-id $VPC_ID | jq -r '.Subnet.SubnetId') perl -i -pe 's|"S3Key": .*|"S3Key": "'$PWD'/amzn2.vdi"|' containers.json -IMAGE_ID=$(awslocal ec2 import-image --description "Test VM image" --license-type BYOL --disk-containers file://containers.json | jq -r '.ImageId') +IMAGE_ID=$(lstk aws ec2 import-image --description "Test VM image" --license-type BYOL --disk-containers file://containers.json | jq -r '.ImageId') perl -i -pe 's/"source_ami": .*/"source_ami": "'$IMAGE_ID'",/' packer.json perl -i -pe 's/"subnet_id": .*/"subnet_id": "'$SUB_ID'",/' packer.json diff --git a/sample-archive/emr-hadoop-spark-jobs/Makefile b/sample-archive/emr-hadoop-spark-jobs/Makefile index 8a15f03d..11561d7b 100644 --- a/sample-archive/emr-hadoop-spark-jobs/Makefile +++ b/sample-archive/emr-hadoop-spark-jobs/Makefile @@ -8,7 +8,6 @@ usage: ## Show this help install: ## Install dependencies @which lstk > /dev/null || npm install -g @localstack/lstk - @which awslocal || pip install awscli-local @docker images | grep localstack/spark || docker pull localstack/spark run: ## Build and deploy the app locally @@ -17,25 +16,25 @@ run: ## Build and deploy the app locally (cd job; test -e target/localstack-emr-test-0.1.0-shaded.jar || mvn package) @echo "Uploading test files to local S3..." - awslocal s3 mb s3://bucket1 - awslocal s3 mb s3://bucket2 - awslocal s3 mb s3://bucket3 - awslocal s3 cp job/target/localstack-emr-test-0.1.0-shaded.jar s3://bucket1/test.jar + lstk aws s3 mb s3://bucket1 + lstk aws s3 mb s3://bucket2 + lstk aws s3 mb s3://bucket3 + lstk aws s3 cp job/target/localstack-emr-test-0.1.0-shaded.jar s3://bucket1/test.jar @echo '' > /tmp/job1.xml.tmp - awslocal s3 cp /tmp/job1.xml.tmp s3://bucket1/job1.xml + lstk aws s3 cp /tmp/job1.xml.tmp s3://bucket1/job1.xml @echo '' > /tmp/job2.xml.tmp - awslocal s3 cp /tmp/job2.xml.tmp s3://bucket1/job2.xml + lstk aws s3 cp /tmp/job2.xml.tmp s3://bucket1/job2.xml @echo "Creating local EMR cluster and running init jobs (this may take some time)..." - awslocal emr create-cluster \ + lstk aws emr create-cluster \ --release-label emr-5.9.0 --applications Name=Spark --ec2-attributes KeyName=myKey \ --instance-groups InstanceGroupType=MASTER,InstanceCount=1,InstanceType=m4.large InstanceGroupType=CORE,InstanceCount=2,InstanceType=m4.large \ --steps "`cat steps.json`" @echo "The job should have copied file "job1.xml" to bucket bucket2:" - awslocal s3 ls s3://bucket2/ + lstk aws s3 ls s3://bucket2/ @echo "The Spark job should have copied file "job2.xml" to bucket bucket3:" - awslocal s3 ls s3://bucket3/ + lstk aws s3 ls s3://bucket3/ test-ci: # skip test in CI for now, to avoid downloading large Docker image diff --git a/sample-archive/emr-hadoop-spark-jobs/README.md b/sample-archive/emr-hadoop-spark-jobs/README.md index 12aa0eb3..19f5d2d8 100644 --- a/sample-archive/emr-hadoop-spark-jobs/README.md +++ b/sample-archive/emr-hadoop-spark-jobs/README.md @@ -52,10 +52,10 @@ sleep 5 Finally, you should see some log lines indicating that the 2 jobs have run successfully: ``` The job should have copied file job1.xml to bucket bucket2: -awslocal s3 ls s3://bucket2/ +lstk aws s3 ls s3://bucket2/ 2019-12-16 20:45:59 9 job1.xml The Spark job should have copied file job2.xml to bucket bucket3: -awslocal s3 ls s3://bucket3/ +lstk aws s3 ls s3://bucket3/ 2019-12-16 20:46:12 9 job2.xml ``` diff --git a/sample-archive/kinesis-analytics/Makefile b/sample-archive/kinesis-analytics/Makefile index b73c4aa8..4dff382a 100644 --- a/sample-archive/kinesis-analytics/Makefile +++ b/sample-archive/kinesis-analytics/Makefile @@ -9,34 +9,33 @@ usage: ## Show this help install: ## Install dependencies #@npm install @which lstk > /dev/null || npm install -g @localstack/lstk - @which awslocal || pip install awscli-local deploy: @echo "Deploying app to local environment"; \ - awslocal cloudformation create-stack --stack-name test-kinesis --template-body file://analytics.app.cf.yml; \ + lstk aws cloudformation create-stack --stack-name test-kinesis --template-body file://analytics.app.cf.yml; \ echo "Kinesis Analytics stack successfully deployed."; \ echo "Sleeping some time to wait for the application and Kinesis listeners to start up ..."; \ for i in {1..7}; do \ sleep 15; \ - status=$$(awslocal kinesisanalytics describe-application --application-name sampleApp \ + status=$$(lstk aws kinesisanalytics describe-application --application-name sampleApp \ | jq -r .ApplicationDetail.ApplicationStatus); \ echo "Application status: $$status"; if [ "$$status" = "RUNNING" ]; then break; fi; \ done; \ - awslocal kinesis list-streams; \ - awslocal kinesisanalytics list-applications + lstk aws kinesis list-streams; \ + lstk aws kinesisanalytics list-applications query: - @outStream=$$(awslocal kinesis list-streams | jq -r '.StreamNames[]' | grep Output); \ - inStream=$$(awslocal kinesis list-streams | jq -r '.StreamNames[]' | grep Input); \ + @outStream=$$(lstk aws kinesis list-streams | jq -r '.StreamNames[]' | grep Output); \ + inStream=$$(lstk aws kinesis list-streams | jq -r '.StreamNames[]' | grep Input); \ echo "Subscribing to output Kinesis stream $$outStream"; \ - iter=$$(awslocal kinesis get-shard-iterator --stream-name $$outStream \ + iter=$$(lstk aws kinesis get-shard-iterator --stream-name $$outStream \ --shard-id shardId-000000000000 --shard-iterator-type TRIM_HORIZON | jq -r .ShardIterator); \ echo "Putting records to input Kinesis stream $$inStream"; \ - awslocal kinesis put-record --stream-name $$inStream \ + lstk aws kinesis put-record --stream-name $$inStream \ --data '{"symbol":"TEST","price":123,"volume":100}' --partition-key test; \ echo "Waiting for query results... (should print a record array with base64-encoded 'Data' below)"; \ sleep 10; \ - awslocal kinesis get-records --shard-iterator $$iter | jq .Records + lstk aws kinesis get-records --shard-iterator $$iter | jq .Records run: ## Deploy the app and run the streaming queries locally @make install diff --git a/sample-archive/mediastore-uploads/Makefile b/sample-archive/mediastore-uploads/Makefile index 5d09cba9..5f3210a1 100644 --- a/sample-archive/mediastore-uploads/Makefile +++ b/sample-archive/mediastore-uploads/Makefile @@ -8,13 +8,12 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } - @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } + @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies @which lstk > /dev/null || npm install -g @localstack/lstk - @which awslocal > /dev/null || pip install awscli-local run: ## Run tests uploading objects via MediaStore API ./test.sh diff --git a/sample-archive/mediastore-uploads/README.md b/sample-archive/mediastore-uploads/README.md index ef554a48..f50b42bb 100644 --- a/sample-archive/mediastore-uploads/README.md +++ b/sample-archive/mediastore-uploads/README.md @@ -15,7 +15,7 @@ A demo application illustrating the use of the AWS MediaStore API with LocalStac - 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. - [Docker](https://docs.docker.com/get-docker/) - [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) -- [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) +- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` ## Check prerequisites diff --git a/sample-archive/mediastore-uploads/test.sh b/sample-archive/mediastore-uploads/test.sh index 050db465..fb85649f 100755 --- a/sample-archive/mediastore-uploads/test.sh +++ b/sample-archive/mediastore-uploads/test.sh @@ -3,18 +3,18 @@ CONTAINER=my-container1 echo "Creating MediaStore container in LocalStack ..." -endpoint=$(awslocal mediastore create-container --container-name $CONTAINER | jq -r '.Container.Endpoint') +endpoint=$(lstk aws mediastore create-container --container-name $CONTAINER | jq -r '.Container.Endpoint') echo "MediaStore container endpoint: $endpoint" echo "Uploading file to MediaStore container ..." echo 'test file content 123' > /tmp/test-mediastore-file.txt -awslocal mediastore-data --endpoint-url $endpoint put-object --path /test/file.txt --body /tmp/test-mediastore-file.txt +lstk aws mediastore-data --endpoint-url $endpoint put-object --path /test/file.txt --body /tmp/test-mediastore-file.txt echo "Downloading file from MediaStore container ..." -awslocal mediastore-data --endpoint-url $endpoint get-object --path /test/file.txt /tmp/test-mediastore-file-1.txt +lstk aws mediastore-data --endpoint-url $endpoint get-object --path /test/file.txt /tmp/test-mediastore-file-1.txt echo "Checking file content of downloaded file ..." cat /tmp/test-mediastore-file-1.txt | grep 'file content' echo "Cleaning up - deleting MediaStore container" -awslocal mediastore-data --endpoint-url $endpoint delete-object --path /test/file.txt -awslocal mediastore delete-container --container-name $CONTAINER +lstk aws mediastore-data --endpoint-url $endpoint delete-object --path /test/file.txt +lstk aws mediastore delete-container --container-name $CONTAINER diff --git a/sample-archive/qldb-ledger-queries/Makefile b/sample-archive/qldb-ledger-queries/Makefile index b4c90e33..b1f57fb6 100644 --- a/sample-archive/qldb-ledger-queries/Makefile +++ b/sample-archive/qldb-ledger-queries/Makefile @@ -11,13 +11,12 @@ check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v python3 > /dev/null 2>&1 || { echo "Python 3 is not installed. Please install Python 3 and try again."; exit 1; } @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } - @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } + @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies @which lstk > /dev/null || npm install -g @localstack/lstk - @which awslocal || pip install awscli-local @test -e .venv || $(PYTHON_BIN) -m venv .venv @.venv/bin/python -m pip install -r requirements.txt diff --git a/sample-archive/qldb-ledger-queries/README.md b/sample-archive/qldb-ledger-queries/README.md index f38a6f0c..37aa165b 100644 --- a/sample-archive/qldb-ledger-queries/README.md +++ b/sample-archive/qldb-ledger-queries/README.md @@ -15,7 +15,7 @@ A demo application illustrating running queries against a Quantum Ledger Databas - 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. - [Docker](https://docs.docker.com/get-docker/) - [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) -- [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) +- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` - [Python 3](https://www.python.org/downloads/) ## Check prerequisites diff --git a/sample-archive/sagemaker-ml-jobs/Makefile b/sample-archive/sagemaker-ml-jobs/Makefile index 5c6aff95..c041cdb6 100644 --- a/sample-archive/sagemaker-ml-jobs/Makefile +++ b/sample-archive/sagemaker-ml-jobs/Makefile @@ -9,7 +9,6 @@ usage: ## Show this help install: ## Install dependencies @which lstk > /dev/null || npm install -g @localstack/lstk - @which awslocal || pip install awscli-local @test -e .venv || virtualenv --python $(PYTHON_BIN) .venv @. .venv/bin/activate; pip install tensorflow==1.15.0 sagemaker localstack 'requests>=2.20.0' diff --git a/sample-archive/sagemaker-ml-jobs/README.md b/sample-archive/sagemaker-ml-jobs/README.md index 7e42e0ce..82d264a7 100644 --- a/sample-archive/sagemaker-ml-jobs/README.md +++ b/sample-archive/sagemaker-ml-jobs/README.md @@ -9,7 +9,7 @@ Simple demo application illustrating running a machine learning job using the AW * Python * `virtualenv` * `make` -* [`awslocal`](https://github.com/localstack/awscli-local) +* [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` ## Installing @@ -36,7 +36,7 @@ This command pulls a SageMaker TensorFlow Docker image, and spins up a Docker co When the job has finished running, you should see the results in the target S3 bucket: ``` -$ awslocal s3 ls s3://sagemaker-us-east-1-000000000000/ +$ lstk aws s3 ls s3://sagemaker-us-east-1-000000000000/ PRE data/ PRE eval/ PRE export/ diff --git a/sample-archive/serverless-request-workers/README.md b/sample-archive/serverless-request-workers/README.md index a408a3d1..afdeb561 100644 --- a/sample-archive/serverless-request-workers/README.md +++ b/sample-archive/serverless-request-workers/README.md @@ -31,9 +31,9 @@ Open the following file in your browser: `demo/web/index.html` * Click the button "Create new request" to send a new request to the backend API * The new request will go through the phases `QUEUED->PROCESSING->FINISHED` as the request is being handled by the backend services (Lambda functions, Step Functions state machine) -If you have the [`awslocal`](https://github.com/localstack/awscli-local) command line installed, you can browse the contents of the local S3 bucket via: +With [`lstk`](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) and the AWS CLI installed, you can browse the contents of the local S3 bucket via: ``` -awslocal s3 ls s3://archiveBucket/ +lstk aws s3 ls s3://archiveBucket/ ``` ## App Screenshot diff --git a/serverless-lambda-layers/Makefile b/serverless-lambda-layers/Makefile index e2de600e..3f467f07 100644 --- a/serverless-lambda-layers/Makefile +++ b/serverless-lambda-layers/Makefile @@ -9,7 +9,7 @@ check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v node > /dev/null 2>&1 || { echo "Node.js is not installed. Please install Node.js and try again."; exit 1; } @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } - @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } + @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @echo "All required prerequisites are available." @@ -18,14 +18,13 @@ install: ## Install dependencies @which serverless || npm install -g serverless @npm install --save-dev serverless-localstack @which lstk > /dev/null || npm install -g @localstack/lstk - @which awslocal || pip install awscli-local run: ## Deploy the app locally and run a Lambda test invocation echo "Deploying Serverless app to local environment"; \ - awslocal s3api create-bucket --bucket testbucket --region us-east-1; \ + lstk aws s3api create-bucket --bucket testbucket --region us-east-1; \ SLS_DEBUG=1 npm run deploy && \ echo "Serverless app successfully deployed. Now trying to invoke the Lambda function with layer." && \ - awslocal lambda invoke --function-name test-layers-local-hello /tmp/out.tmp + lstk aws lambda invoke --function-name test-layers-local-hello /tmp/out.tmp 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) diff --git a/serverless-websockets/Makefile b/serverless-websockets/Makefile index b6220436..802b3803 100644 --- a/serverless-websockets/Makefile +++ b/serverless-websockets/Makefile @@ -11,7 +11,7 @@ check: ## Check if all required prerequisites are installed @command -v node > /dev/null 2>&1 || { echo "Node.js is not installed. Please install Node.js and try again."; exit 1; } @command -v python3 > /dev/null 2>&1 || { echo "Python 3 is not installed. Please install Python 3 and try again."; exit 1; } @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } - @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } + @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @echo "All required prerequisites are available." @@ -19,7 +19,6 @@ install: ## Install dependencies @npm install @which serverless || npm install -g serverless @which lstk > /dev/null || npm install -g @localstack/lstk - @which awslocal || pip install awscli-local @test -e $(VENV_DIR) || virtualenv $(VENV_DIR) @. $(VENV_DIR)/bin/activate; pip install -r requirements.txt diff --git a/stepfunctions-lambda/Makefile b/stepfunctions-lambda/Makefile index 6db833ee..99021348 100644 --- a/stepfunctions-lambda/Makefile +++ b/stepfunctions-lambda/Makefile @@ -9,21 +9,20 @@ check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v python3 > /dev/null 2>&1 || { echo "Python 3 is not installed. Please install Python 3 and try again."; exit 1; } @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } - @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } + @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies - @which awslocal || pip install awscli-local create-lambdas: ## Create the Lambdas - awslocal iam create-role --role-name step-function-lambda --assume-role-policy-document file://step-trust-policy.json - awslocal iam attach-role-policy --role-name step-function-lambda --policy-arn arn:aws:iam::aws:policy/service-role/AWSLambdaRole + lstk aws iam create-role --role-name step-function-lambda --assume-role-policy-document file://step-trust-policy.json + lstk aws iam attach-role-policy --role-name step-function-lambda --policy-arn arn:aws:iam::aws:policy/service-role/AWSLambdaRole cp -f lambda_adam.py lambda_function.py zip package.zip lambda_function.py - awslocal lambda create-function \ + lstk aws lambda create-function \ --function-name adam \ --role arn:aws:iam::000000000000:role/lambda-demo \ --runtime python3.9 --timeout 10 --memory-size 128 \ @@ -35,7 +34,7 @@ create-lambdas: ## Create the Lambdas cp -f lambda_cole.py lambda_function.py zip package.zip lambda_function.py - awslocal lambda create-function \ + lstk aws lambda create-function \ --function-name cole \ --role arn:aws:iam::000000000000:role/lambda-demo \ --runtime python3.9 --timeout 10 --memory-size 128 \ @@ -47,7 +46,7 @@ create-lambdas: ## Create the Lambdas cp -f lambda_combine.py lambda_function.py zip package.zip lambda_function.py - awslocal lambda create-function \ + lstk aws lambda create-function \ --function-name combine \ --role arn:aws:iam::000000000000:role/lambda-demo \ --runtime python3.9 --timeout 10 --memory-size 128 \ diff --git a/stepfunctions-lambda/README.md b/stepfunctions-lambda/README.md index 4b1ddf57..8a968736 100644 --- a/stepfunctions-lambda/README.md +++ b/stepfunctions-lambda/README.md @@ -15,7 +15,7 @@ A demo application illustrating how to orchestrate Lambda functions using AWS St - 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. - [Docker](https://docs.docker.com/get-docker/) - [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) -- [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) +- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` ## Check prerequisites diff --git a/terraform-resources/Makefile b/terraform-resources/Makefile index da8730f2..b35bfa4e 100644 --- a/terraform-resources/Makefile +++ b/terraform-resources/Makefile @@ -9,7 +9,7 @@ check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v terraform > /dev/null 2>&1 || { echo "Terraform is not installed. Please install Terraform and try again."; exit 1; } @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } - @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } + @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @echo "All required prerequisites are available." diff --git a/terraform-resources/README.md b/terraform-resources/README.md index 6ff515d5..7d0534c3 100644 --- a/terraform-resources/README.md +++ b/terraform-resources/README.md @@ -8,7 +8,7 @@ ## Introduction -A demo application deploying various AWS resources to LocalStack via Terraform. The sample creates a range of AWS resources including S3 buckets, Lambda functions, API Gateway endpoints, RDS parameter groups, and ElastiCache clusters — all using `tflocal` to redirect Terraform to LocalStack. +A demo application deploying various AWS resources to LocalStack via Terraform. The sample creates a range of AWS resources including S3 buckets, Lambda functions, API Gateway endpoints, RDS parameter groups, and ElastiCache clusters — all using `lstk tf` to redirect Terraform to LocalStack. ## Prerequisites diff --git a/transfer-ftp-s3/Makefile b/transfer-ftp-s3/Makefile index 0c72a2b6..ca428a92 100644 --- a/transfer-ftp-s3/Makefile +++ b/transfer-ftp-s3/Makefile @@ -9,14 +9,13 @@ check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v python3 > /dev/null 2>&1 || { echo "Python 3 is not installed. Please install Python 3 and try again."; exit 1; } @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed. Please run: npm install -g @localstack/lstk"; exit 1; } - @command -v awslocal > /dev/null 2>&1 || { echo "awslocal is not installed. Please run: pip install awscli-local"; exit 1; } + @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @echo "All required prerequisites are available." install: ## Install dependencies # @npm install @which lstk > /dev/null || npm install -g @localstack/lstk - @which awslocal || pip install awscli-local @test -e .venv || (virtualenv .venv; . .venv/bin/activate; pip install -r requirements.txt) run: ## Deploy and run the sample locally diff --git a/transfer-ftp-s3/README.md b/transfer-ftp-s3/README.md index fbafa830..0cce2a28 100644 --- a/transfer-ftp-s3/README.md +++ b/transfer-ftp-s3/README.md @@ -15,7 +15,7 @@ A demo application illustrating the use of the AWS Transfer API with LocalStack. - 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. - [Docker](https://docs.docker.com/get-docker/) - [`lstk` CLI](https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/) -- [`awslocal` CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) +- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html), used through `lstk aws` ## Check prerequisites From 3afb918bd6813567279ae96ec9247067bdefc6f0 Mon Sep 17 00:00:00 2001 From: Harsh Mishra Date: Thu, 15 Oct 2026 19:00:38 +0530 Subject: [PATCH 3/8] Set up the lstk AWS profile in CI and install curl for the EMR build - Without a localstack AWS profile, lstk aws prints a setup note on stdout, so scripts that pipe its output into jq fail. CI now runs lstk setup aws after installing lstk, and the README tells users to run it once. - The localstack/localstack image no longer ships curl, so the EMR Serverless dependencies image installs it before fetching Poetry. Claude-Session: https://claude.ai/code/session_01DZfDmzUBPqNAu3yFKyfCNM --- .github/workflows/test.yml | 3 +++ README.md | 2 ++ emr-serverless-python-dependencies/Dockerfile-localstack | 2 ++ 3 files changed, 7 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cb7cbce8..3e26bca7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -41,6 +41,9 @@ jobs: - name: Install lstk and the AWS CLI wrapper run: | npm install -g @localstack/lstk + # Write the localstack AWS profile. Without it, lstk aws prints a setup note on stdout, + # which breaks scripts that pipe its output into jq. + lstk setup aws --force --non-interactive pip install awscli virtualenv pip install --upgrade boto3 botocore diff --git a/README.md b/README.md index 82ea4f82..5ac26146 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,8 @@ lstk login You can find your Auth Token on the [LocalStack Web Application](https://app.localstack.cloud/workspace/auth-token). +The samples call the AWS CLI through `lstk aws`. Run `lstk setup aws` once to create the `localstack` AWS profile it uses. + ## Outline | Sample Name | Description | diff --git a/emr-serverless-python-dependencies/Dockerfile-localstack b/emr-serverless-python-dependencies/Dockerfile-localstack index 6db7f530..ac8fc3ab 100644 --- a/emr-serverless-python-dependencies/Dockerfile-localstack +++ b/emr-serverless-python-dependencies/Dockerfile-localstack @@ -10,6 +10,8 @@ ENV PATH="$VIRTUAL_ENV/bin:$PATH" # EMR 6.x uses Python 3.7 - limit Poetry version to 1.5.1 ENV POETRY_VERSION=1.5.1 RUN python3 -m pip install --upgrade pip +# The LocalStack image no longer ships curl +RUN apt-get update && apt-get install -y --no-install-recommends curl && rm -rf /var/lib/apt/lists/* RUN curl -sSL https://install.python-poetry.org | python3 - ENV PATH="$PATH:/root/.local/bin" From 6ed776f608f8053c506424505228c1f91d295fa1 Mon Sep 17 00:00:00 2001 From: Harsh Mishra Date: Thu, 15 Oct 2026 19:02:03 +0530 Subject: [PATCH 4/8] Require lstk in the Docker Compose samples that call lstk aws route53-dns-failover and java-notification-app start LocalStack with Docker Compose but call the AWS CLI through lstk aws, so their check targets look for lstk again, and route53-dns-failover installs it. Claude-Session: https://claude.ai/code/session_01DZfDmzUBPqNAu3yFKyfCNM --- java-notification-app/Makefile | 1 + route53-dns-failover/Makefile | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/java-notification-app/Makefile b/java-notification-app/Makefile index 9047150b..e97da310 100644 --- a/java-notification-app/Makefile +++ b/java-notification-app/Makefile @@ -9,6 +9,7 @@ usage: ## Show this help check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } @command -v mvn > /dev/null 2>&1 || { echo "Maven is not installed. Please install Maven and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed (required by 'lstk aws'). Please run: npm install -g @localstack/lstk"; exit 1; } @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @echo "All required prerequisites are available." diff --git a/route53-dns-failover/Makefile b/route53-dns-failover/Makefile index 137fa8b0..ce1bba79 100644 --- a/route53-dns-failover/Makefile +++ b/route53-dns-failover/Makefile @@ -7,11 +7,13 @@ usage: check: ## Check if all required prerequisites are installed @command -v docker > /dev/null 2>&1 || { echo "Docker is not installed. Please install Docker and try again."; exit 1; } + @command -v lstk > /dev/null 2>&1 || { echo "lstk CLI is not installed (required by 'lstk aws'). Please run: npm install -g @localstack/lstk"; exit 1; } @command -v aws > /dev/null 2>&1 || { echo "AWS CLI is not installed (required by 'lstk aws'). Please install it and try again."; exit 1; } @echo "All required prerequisites are available." -install: +install: ## Install dependencies + @which lstk > /dev/null || npm install -g @localstack/lstk run: ./run.sh From 3fddf9e852888afeb46ae0586ae259d67115a05a Mon Sep 17 00:00:00 2001 From: Harsh Mishra Date: Thu, 15 Oct 2026 19:04:45 +0530 Subject: [PATCH 5/8] Use the container port as the host port in the ECS sample Fargate tasks use awsvpc networking, where AWS requires the host port to equal the container port. RegisterTaskDefinition now rejects the old 45139 -> 80 mapping on LocalStack too, rolling back the stack. Drop the HostPort parameter; make run already reads the bound port from the task's network bindings. Claude-Session: https://claude.ai/code/session_01DZfDmzUBPqNAu3yFKyfCNM --- ecs-ecr-container-app/README.md | 2 +- ecs-ecr-container-app/templates/ecs.sample.yml | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/ecs-ecr-container-app/README.md b/ecs-ecr-container-app/README.md index 7e06c63d..52c9b858 100644 --- a/ecs-ecr-container-app/README.md +++ b/ecs-ecr-container-app/README.md @@ -59,7 +59,7 @@ You should see a success output in the terminal: Sample app (nginx) successfully deployed. ``` -The nginx test app is accessible at `http://localhost:45139/` after deployment. +After deployment, `make run` prints the host port LocalStack bound for the nginx task (from the task's network bindings) and requests `http://localhost:/`. ## License diff --git a/ecs-ecr-container-app/templates/ecs.sample.yml b/ecs-ecr-container-app/templates/ecs.sample.yml index 99b4aff4..8c83f11b 100644 --- a/ecs-ecr-container-app/templates/ecs.sample.yml +++ b/ecs-ecr-container-app/templates/ecs.sample.yml @@ -21,10 +21,6 @@ Parameters: Type: Number Default: 80 Description: What port number the application inside the docker container is binding to - HostPort: - Type: Number - Default: 45139 - Description: What port number the application on the host is binding to ContainerCpu: Type: Number Default: 256 @@ -85,8 +81,8 @@ Resources: Memory: !Ref ContainerMemory Image: !Ref ImageUrl PortMappings: + # With awsvpc networking (required by Fargate) the host port must equal the container port - ContainerPort: !Ref ContainerPort - HostPort: !Ref HostPort # The service. The service is a resource which allows you to run multiple # copies of a type of task, and gather up their logs and metrics, as well From 9afa75f33161e43ef9036bdb483aefc44a52211c Mon Sep 17 00:00:00 2001 From: Harsh Mishra Date: Thu, 15 Oct 2026 19:12:01 +0530 Subject: [PATCH 6/8] Sign the IAM-user calls in the multi-account sample with the AWS CLI lstk aws reads AWS_ACCESS_KEY_ID only as a 12-digit account id and drops any other value once the localstack profile exists, so calls meant to run as the ls-a/ls-b IAM users ran with the profile's root credentials and the access-denied check passed by mistake. Those calls now use the AWS CLI with the LocalStack endpoint; the account-id calls keep using lstk aws. DEBUG also gets the LOCALSTACK_ prefix lstk forwards. Claude-Session: https://claude.ai/code/session_01DZfDmzUBPqNAu3yFKyfCNM --- multi-account-multi-region-s3-access/Makefile | 2 +- multi-account-multi-region-s3-access/run.sh | 22 +++++++++++-------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/multi-account-multi-region-s3-access/Makefile b/multi-account-multi-region-s3-access/Makefile index 71d28e68..cc5b573d 100644 --- a/multi-account-multi-region-s3-access/Makefile +++ b/multi-account-multi-region-s3-access/Makefile @@ -1,6 +1,6 @@ # Enforce IAM to test cross-account cross-region access export LOCALSTACK_ENFORCE_IAM=1 -export DEBUG=1 +export LOCALSTACK_DEBUG=1 SHELL := /bin/bash diff --git a/multi-account-multi-region-s3-access/run.sh b/multi-account-multi-region-s3-access/run.sh index 27d77286..dfd1c4af 100755 --- a/multi-account-multi-region-s3-access/run.sh +++ b/multi-account-multi-region-s3-access/run.sh @@ -1,6 +1,10 @@ #!/bin/bash set -euxo pipefail export AWS_SECRET_ACCESS_KEY=test +export AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION:-us-east-1} +# lstk aws reads AWS_ACCESS_KEY_ID only as a 12-digit account id and drops any other value, +# so the calls signed as an IAM user (access key LKIA...) use the AWS CLI with the LocalStack endpoint +LS_ENDPOINT=${AWS_ENDPOINT_URL:-http://localhost.localstack.cloud:4566} # Create `ls-a` and `ls-b` IAM users using the root accounts of each user AWS_ACCESS_KEY_ID=000000000001 lstk aws iam create-user --user-name ls-a @@ -25,23 +29,23 @@ USER_ACCESS_KEY_ID_A=`jq -r .AccessKey.AccessKeyId <<< $CREDENTIALS_A` USER_ACCESS_KEY_ID_B=`jq -r .AccessKey.AccessKeyId <<< $CREDENTIALS_B` # Create `source` bucket in `ls-a` user's account -AWS_ACCESS_KEY_ID=$USER_ACCESS_KEY_ID_A lstk aws s3 mb s3://source -AWS_ACCESS_KEY_ID=$USER_ACCESS_KEY_ID_A lstk aws s3 sync ./bucket s3://source +AWS_ACCESS_KEY_ID=$USER_ACCESS_KEY_ID_A aws --endpoint-url "$LS_ENDPOINT" s3 mb s3://source +AWS_ACCESS_KEY_ID=$USER_ACCESS_KEY_ID_A aws --endpoint-url "$LS_ENDPOINT" s3 sync ./bucket s3://source # Attach a bucket policy so that user `ls-b` can access it -AWS_ACCESS_KEY_ID=$USER_ACCESS_KEY_ID_A lstk aws s3api put-bucket-policy --bucket source --policy file://source_bucket_policy.json +AWS_ACCESS_KEY_ID=$USER_ACCESS_KEY_ID_A aws --endpoint-url "$LS_ENDPOINT" s3api put-bucket-policy --bucket source --policy file://source_bucket_policy.json # Attempt to access bucket `source` using `ls-a` user -AWS_ACCESS_KEY_ID=$USER_ACCESS_KEY_ID_B lstk aws s3 ls s3://source -AWS_ACCESS_KEY_ID=$USER_ACCESS_KEY_ID_B lstk aws s3api list-object-versions --bucket source --prefix main.go +AWS_ACCESS_KEY_ID=$USER_ACCESS_KEY_ID_B aws --endpoint-url "$LS_ENDPOINT" s3 ls s3://source +AWS_ACCESS_KEY_ID=$USER_ACCESS_KEY_ID_B aws --endpoint-url "$LS_ENDPOINT" s3api list-object-versions --bucket source --prefix main.go # Sync buckets `source` and `target` using `ls-b` user -AWS_ACCESS_KEY_ID=$USER_ACCESS_KEY_ID_B lstk aws s3 mb s3://target -AWS_ACCESS_KEY_ID=$USER_ACCESS_KEY_ID_B lstk aws s3 sync s3://source s3://target -AWS_ACCESS_KEY_ID=$USER_ACCESS_KEY_ID_B lstk aws s3api list-object-versions --bucket target --prefix main.go +AWS_ACCESS_KEY_ID=$USER_ACCESS_KEY_ID_B aws --endpoint-url "$LS_ENDPOINT" s3 mb s3://target +AWS_ACCESS_KEY_ID=$USER_ACCESS_KEY_ID_B aws --endpoint-url "$LS_ENDPOINT" s3 sync s3://source s3://target +AWS_ACCESS_KEY_ID=$USER_ACCESS_KEY_ID_B aws --endpoint-url "$LS_ENDPOINT" s3api list-object-versions --bucket target --prefix main.go # Fail the script if somehow user A can access the resources of bucket `target` echo "Check if s3api list-object-versions commnands fails as expected" -if AWS_ACCESS_KEY_ID=$USER_ACCESS_KEY_ID_A lstk aws s3api list-object-versions --bucket target --prefix main.go; then +if AWS_ACCESS_KEY_ID=$USER_ACCESS_KEY_ID_A aws --endpoint-url "$LS_ENDPOINT" s3api list-object-versions --bucket target --prefix main.go; then exit 1 fi From 44769b2b11413222c5c1050d422fadd223b2652f Mon Sep 17 00:00:00 2001 From: Harsh Mishra Date: Thu, 15 Oct 2026 19:15:48 +0530 Subject: [PATCH 7/8] Connect to the WebSocket stage and wait longer for MSK - serverless-websockets: test.py connected to the API endpoint without a stage path, which LocalStack now rejects with HTTP 401 (AWS needs the stage too). It now appends the deployed stage. - glue-msk-schema-registry: Kafka can take more than the 140s the script waited for the MSK cluster to become ACTIVE on a busy runner. Wait up to about 5 minutes. Claude-Session: https://claude.ai/code/session_01DZfDmzUBPqNAu3yFKyfCNM --- glue-msk-schema-registry/run.sh | 2 +- serverless-websockets/test.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/glue-msk-schema-registry/run.sh b/glue-msk-schema-registry/run.sh index df61146a..a03be3d0 100755 --- a/glue-msk-schema-registry/run.sh +++ b/glue-msk-schema-registry/run.sh @@ -51,7 +51,7 @@ cluster_arn=$(set -x;lstk aws kafka create-cluster \ state=$(set -x; lstk aws kafka describe-cluster --cluster-arn $cluster_arn | jq -r .ClusterInfo.State) -for i in {1..35}; do +for i in {1..75}; do echo "Waiting for Kafka cluster to become ACTIVE (current status: $state)..." sleep 4 if [ "$state" == ACTIVE ]; then diff --git a/serverless-websockets/test.py b/serverless-websockets/test.py index c55399df..426d729c 100644 --- a/serverless-websockets/test.py +++ b/serverless-websockets/test.py @@ -22,7 +22,9 @@ async def start_client(uri): apis = client.get_apis()['Items'] api = [a for a in apis if 'localstack-websockets' in a['Name']][0] - url = api['ApiEndpoint'] + # Connect to the deployed stage: an endpoint without a stage path is rejected + stage = client.get_stages(ApiId=api['ApiId'])['Items'][0]['StageName'] + url = '%s/%s' % (api['ApiEndpoint'], stage) print('Connecting to websocket URL %s' % url) asyncio.get_event_loop().run_until_complete(start_client(url)) result = queue.get(timeout=3) From 6f87c63af756abd9b53bfd9696b477ca2203ba52 Mon Sep 17 00:00:00 2001 From: Harsh Mishra Date: Thu, 15 Oct 2026 19:29:25 +0530 Subject: [PATCH 8/8] Return a proxy response from the WebSocket handler The handler returned the raw event, which isn't a valid Lambda proxy response; LocalStack now rejects the connection with HTTP 502, as AWS does. Return statusCode 200 and echo the message body, which API Gateway sends back to the client on routes with a route response. Claude-Session: https://claude.ai/code/session_01DZfDmzUBPqNAu3yFKyfCNM --- serverless-websockets/handler.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/serverless-websockets/handler.js b/serverless-websockets/handler.js index 16452969..0c6341c6 100644 --- a/serverless-websockets/handler.js +++ b/serverless-websockets/handler.js @@ -1,8 +1,11 @@ module.exports.handler = function(event, context, callback) { - console.log('lambda event:', event, callback, context); - if(callback) { - callback(null, event); - } else { - context.succeed(event); - } + console.log('lambda event:', event); + // WebSocket proxy integrations must return a status code. On routes with a route + // response, API Gateway sends the body back to the client, so echo the message. + const response = { statusCode: 200, body: event.body || '' }; + if (callback) { + callback(null, response); + } else { + context.succeed(response); + } };