Skip to main content

Overview

fjall import adopts an existing AWS resource into a Fjall application. It reads the live resource configuration from the AWS API, writes the matching CDK code into your application’s infrastructure.ts, then runs a CloudFormation import so the resource comes under Fjall management without being recreated or replaced. If any step fails, Fjall restores infrastructure.ts to its previous contents before returning the error.
Discovery scans S3 buckets unless you name another type with --resource-type. Adoption currently generates code for S3 buckets only. Selecting any other type fails with UNSUPPORTED_RESOURCE_TYPE and nothing is written.

Prerequisites

  • A connected AWS account. Run fjall connect first.
  • A Fjall application in the project, with an infrastructure.ts file.
  • The resource lives in the account and region the active deployment target resolves to. Use --region for a bucket in another region.

Usage

Options

--resource-name is read on the manual path only. Automatic discovery derives the construct name from the discovered resource. A resource name must start with a letter, contain letters and digits only, and stay within 63 characters.

Agent flags

These flags shape output for AI-agent and scripted callers.

Basic usage

Discover S3 buckets in the connected account and pick one in the interactive UI:
Adopt one named bucket with no prompts:
Discover without changing anything. Agent mode runs a dry run unless you pass --yes:
Apply from agent mode:

Interactive flow

Running fjall import in a terminal opens the Ink UI. Flags pre-fill answers and skip the matching prompts.
1

Select an application to import resources into

Skipped when you pass -a, --app.
2

What resources would you like to discover?

Choose Network, Storage, or Compute.
3

Select the specific resource type to import

Network offers VPC. Storage offers S3, RDS and ElastiCache. Compute offers Lambda, ECS and EC2. Skipped when you pass -t, --resource-type.
4

Discovering Resources

A progress view runs Validating application, Initialising AWS context, Discovering AWS resources.
5

Select the resources you want to import

A multi-select list of what discovery found. Use the arrow keys to navigate, space to select, enter to confirm.
6

Import these resources?

A review list shows Application, Discovery Mode, Resource Type and the number of resources, followed by one confirmation.
7

Import Complete!

The seven-step import runs, then the screen suggests fjall deploy.
There is no dry run in the interactive flow. --yes changes nothing here, it applies to agent mode only.

What happens on apply

  1. Validating application confirms the application exists in the project.
  2. Initialising AWS context resolves credentials for the target account and region.
  3. Discovering S3 buckets reads the live bucket configuration.
  4. Generating infrastructure code inserts the storage constructs into infrastructure.ts.
  5. Synthesising CloudFormation templates runs a CDK synth over the edited file.
  6. Adopting resources into CloudFormation state runs the CloudFormation import.
  7. Verifying import runs a drift check against the deployed stack.
A drift warning naming a missing BucketPolicy helper resource after step 7 is expected. Fjall adds that resource on the next deploy. Review any other difference before you deploy. A failure at any step rolls infrastructure.ts back to its pre-import contents.

Discovery modes

Adopt a bucket by ID with manual discovery:

Resource types

Omitting --resource-type scans s3, which is also the only type adoption supports. Name another type to survey what is in the account, knowing the results cannot yet be applied.

Common errors

After the import

Review the generated constructs in infrastructure.ts, then deploy so CloudFormation reconciles the adopted resource with the stack:
For restoring data from a snapshot or recovery point instead of adopting a live resource, see fjall restore.

Next Steps

fjall deploy

Deploy the adopted resource so CloudFormation reconciles the stack.

fjall add

Declare a new resource in your application’s infrastructure.

fjall restore

Restore data from a snapshot or recovery point.

fjall connect

Connect the AWS account that holds the resource.