| title | arc env | ||||||
|---|---|---|---|---|---|---|---|
| category | CLI | ||||||
| description | Read and write environment variables for Lambda functions. | ||||||
| sections |
|
Manage environment variables for your Architect application across different environments. This command allows you to read, add, and remove environment variables that will be available to your Lambda functions at runtime.
When run without any flags, this command will print out all environment variables and their values, across all environments.
Environment variables are stored in AWS SSM Parameter Store for staging and production environments. For local development (testing environment), variables are stored in your project's preferences.arc file or .env file if one exists.
arc envwill not upload variables from a project's local preferences file; however, it will download variables from AWS and overwrite local preference entries.
💁
stagingenvironment variables are also used in named deployments created witharc deploy --name <name>.
arc env [flags] [VARIABLE_NAME] [VARIABLE_VALUE]-e,--env <environment>: Specify environment (testing,staging, orproduction)-a,--add: Add a new environment variable-r,--remove: Remove an environment variable-v,--verbose: Print more detailed output-d,--debug: Print even more detailed information for debugging
It is imperative that the ARC_APP_SECRET environment variable be set to a strong secret - especially in your production environment! It must have a minimum length of 32 bytes. This secret is used to encode HTTP sessions if you use the @architect/functions runtime helpers.
The following environment variable names are reserved for Architect use and cannot be set in an app:
ARC_ENVARC_APP_NAMEARC_SESSION_TABLE_NAME
A function can be configured with a config.arc to not load local environment variables.
arc envarc env --env stagingVariable values that contain special characters like email addresses should be wrapped in double quotes
arc env --add --env staging SECRET_API_PASSWORD "p@s5w0rd!"arc env --remove --env staging SECRET_API_PASSWORD