Please ensure you’ve completed:
Introduction
As your application grows, you’ll need to add more resources. Fjall makes it easy to extend your infrastructure with additional databases, compute services, and more.
Adding Storage Resources
Add a Database
Add a new database to your application:
fjall add storage:aurora --app app
Interactive prompts:
Found existing compute resources. Configure database access for them? Yes
? Select compute resources to connect:
◉ AppCompute
◯ AppWorker
Storage Options
Type Command Use Case Aurora storage:auroraProduction databases Instance storage:instanceStandard RDS instances FreeTier storage:freetierFree tier eligible database
Multiple Databases
Applications can have multiple storage resources:
# Primary database
fjall add storage:aurora --app app --name Primary
# Analytics database
fjall add storage:aurora --app app --name Analytics
# Secondary database
fjall add storage:instance --app app --name Secondary
Adding Compute Resources
Add a Lambda Function
fjall add compute:lambda --app app
Prompts:
? Function name: ImageProcessor
? Runtime: Node.js 20.x
? Memory ( MB ): 1024
? Timeout ( seconds ): 300
? Connect to storage ? Yes
? Select storage: appStorage
Add an ECS Service
fjall add compute:ecs --app app
Options:
? Service name: BackgroundWorker
? Container type:
❯ Fargate (Serverless)
EC2 (More control )
Spot (Cost-optimised)
? CPU: 512
? Memory ( MB ): 1024
? Connect to storage ? Yes
Compute Options
Type Command Use Case Lambda compute:lambdaEvent processing, APIs ECS compute:ecsLong-running services EC2 compute:ec2Full server control
Resource Connections
Automatic Configuration
When adding resources, Fjall automatically:
Configures security groups - Opens required ports
Sets environment variables - Connection strings
Manages secrets - Database passwords
Updates IAM roles - Required permissions
Environment Variables
Connected resources receive environment variables:
# First database
DATABASE_HOST = app-db.cluster-xxx.amazonaws.com
DATABASE_PORT = 5432
DATABASE_NAME = AppDatabase
DATABASE_PASSWORD =< from-secrets-manager >
# Additional databases get numbered suffixes
DATABASE_HOST_1 = analytics-db.cluster-xxx.amazonaws.com
DATABASE_PORT_1 = 5432
DATABASE_NAME_1 = AnalyticsDB
DATABASE_PASSWORD_1 =< from-secrets-manager >
Advanced Examples
Microservices Architecture
Build a complete microservice setup:
# API Gateway
fjall add compute:lambda --app app --name APIGateway
# Authentication Service
fjall add compute:ecs --app app --name AuthService
# User Database
fjall add storage:aurora --app app --name UserDB
# Session Cache
fjall add storage:dynamodb --app app --name SessionCache
Data Pipeline
Create a data processing pipeline:
# Data ingestion
fjall add compute:lambda --app app --name DataIngestion
# Processing cluster
fjall add compute:ecs --app app --name DataProcessor --subtype spot
# Data warehouse
fjall add storage:aurora --app app --name DataWarehouse
Non-Interactive Mode
Add resources without prompts:
# Add Aurora database
fjall add storage:aurora \
--app app \
--name Analytics \
--size db.r5.large
# Add Lambda function
fjall add compute:lambda \
--app app \
--name Processor \
--runtime nodejs20.x \
--memory 512
Deployment After Adding
After adding resources, deploy the changes:
Fjall will show what’s being added:
Resources to create:
+ AWS::RDS::DBCluster (Analytics)
+ AWS::Lambda::Function (Processor)
+ AWS::EC2::SecurityGroup (2)
Resources to update:
~ AWS::ECS::TaskDefinition (environment variables )
Managing Resources
List Resources
View all resources in your application:
Output:
app:
Compute:
- appCompute (ECS/Fargate) ✅
- ImageProcessor (Lambda) ✅
- BackgroundWorker (ECS/Spot) ✅
Storage:
- appStorage (Aurora) ✅
- Analytics (Aurora) ✅
- Cache (DynamoDB) ✅
View Resource Details
Get specific resource information:
fjall view config --app app
Best Practices
Plan connections - Think about which resources need to communicate
Use descriptive names - Makes resources easy to identify
Consider costs - Use appropriate instance sizes
Test incrementally - Add and deploy one resource at a time
Cost Optimisation
Development Resources
Use cost-effective options for development:
# Free tier database
fjall add storage:freetier --app app
# Spot instances for compute
fjall add compute:ecs --app app --subtype spot
Production Resources
Balance performance and cost:
# Aurora Serverless for variable loads
fjall add storage:aurora --app app --serverless
# Auto-scaling compute
fjall add compute:ecs --app app --min 1 --max 10
Next Steps
Now that you’ve extended your application:
Monitor performance with fjall view metrics --app app
Check costs with fjall view cost --app app
View logs with fjall view logs --app app
Resources can be added at any time. Fjall handles all the complex networking and security configuration automatically.