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:- Identity Centre configuration
- Account references
--no-cascade to destroy only the organisation stack.
Platform Destruction
Remove platform infrastructure:- IPAM pools
- Shared networking
Account Destruction
Remove per-account foundation resources:- CloudTrail trails
- EventBridge rules
- ECR repositories
- Backup vaults
Application Destruction
Remove a specific application:- Load balancers
- Application services (ECS, Lambda)
- Databases (after confirmation)
- Networking resources
- Security groups
Interactive Mode
Run without arguments for guided destruction:Options
Arguments
The destroy command accepts a positional argument for specifying the target:Aliases
destroy has one alias, delete:
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 theorganisation 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:- Application services
- Load balancers
- Databases (with extra confirmation)
- Network resources
- Base infrastructure
Examples
Destroy Application
Destroy Organisation Infrastructure
Verbose Destruction
Common Issues
Resources Not Deleting
-
Stack DELETE_FAILED
Fix: Check CloudFormation console for specific resource blocking deletion
-
Non-empty S3 Buckets
Fix: Empty bucket manually or use AWS Console
-
RDS Deletion Protection
Fix: Disable deletion protection in RDS console first
Manual Cleanup
If automatic destruction fails:- Check CloudFormation: view specific errors
- Remove blockers: empty S3 buckets, disable protections
- Retry destruction: run the command again
- Manual deletion: use the AWS Console as a last resort
Best Practices
- Back up data first: export databases before destruction
- Destroy non-production first: test the teardown in staging
- Review resources: run
fjall list -a apito see what an application declares - Use verbose mode: add
-vto see detailed progress
Data Preservation
Before Destroying Databases
-
Create snapshots:
-
Export data:
-
Verify backups:
- Check RDS snapshots exist
- Confirm S3 bucket contents copied
- Save any CloudWatch logs needed
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.