Docs

Environment Variables

Configuration and secrets for your functions.

Setting Variables

const api = new alien.Function("api")
  .environment({
    LOG_LEVEL: "info",
    API_ENDPOINT: "https://api.example.com",
  })
  .build()

These are available as regular environment variables at runtime.

Secrets

Credentials like API keys and database passwords are stored in the cloud's vault service (SSM, Secret Manager, Key Vault) — never in logs or config files. They're configured per-deployment when onboarding customers, not in alien.ts.

For secrets your app manages at runtime, use a Vault resource.

Per-Deployment Overrides

Different customers often need different values. Override per deployment:

alien deployments set-env --deployment acme-prod LOG_LEVEL=warn

Built-In Variables

Alien injects automatically:

VariableDescription
ALIEN_DEPLOYMENT_TYPEPlatform: aws, gcp, azure
ALIEN_{NAME}_BINDINGConnection parameters for each linked resource

The ALIEN_*_BINDING variables are how your code discovers resources. See Accessing Resources.

On this page