Skip to main content

Ephemeral Environments

Ephemeral environments are temporary deployment targets defined in your pipeline YAML. They enable ad-hoc testing and agentic integrations by providing lock-based, on-demand environments that run the same deployment steps as your regular stages.

Configuration

Add an ephemeral_environments block to your pipeline definition:

pipeline:
ephemeral_environments:
pr-env:
triggers:
- on: pull_request
target_branches: ["feat-*", "fix-*"]
release:
- on: pr_closed
- on: timeout
after_idle_hours: 24
on_release: deploy_main
account_id: "123456789012"
region: us-west-2
skip: ["1 Minute Bake"]
vars:
env: test

agent-env:
triggers:
- on: api
release:
- on: api
- on: timeout
after_idle_hours: 1
on_release: deploy_main
account_id: "123456789012"
region: us-west-2
vars:
env: test

Trigger Types

TriggerDescription
pull_requestTriggered when a PR is opened or updated targeting matching branches
apiTriggered via the API or MCP tools

Pull Request Triggers

When on: pull_request is configured, specify target_branches with patterns to match against the PR's target branch. Supports wildcard matching with *.

API Triggers

When on: api is configured, users can claim sessions and deploy commits via the REST API or MCP tools.

Release Conditions

ConditionDescription
pr_closedRelease when the associated PR is closed or merged
apiRelease via API call
timeoutRelease after idle period (requires after_idle_hours)

Lock Behavior

Each ephemeral environment supports a single active lock at a time. When a lock is active:

  • The environment is "claimed" by a PR or API session
  • Deployments can only be triggered by the lock holder
  • Other callers receive a contention error (with option to force-claim)
  • Activity updates the idle timeout timer

Fields

FieldRequiredDescription
triggersYesArray of trigger configurations
releaseYesArray of release conditions
on_releaseYesAction on release (deploy_main)
account_idYesAWS account ID for deployment
regionYesAWS region for deployment
varsNoStage-specific variables
skipNoSteps to skip in this environment