Skip to content

Latest commit

 

History

History
70 lines (43 loc) · 2.31 KB

File metadata and controls

70 lines (43 loc) · 2.31 KB

Running Locally with LocalStack

The ./run local command allows you to run our application locally on your laptop using LocalStack, simulating the AWS cloud environment (except using cognito authentication from the real AWS).

Prerequisites

Before running the application locally, ensure the following dependencies are installed and running:

Required Installations

  1. Colima/Docker - LocalStack runs inside a Colima container that uses docker as it's runtime.

The install is handled by the run script.

Links for the curious:

  1. LocalStack - Provides a local AWS emulating environment.

The install is handled by the run script.

  1. AWS CLI Local - Required for interacting with LocalStack.

The install is handled by the run script.

Deploying and Running Locally

# in a new terminal window
./run local

The script will verify that both Docker, Colima, and LocalStack are running before proceeding. If any service is unavailable, the script will exit with a helpful error.

Monitoring LocalStack

You can monitor your LocalStack instance via:

First off, sign up for a free account: LocalStack Cloud without checking the "14 day free trial" checkbox

Then open this: LocalStack Cloud Dashboard

Accessing Lambda Environment Variables (not included in the dashboard)

Per usual env variables are available inside the lambda via process.env.NAME_OF_VARIABLE.

But if you want to query to see what environment variables a lambda is being given, you can always run queries directly at your local aws like this:

Getting setup

# this may or may not work for you
# you've got to have some way to pip install or pip3 install or pipx install
brew install pipx
# then you need this package
pipx install awscli-local
# doublecheck you got it
awslocal --version

Using the tool

# example of something you'd pop in as YOUR_FUNCTION_NAME => app-api-localstack-getUserById
awslocal lambda get-function-configuration --function-name YOUR_FUNCTION_NAME --query "Environment.Variables"