AWS Resource Scanner & Cost Optimizer
Scan AWS resources across multiple Organizations, Accounts, and Regions to identify unused resources and optimize costs.
- Overview
- Features
- Getting Started
- Documentation
- Example Report
- AWS Permissions
- Contributing
- License
- Contact
CloudSift is a powerful Go-based utility that helps organizations optimize their AWS infrastructure and reduce cloud spending. By scanning multiple AWS Organizations, Accounts, and Regions, it provides comprehensive insights into resource utilization and costs.
CloudSift performs comprehensive scanning across various AWS services:
- EC2 Instances
- CPU and memory utilization analysis
- Attached EBS volume tracking
- Instance state monitoring
- EBS Volumes & Snapshots
- Unused volume detection
- Orphaned snapshot identification
- Cost optimization recommendations
- AMIs (Amazon Machine Images)
- Unused AMI detection
- Associated snapshot tracking
- Age-based analysis
- Cost impact calculation
- RDS Instances
- Database utilization metrics
- Idle instance detection
- Elastic IPs
- Unattached IP detection
- Usage patterns analysis
- Load Balancers (ELB)
- Classic and Application LB support
- Traffic pattern analysis
- Idle LB detection
- VPCs
- Resource utilization
- Default VPC identification
- Security Groups
- Unused group detection
- Rule analysis
- IAM Users & Roles
- Last access tracking
- Unused credential detection
- Service role analysis
- DynamoDB Tables
- Table usage metrics
- Provisioned vs actual capacity
- OpenSearch Domains
- Cluster utilization
- Resource optimization
CloudSift includes a sophisticated real-time cost analysis system:
- Live Cost Estimation
- AWS Pricing API integration
- Smart caching system
- Detailed cost breakdowns
- Multiple time period projections
- Resource lifetime calculations
- Support for all AWS regions and pricing tiers
-
Intelligent Rate Limiting
- Token bucket algorithm with 20 requests per second (RPS) default rate
- Exponential backoff with smart retry strategy
- Automatic rate adjustment based on API responses
- Comprehensive failure handling and recovery
-
High-Performance Worker Pool
- I/O optimized worker allocation
- Dynamic task distribution
- Real-time performance metrics
- Graceful shutdown handling
-
HTML Reports
- Interactive, modern UI
- Resource filtering and sorting
- Cost breakdown charts
- Detailed resource metadata
- Action recommendations
-
Flexible Output Options
- JSON for programmatic processing
- Text-based logging with multiple verbosity levels
- Optional S3 output storage
- AWS Credentials:
Configure your AWS credentials usingaws configureor set up the~/.aws/credentialsfile.
CloudSift can operate in either single-account or multi-account mode:
- Single-Account Mode: Only requires AWS credentials with appropriate permissions
- Multi-Account Mode: Requires organization roles and an S3 bucket for storing results
Choose one of the following setup methods for multi-account scanning:
If you prefer to set up the infrastructure manually or need customization, create:
- An Organization Role with permissions to list AWS Organization resources
- A Scanner Role that can be assumed in member accounts
- An S3 bucket with server-side encryption for storing scan results
The required permissions are detailed below.
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Resource": [
"arn:aws:iam::<account_id>:role/<scanner_role>"
]
},
{
"Action": [
"organizations:ListAccounts",
"organizations:DescribeAccount",
"ec2:DescribeRegions"
],
"Effect": "Allow",
"Resource": "*"
}
]
}The scanner role requires the AWS-managed ReadOnlyAccess policy and the following trust relationship:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::<organization_account_id>:role/<organization_role>"
},
"Action": "sts:AssumeRole"
}
]
}If you want to enable S3-based file output, the organization role must also have permissions to read and write to an S3 bucket. The following policy grants the necessary access to <bucket_name>:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObject",
"s3:ListBucket",
"s3:GetBucketLocation",
"s3:DeleteObject",
"s3:ListMultipartUploadParts",
"s3:ListBucketMultipartUploads"
],
"Resource": "arn:aws:s3:::<bucket_name>/*"
},
{
"Effect": "Allow",
"Action": "s3:ListBucket",
"Resource": "arn:aws:s3:::<bucket_name>"
}
]
}These S3 permissions are optional and only required if you intend to upload scan results to S3.
For convenience, we provide a CloudFormation template that automatically sets up all required infrastructure, including all the IAM roles and permissions detailed above. This is entirely optional and only needed for multi-account scanning.
The template creates:
- Organization Role: For querying organization-level resources
- Scanner Role: For reading resources in member accounts
- S3 Bucket: For storing scan results with server-side encryption
After deployment, note these outputs for use with CloudSift:
OrganizationRole: Use with--organization-roleScannerRole: Use with--scanner-roleBucketName: Use with--bucketBucketRegion: Use with--bucket-region
# Download latest release (replace VERSION with actual version)
curl -L -o cloudsift https://github.com/emptyset-io/cloudsift/releases/download/vVERSION/cloudsift_linux_amd64
chmod +x cloudsift
sudo mv cloudsift /usr/local/bin/CloudSift can be configured using command-line arguments, a YAML configuration file, or environment variables. The precedence order is:
- Environment Variables (highest)
- Configuration File (config.yaml)
- Command-Line Arguments (lowest)
To get started quickly, use the init command to create default configuration files:
# Create a default config.yaml in the current directory
cloudsift init config
# Create a default .env file in the current directory
cloudsift init env
# Create config files in custom locations
cloudsift init config --output /path/to/config.yaml
cloudsift init env --output /path/to/.envCloudSift provides commands to list various AWS resources and configurations:
# List available AWS credential profiles
cloudsift list profiles
# List AWS accounts in single-account mode
cloudsift list accounts
# List AWS accounts in organization mode
cloudsift list accounts --organization-role OrganizationRole
# List available resource scanners
cloudsift list scanners# Basic scan of current account
cloudsift scan
# Basic scan of all accounts in organization
cloudsift scan --organization-role OrganizationRole --scanner-role ScannerRole
# Scan specific resources in specific regions
cloudsift scan --scanners ebs-volumes,ec2-instances \
--regions us-west-2,us-east-1
# Scan organization with custom roles and S3 output
cloudsift scan --organization-role OrganizationRole \
--scanner-role ScannerRole \
--output s3 \
--bucket my-bucket \
--bucket-region us-west-2
# Ignore specific resources (case-insensitive matching)
cloudsift scan --ignore-resource-ids i-1234567890abcdef0,vol-0987654321fedcba \
--ignore-resource-names prod-server,backup-volume \
--ignore-tags "Environment=production,KeepAlive=true"
# Use a specific config file
cloudsift scan -c /path/to/config.yaml| Flag | Description | Default |
|---|---|---|
-c, --config |
Path to config file | "" |
-p, --profile |
AWS profile to use | default |
--organization-role |
Role for org access | "" |
--scanner-role |
Role for scanning | "" |
--log-format |
Log format (text/json) | text |
--log-level |
Log level (DEBUG/INFO/WARN/ERROR) | INFO |
--max-workers |
Maximum concurrent workers | 32 |
| Flag | Description | Default |
|---|---|---|
--profile |
AWS profile to use | default |
--regions |
Comma-separated list of regions | All regions |
--scanners |
Comma-separated list of scanners | All scanners |
--accounts |
Comma-separated list of account IDs to scan | "" (all accounts) |
--output |
Output type (filesystem, s3) | filesystem |
--output-format, -o |
Output format (json, html) | html |
--bucket |
S3 bucket for output | "" |
--bucket-region |
S3 bucket region | "" |
--organization-role |
Role for org access | "" |
--scanner-role |
Role for scanning | "" |
--days-unused |
Days threshold for unused resources | 90 |
--ignore-resource-ids |
Resource IDs to ignore | "" |
--ignore-resource-names |
Resource names to ignore | "" |
--ignore-tags |
Tags to ignore (KEY=VALUE) | "" |
All configuration options can be set via environment variables with the CLOUDSIFT_ prefix:
| Environment Variable | Description | Default |
|---|---|---|
CLOUDSIFT_AWS_PROFILE |
AWS profile to use | default |
CLOUDSIFT_AWS_ORGANIZATION_ROLE |
Role for organization access | "" |
CLOUDSIFT_AWS_SCANNER_ROLE |
Role for scanning accounts | "" |
CLOUDSIFT_APP_LOG_FORMAT |
Log format (text/json) | text |
CLOUDSIFT_APP_LOG_LEVEL |
Log level (DEBUG/INFO/WARN/ERROR) | INFO |
CLOUDSIFT_SCAN_REGIONS |
Comma-separated list of regions | "" (all regions) |
CLOUDSIFT_SCAN_SCANNERS |
Comma-separated list of scanners | "" (all scanners) |
CLOUDSIFT_SCAN_ACCOUNTS |
Comma-separated list of account IDs | "" (all accounts) |
CLOUDSIFT_SCAN_OUTPUT |
Output type (filesystem/s3) | filesystem |
CLOUDSIFT_SCAN_OUTPUT_FORMAT |
Output format (json/html) | html |
CLOUDSIFT_SCAN_BUCKET |
S3 bucket for output | "" |
CLOUDSIFT_SCAN_BUCKET_REGION |
S3 bucket region | "" |
CLOUDSIFT_SCAN_DAYS_UNUSED |
Days threshold for unused resources | 90 |
CLOUDSIFT_SCAN_IGNORE_RESOURCE_IDS |
Resource IDs to ignore (case-insensitive) | "" |
CLOUDSIFT_SCAN_IGNORE_RESOURCE_NAMES |
Resource names to ignore (case-insensitive) | "" |
CLOUDSIFT_SCAN_IGNORE_TAGS |
Tags to ignore in KEY=VALUE format (case-insensitive) | "" |
The config.yaml file can be placed in the following locations (in order of precedence):
- Current directory (
./config.yaml) - User's home directory (
$HOME/.cloudsift/config.yaml) - System-wide directory (
/etc/cloudsift/config.yaml)
Example configuration file:
aws:
profile: default # AWS profile to use (supports SSO profiles)
organization_role: "" # Role name to assume for organization-wide operations
scanner_role: "" # Role name to assume for scanning operations
app:
log_format: text # Log output format (text or json)
log_level: INFO # Set logging level (DEBUG, INFO, WARN, ERROR)
max_workers: 8
scan:
regions: # Leaving this list empty will scan all regions
- us-west-2
- us-east-1
scanners: # Leaving this list empty will execute all scanners
- ebs-volumes
- ec2-instances
accounts: # Leaving this list empty will scan all accounts
- 123456789012
- 098765432109
output: filesystem
output_format: html
bucket: ""
bucket_region: ""
days_unused: 90
# Ignore list configuration (all case-insensitive)
ignore:
resource_ids:
- i-1234567890abcdef0
- vol-1234567890abcdef0
resource_names:
- my-important-instance
- critical-data-volume
tags:
Environment: production # Will match "ENVIRONMENT: PRODUCTION"
KeepAlive: "true" # Will match "keepalive: TRUE"
Project: critical # Will match "PROJECT: CRITICAL"The cost estimation system provides real-time analysis using the AWS Pricing API:
- Live AWS Pricing with intelligent caching
- Comprehensive coverage of all AWS regions
- Detailed cost breakdowns (hourly/daily/monthly/yearly)
- Resource-specific calculations
- Location:
cache/costs.json - Thread-safe concurrent operations
- Automatic cache maintenance
- Graceful handling of cache misses
CloudSift implements an intelligent rate limiting system to handle AWS API requests efficiently:
- Token bucket algorithm with 20 requests per second (RPS) default rate
- Exponential backoff with smart retry strategy
- Automatic rate adjustment based on API responses
- Comprehensive failure handling and recovery
The rate limiter uses the following default settings:
type RateLimitConfig struct {
RequestsPerSecond: 20.0, // Default API request rate
MaxRetries: 10, // Maximum retry attempts
BaseDelay: 100 * time.Millisecond, // Initial backoff delay
MaxDelay: 120 * time.Second, // Maximum backoff delay
}- Starts with a 100ms delay on first failure
- Exponentially increases delay with each retry (doubles each time)
- Caps maximum delay at 2 minutes
- Automatically resets after 5 minutes of successful operations
- Provides detailed debug logging of backoff state
This configuration ensures efficient API usage while protecting against rate limiting and transient failures.
The worker pool system is optimized for concurrent AWS API operations:
- Dynamic scaling (CPU cores × 8)
- Comprehensive performance metrics
- Efficient task management
- Graceful shutdown handling
- Optimized for I/O-bound operations
- Configurable worker limits
- Built-in task prioritization
View a sample CloudSift report here. This demonstration showcases:
- Resource utilization metrics
- Cost analysis and potential savings
- Resource details and metadata
- Usage patterns and recommendations
Note: The example uses generated sample data and does not reflect real AWS resources or costs.
We welcome contributions! Please feel free to submit a Pull Request.
This project is licensed under the Mozilla Public License 2.0 (MPL-2.0). For more details, refer to the license page.
For full proprietary use, premium features, or additional support, contact us at support@cloudsift.io for commercial licensing options.
For questions and support, please email support@cloudsift.io
