Global Environment Variables

Environment Variables

You can configure environment variables both for projects and globally on the Platform. These key-value pairs are kept in encrypted storage and injected into your analysis at runtime. The primary purpose of this feature is to help you avoid checking sensitive information (like a database password) into your Git repo.

You can use these environment variables like you would in any other analysis. For example, if you create an environment variable on the Platform with key REDSHIFT_PASSWORD and value im_secure, you can run the following example in Python:

import os
print os.environ['REDSHIFT_PASSWORD']
>>> im_secure

There are a few rules to remember when using environment variables:

  • Environment variables are injected once into your analysis when you launch it. You must shut down and re-launch any analyses to access new variables.
  • If you need to edit an existing environment variable, you must delete it and create a new one.
  • If a global environment variable and a project environment variable share the same key, the project environment variable will take precedence.

Global Environment Variables

Admins can create global environment variables and assign them to users or teams. To create a global environment variable, navigate to Settings from the top right avatar drop-down and click Environment Variables. Click Add New and fill in the key, value, description, and users that can access this variable.

Warning

If you don’t assign a global environment variable to any Users, it will be shared with all Users on the Platform by default.

../_images/users-env-var-1.png

After creating a global environment variable, you can manage access to it by hovering over its row in the table and selecting the View Details button. button. From this page, click Edit to add new Users. To remove a User, hover over the User’s row and click the Remove button that appears.

Any User with the standard role can see the list of global environment variables but cannot create or delete global environment variables.

For information about Project Environment variables, see the Projects section.