Configuration¶
AWS Cloud Utilities v2 provides flexible configuration options through environment variables, configuration files, and command-line options.
Configuration Methods¶
Configuration is loaded in this order (later sources override earlier ones):
- Default values
- Configuration file (
~/.aws-cloud-utilities.env) - Environment variables
- Command-line options
Interactive Configuration¶
The easiest way to configure the tool:
This will prompt you for: - AWS Profile - Default AWS Region - Output Format - Number of Workers
Configuration File¶
Create ~/.aws-cloud-utilities.env with your preferred settings:
# AWS Configuration
AWS_PROFILE=default
AWS_DEFAULT_REGION=us-east-1
AWS_OUTPUT_FORMAT=table
# Performance Settings
WORKERS=4
# Logging
LOG_LEVEL=INFO
VERBOSE=false
DEBUG=false
# Output Settings
SHOW_PROGRESS=true
COLOR_OUTPUT=true
Environment Variables¶
Set environment variables for temporary overrides:
# AWS settings
export AWS_PROFILE=production
export AWS_DEFAULT_REGION=eu-west-1
export AWS_OUTPUT_FORMAT=json
# Performance
export WORKERS=8
# Logging
export LOG_LEVEL=DEBUG
export VERBOSE=true
Command-Line Options¶
Override any setting with command-line options:
Configuration Options¶
AWS Settings¶
| Option | Environment Variable | Default | Description |
|---|---|---|---|
--profile |
AWS_PROFILE |
default |
AWS profile to use |
--region |
AWS_DEFAULT_REGION |
us-east-1 |
Default AWS region |
--output |
AWS_OUTPUT_FORMAT |
table |
Output format |
Performance Settings¶
| Option | Environment Variable | Default | Description |
|---|---|---|---|
| N/A | WORKERS |
4 |
Number of parallel workers |
| N/A | TIMEOUT |
30 |
Request timeout in seconds |
| N/A | RETRY_ATTEMPTS |
3 |
Number of retry attempts |
Logging Settings¶
| Option | Environment Variable | Default | Description |
|---|---|---|---|
--verbose |
VERBOSE |
false |
Enable verbose output |
--debug |
DEBUG |
false |
Enable debug mode |
| N/A | LOG_LEVEL |
INFO |
Logging level |
| N/A | LOG_FILE |
None | Log file path |
Output Settings¶
| Option | Environment Variable | Default | Description |
|---|---|---|---|
| N/A | SHOW_PROGRESS |
true |
Show progress bars |
| N/A | COLOR_OUTPUT |
true |
Enable colored output |
| N/A | TABLE_MAX_WIDTH |
120 |
Maximum table width |
AWS Profile Configuration¶
Using AWS CLI Profiles¶
Configure multiple profiles with AWS CLI:
# Configure default profile
aws configure
# Configure named profile
aws configure --profile production
Then use with the tool:
Profile-Specific Settings¶
Create profile-specific configuration files:
# ~/.aws-cloud-utilities-production.env
AWS_PROFILE=production
AWS_DEFAULT_REGION=us-east-1
WORKERS=8
LOG_LEVEL=WARNING
Load with:
Region Configuration¶
Default Region¶
Set a default region for all operations:
Multi-Region Operations¶
Some commands support multi-region operations:
# Inventory across all regions (the default when --regions is omitted)
aws-cloud-utilities inventory scan --output-dir ./inventory
# Specific regions
aws-cloud-utilities inventory scan --regions us-east-1,us-west-2,eu-west-1
Multi-region support is per-command and not uniform. Some commands take --all-regions as a flag
(s3 list-buckets, logs list-groups, iam-adjacent commands), others take a comma-separated
--regions list (inventory scan, cloudformation backup), and a few are single-region only
(rds list-instances). Check the command's page or --help rather than assuming.
Output Format Configuration¶
Supported Formats¶
table- Rich formatted tables (default)json- JSON outputyaml- YAML outputcsv- CSV format (for tabular data)
Format-Specific Settings¶
# Table format settings
TABLE_MAX_WIDTH=120
TABLE_SHOW_LINES=true
# JSON format settings
JSON_INDENT=2
JSON_SORT_KEYS=true
# CSV format settings
CSV_DELIMITER=,
CSV_QUOTE_CHAR="
Performance Tuning¶
Worker Configuration¶
Adjust parallel processing:
# More workers for faster processing (uses more resources)
WORKERS=8
# Fewer workers for limited resources
WORKERS=2
Timeout Settings¶
Configure timeouts for different operations:
# General timeout
TIMEOUT=30
# Long-running operations
LONG_OPERATION_TIMEOUT=300
# Connection timeout
CONNECTION_TIMEOUT=10
Retry Configuration¶
Configure retry behavior:
Logging Configuration¶
Log Levels¶
Available log levels:
- DEBUG - Detailed debugging information
- INFO - General information
- WARNING - Warning messages
- ERROR - Error messages only
Log File Configuration¶
# Enable file logging
LOG_FILE=/var/log/aws-cloud-utilities.log
# Log rotation
LOG_MAX_SIZE=10MB
LOG_BACKUP_COUNT=5
Structured Logging¶
Enable structured JSON logging:
Security Configuration¶
Credential Management¶
# Use IAM roles (recommended)
AWS_USE_IAM_ROLE=true
# Credential file location
AWS_SHARED_CREDENTIALS_FILE=~/.aws/credentials
# Config file location
AWS_CONFIG_FILE=~/.aws/config
Session Configuration¶
# Session duration
AWS_SESSION_DURATION=3600
# MFA settings
AWS_MFA_SERIAL=arn:aws:iam::123456789012:mfa/username
Validation¶
Validate your configuration:
# Check configuration
aws-cloud-utilities info
# Test AWS connectivity
aws-cloud-utilities account info
# Validate specific profile
aws-cloud-utilities --profile production account validate
Troubleshooting¶
Common Issues¶
-
Profile not found
-
Region not available
-
Permission errors
Debug Configuration¶
Enable debug mode to see configuration loading:
This will show: - Configuration file locations - Environment variables loaded - Final configuration values - AWS credential resolution
Best Practices¶
- Use profiles for different environments
- Set default region to avoid specifying it repeatedly
- Use configuration files for consistent settings
- Enable logging for troubleshooting
- Tune workers based on your system resources
- Use IAM roles instead of access keys when possible
Next Steps¶
- Quick Start - Start using the tool
- Command Reference - Explore available commands
- Examples - See real-world usage