Skip to main content
Destructive command. This permanently deletes AWS resources. Back up data first.

Overview

fjall destroy removes AWS resources created by Fjall. It handles organisation-level teardown and application teardown, removing resources in the correct dependency order.

Usage

Destruction Types

Organisation Destruction

Remove AWS organisation infrastructure:
This removes:
  • Identity Centre configuration
  • Account references
By default, destroying the organisation cascades to the platform and every member account. Pass --no-cascade to destroy only the organisation stack.

Platform Destruction

Remove platform infrastructure:
This removes:
  • IPAM pools
  • Shared networking

Account Destruction

Remove per-account foundation resources:
This removes:
  • CloudTrail trails
  • EventBridge rules
  • ECR repositories
  • Backup vaults

Application Destruction

Remove a specific application:
This removes:
  • Load balancers
  • Application services (ECS, Lambda)
  • Databases (after confirmation)
  • Networking resources
  • Security groups

Interactive Mode

Run without arguments for guided destruction:
Fjall asks what to destroy, then which target, then confirms:
Choosing Organisation opens a second picker (organisation, platform, or account). Selecting organisation then asks whether to cascade to the platform and every member account.

Options

Arguments

The destroy command accepts a positional argument for specifying the target:

Aliases

destroy has one alias, delete:
fjall remove is not a destroy alias. It is the codemod command that removes a single resource from an application’s infrastructure.ts source file. It does not delete any deployed AWS resources. See fjall add for the codemod engine.

Destruction Process

1. Pre-destruction Checks

Fjall validates:
  • AWS credentials are valid
  • Target exists
  • No dependent resources exist
  • Data backup requirements

2. Resource Analysis

For each target:
  • Lists all resources to be deleted
  • Identifies dependencies
  • Checks for data that needs backup
  • Calculates destruction order

3. Confirmation

4. Destruction Execution

Fjall:
  • Deletes resources in reverse dependency order
  • Monitors CloudFormation stack deletion
  • Handles errors gracefully
  • Reports completion status

Safety Features

Confirmation Required

By default, Fjall requires explicit confirmation:
  • Shows all resources to be deleted
  • Warns about data loss
  • Requires typing ‘y’ to proceed

Cascade Control

Destroying the organisation target cascades to the platform and every member account by default. To destroy only the organisation stack, pass --no-cascade. The cascade confirmation prompt spells out exactly what will be removed before any deletion starts.

Order of Destruction

Resources are removed safely:
  1. Application services
  2. Load balancers
  3. Databases (with extra confirmation)
  4. Network resources
  5. Base infrastructure

Examples

Destroy Application

Destroy Organisation Infrastructure

Verbose Destruction

Common Issues

Resources Not Deleting

  1. Stack DELETE_FAILED
    Fix: Check CloudFormation console for specific resource blocking deletion
  2. Non-empty S3 Buckets
    Fix: Empty bucket manually or use AWS Console
  3. RDS Deletion Protection
    Fix: Disable deletion protection in RDS console first

Manual Cleanup

If automatic destruction fails:
  1. Check CloudFormation: view specific errors
  2. Remove blockers: empty S3 buckets, disable protections
  3. Retry destruction: run the command again
  4. Manual deletion: use the AWS Console as a last resort

Best Practices

  1. Back up data first: export databases before destruction
  2. Destroy non-production first: test the teardown in staging
  3. Review resources: run fjall list -a api to see what an application declares
  4. Use verbose mode: add -v to see detailed progress

Data Preservation

Before Destroying Databases

  1. Create snapshots:
  2. Export data:
  3. Verify backups:
    • Check RDS snapshots exist
    • Confirm S3 bucket contents copied
    • Save any CloudWatch logs needed
After destruction, verify cleanup in the AWS Console and confirm billing for the torn-down resources has stopped.
CloudFormation stacks can take 5-10 minutes to delete completely. Monitor progress in the AWS Console if needed.

Next Steps

fjall deploy

Redeploy an application or organisation infrastructure.

fjall list

Inspect the resources an application declares in infrastructure.ts.

fjall add

Edit infrastructure.ts with the codemod engine.

fjall restore

Restore data from a snapshot after teardown.