From 6a16d0b143592121db661744f3d45f839077f925 Mon Sep 17 00:00:00 2001 From: Harsh Mishra Date: Fri, 6 Mar 2026 01:49:05 +0530 Subject: [PATCH] Add LocalStack auth token requirement and standardize setup - Add Prerequisites section with license requirement bullet - Create Makefile with start/stop/ready/logs targets and auth guard - Add Start LocalStack section to README --- Makefile | 33 +++++++++++++++++++++++++++++++++ README.md | 17 +++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b8b2fa3 --- /dev/null +++ b/Makefile @@ -0,0 +1,33 @@ +export AWS_ACCESS_KEY_ID ?= test +export AWS_SECRET_ACCESS_KEY ?= test +export AWS_DEFAULT_REGION=us-east-1 +SHELL := /bin/bash + +usage: ## Show this help + @fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$//' | sed -e 's/##//' + +install: ## Install dependencies + @which localstack || pip install localstack + @which awslocal || pip install awscli-local + @which cdklocal || npm install -g aws-cdk-local aws-cdk + +start: ## Start LocalStack + @test -n "${LOCALSTACK_AUTH_TOKEN}" || (echo "LOCALSTACK_AUTH_TOKEN is not set. Find your token at https://app.localstack.cloud/workspace/auth-token"; exit 1) + @LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) localstack start -d + +stop: ## Stop LocalStack + @localstack 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) + +logs: ## Save the logs in a separate file + @localstack logs > logs.txt + +deploy: ## Deploy infrastructure using CDK + npm install + cdklocal bootstrap aws://000000000000/us-east-1 + cdklocal deploy --require-approval never + +.PHONY: usage install start stop ready logs deploy diff --git a/README.md b/README.md index e426f5b..0e6ecf3 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,23 @@ # Welcome to your CDK TypeScript project The `cdk.json` file tells the CDK Toolkit how to execute your app. +## Prerequisites + +- A valid [LocalStack for AWS license](https://localstack.cloud/pricing). Your license provides a [`LOCALSTACK_AUTH_TOKEN`](https://docs.localstack.cloud/getting-started/auth-token/) to activate LocalStack. +- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli) +- [Node.js](https://nodejs.org/en/download/) with NVM (Node Version Manager) +- [AWS CDK](https://docs.localstack.cloud/user-guide/integrations/aws-cdk/) with the [`cdklocal`](https://www.npmjs.com/package/aws-cdk-local) wrapper + +## Start LocalStack + +Start LocalStack with the `LOCALSTACK_AUTH_TOKEN` pre-configured: + +```shell +export LOCALSTACK_AUTH_TOKEN= +make start +make ready +``` + # Setup 1. Install Node Version Manager (NVM) https://github.com/nvm-sh/nvm#installing-and-updating