npx env

Read and write environment variables that are made immediately available to all deployed Lambda functions. Sensitive configuration data, such as API keys, needs to happen outside of the codebase in revision control and you can use this tool to ensure an entire team and the deployment targets are in sync.

Example Usage

  • npx env displays environment variables for the current .arc
  • npx env staging FOOBAZ somevalue writes env variable FOOBAZ=somevalue to staging Lambdas
  • npx env remove testing FOOBAZ removes a testing env var
  • npx env verify display a report of Lambdas and their env variables

Things to note

  • Adding and removing variables automatically syncs all lambdas and the current working directory .arc-env
  • NODE_ENV, ARC_APP_NAME and SESSION_TABLE_NAME are reserved
  • There is no performance impact to your app; these variables are synchronized every write and immediately available to all Lambdas defined by the current .arc file

Currently .arc uses AWS Systems Manager Parameter Store as a centralized backing storage mechanism for app environment variables. Read more about AWS Systems Manager Parameter Store.

The .arc-env File

This file should not be commited into your project git repository.

  • Generated by adding or removing env vars using npx env
  • Automatically read by arc-sandbox and populates process.env when npx sandbox runs locally
  • Lists env vars for testing or staging for local dev

This is an example file:

# example .arc-env
@testing 
GLOBAL asdfasdf

@staging
GLOBAL_KEY val