Console
belt console (alias: belt c) starts an interactive Ruby session with your
application fully loaded — models, configuration, AWS clients, everything.
Basic Usage
belt console # uses BELT_ENV or defaults to 'dev'
belt c prod # specify environment
belt c dev01 # any environment name
What Gets Loaded
lambda/config/environment.rb— your app's boot file (AWS setup, models, libs)- IRB starts with
reload!available .irbrcfrom project root (optional console customization)
Runner Mode
Execute a command and exit (useful for scripts/CI):
belt c dev01 --run "Customer.first"
belt c prod --run "Post.count"
belt c dev01 --run "User.where(status: 'active', index: 'StatusIndex').count"
Production Safety
When the environment is prod, Belt shows a confirmation prompt before
starting the console. This prevents accidentally running destructive commands
against production data.
Common Tasks
# Find a record
post = Post.find("post-id-123")
# Query with index
users = User.where(status: "active", index: "StatusIndex")
# Create a record
Post.create!(title: "Test", body: "Hello", user_id: "u-123")
# Count records
Order.count
# Reload code changes
reload!
Environment Resolution
Priority order:
- Explicit argument:
belt c prod BELT_ENVenvironment variable- Default:
dev
See Also
belt explain models— ActiveItem query methodsbelt explain structure— where environment.rb lives