Overview
Thefjall destroy command removes AWS resources created by Fjall. It handles both organisation-level destruction and application teardown, ensuring resources are removed in the correct order.
Usage
Destruction Types
Organisation Destruction
Remove AWS organisation infrastructure:- Service control policies
- Organisational units
- AWS Organization (if empty)
- Cost allocation tags
Platform Destruction
Remove platform infrastructure:- SSO configuration
- Shared services
- IPAM pools
- Transit gateways
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
| Option | Description | Example |
|---|---|---|
-v, --verbose | Show detailed destruction logs | fjall destroy -v |
--np, --no-prompt | Skip confirmation prompts | fjall destroy --np |
--platform | Destroy platform infrastructure | fjall destroy --platform |
--account | Destroy account infrastructure | fjall destroy --account |
--target <target> | Non-interactive destruction | fjall destroy --target app |
--confirm | Auto-confirm destruction | fjall destroy --confirm |
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
Dependency Protection
Fjall prevents accidental deletion:- Won’t delete organisation with active accounts
- Won’t delete platform with active applications
- Checks for external dependencies
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 command again
- Manual deletion - Use AWS Console as last resort
Best Practices
- Always backup data - Export databases before destruction
- Destroy dev first - Test in non-production environments
- Review resources - Use
fjall listto see what exists - 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
Next Steps
After destruction:- Verify cleanup: Check AWS Console
- Review costs: Ensure billing stops
- Remove local files:
rm -rf fjall/appif needed
CloudFormation stacks can take 5-10 minutes to delete completely. Monitor progress in the AWS Console if needed.