Pre-Requisites
Pre-Requisites
Complete these first:
- Deploy Application at least once locally
- A CI deploy token (minted in the web app under Settings → CI/CD Tokens), or AWS credentials configured for your CI environment
Introduction
The Fjall CLI runs in CI/CD pipelines without extra configuration. When it detects a non-interactive environment (no TTY), it switches to plain text output and returns standard exit codes. Official plugins cover GitHub Actions and Buildkite. For any other CI system, install and invoke the CLI directly. Pipelines authenticate with a CI deploy token (see below). The token doubles as the pipeline’s AWS credential: the CLI exchanges it for short-lived, deploy-scoped AWS credentials in your connected account, so you don’t need to store AWS keys in CI at all.CI Deploy Tokens
Fjall issues three kinds of token. Only one belongs in a pipeline:
A CI deploy token carries a fixed, least-privilege scope set:
read, deploy, and deploy:oidc:mint. That is enough to run deploys and mint short-lived AWS sessions, and nothing more — it cannot manage team members, tokens, or organisation settings. The scopes are stamped at creation and cannot be widened.
Deploy tokens expire within 90 days. The cap is enforced by the web-app mint form and by the API, which rejects a longer expiry regardless of client. Rotate before expiry by minting a replacement and updating your CI secret.
Minting and Managing Tokens
Minting a deploy token is admin-equivalent (it grants the org-wide AWS deploy path), so it requires an interactive browser session: an owner or admin mints it in the web app under Settings → CI/CD Tokens, optionally restricted to one application or environment. The token is shown once — store it as a CI secret immediately. API-key-authenticated callers, including the CLI itself, cannot mint deploy tokens. Everything after the mint works from the CLI:FJALL_API_KEY in your CI provider’s secrets.
Workflow Setup
fjall ci setup --plan reports the CI provider, repository, and application it detects, plus the path of the workflow file it would write — it prints no file contents, mints nothing, and writes nothing. fjall ci verify dry-runs the auth handshake — credential, principal kind, expiry runway, and application access — before your first pipeline run:
fjall ci setup without --plan attempts to mint the deploy token before it
writes anything, and the API only permits minting from an interactive browser
session — so the command fails with guidance and writes no workflow file.
Mint the token in the web app (Settings → CI/CD Tokens) and copy the
workflow YAML from the examples on this page.GitHub Actions
Thefjall-tech/fjall-deploy-action is a composite action that installs the CLI and runs it with the right flags.
Minimal Workflow (Recommended)
A CI deploy token is the only secret you need. The CLI exchanges it for short-lived AWS credentials scoped to the deploy, and the run is recorded in your Fjall dashboard:FJALL_API_KEY repository secret. Your AWS account must already be connected to Fjall.
With AWS OIDC
If you prefer AWS-native credential management, use GitHub’s OIDC provider to assume an IAM role — no long-lived secrets to rotate:With Static AWS Credentials
Store AWS keys as repository secrets. Simplest to set up, but the keys are long-lived and need rotation:Split Infrastructure and Code Deploys
Run infrastructure changes and code deploys as separate jobs for faster iteration:Action Inputs
The action is a thin shim ontofjall ci run: every input maps 1:1 to a CLI flag, and the CLI owns command and flag validation.
Action Outputs
A
plan run with pending changes exits 2 (surfaced as result: plan-pending), so a plan→approve→apply pipeline can branch on it without treating it as a failure.
The
environment input is a free-form label for your own CI/CD logic. It does not select an AWS account or region. The deploy account is chosen by the active deployment target (fjall target set), and the region by your AWS credentials or the region setting.cli-version defaults to 7 — the CLI major this plugin release is built
for, and the same major as current @fjall/components-infrastructure
releases. Set it to auto to derive the major from your app’s constructs pin
instead, or to an exact version you’ve validated locally (fjall --version).
Avoid latest: it floats across releases, and if it drifts behind your
app’s constructs the deploy is refused by the engine compatibility
check.Buildkite
Thefjall-tech/fjall-deploy-buildkite-plugin installs the CLI and runs it with the right flags.
Minimal Pipeline
FJALL_API_KEY through your Buildkite secrets storage (for example the S3 secrets plugin or your agent environment hooks). The same tracking caveat applies as on GitHub Actions: without it, deploys run but are invisible to Fjall. The cli-version guidance above applies here too.
With AWS OIDC
Staging to Production Pipeline
Plugin Properties
The plugin is a thin shim ontofjall ci run and accepts the same surface as the GitHub action. build-args and build-secrets are YAML arrays of strings rather than newline-separated blocks:
The plugin records
fjall-deploy:result, fjall-deploy:duration, and any fjall-deploy:approval-token as build meta-data (buildkite-agent meta-data get fjall-deploy:result), and a plan-pending run adds a warning annotation to the build.
Raw CLI Usage (Any CI System)
If you’re using a different CI system (GitLab CI, CircleCI, Jenkins, etc.), install and invoke the CLI directly.Setup
fjall ci run <deploy|destroy|build> <target> is the single CI entry point — the same command both official plugins invoke under the hood. It forces non-interactive output and skips confirmation prompts, and rejects flags that don’t apply to the command you’re running (for example, deploy-only flags on a destroy).
Key Flags
Invoking
fjall deploy api --non-interactive --skip-confirmation directly still works; fjall ci run wraps the same engine with CI-safe defaults.
Exit Codes
Exit
4 means the deploy stopped at the destruction gate. It is a decision, not a failure, and the cure depends on the outcome printed with the ticket. When consent was withheld, surface the printed ticket to a human and re-run with the named consents once reviewed (ideally minted from a --plan run and bound with --destruction-consent-digest). A consented pin has already written the config change: commit it and re-run without re-supplying the consent. A declined, invalid, or not-yet-executable consent prints what to change. Always follow the printed cure.
Environment Variables
Example: GitLab CI
Example: CircleCI
FJALL_API_KEY as a project secret in either system.
Setting Up AWS Credentials
Whichever CI system you use, the Fjall CLI needs AWS credentials to deploy. Here are the common approaches, from most to least recommended:Fjall Deploy Token (Recommended)
SetFJALL_API_KEY to a CI deploy token and skip AWS credential setup entirely. The CLI exchanges the token for short-lived, deploy-scoped AWS credentials in your connected account, and every run is tracked in your dashboard.
AWS OIDC Federation
Most CI systems support OIDC federation with AWS. This avoids storing long-lived secrets:- Create an IAM OIDC identity provider for your CI system
- Create an IAM role with a trust policy scoped to your repo/pipeline
- Use your CI’s OIDC integration to assume that role
Static Credentials
StoreAWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY as CI secrets. Simpler to set up but requires key rotation.
Instance Profiles
When your CI agents run on EC2 (for example, self-hosted Buildkite agents), attach an IAM instance profile with the required permissions. No credential management needed.Next Steps
Deploy an Application
Run a full deploy locally before wiring it into CI/CD.
deploy Command Reference
Every
fjall deploy flag, target, and option.Understanding Profiles
How Fjall derives AWS profiles and selects the deploy target.
Configure a Deployment User
Scope the IAM role your pipeline assumes.