π OPEN SOURCE TOOLKIT - Free, community-driven DevOps automation for everyone
π’ This is a completely open source toolkit designed to democratize cloud infrastructure management. Built by the community, for the community - with no vendor lock-in, no licensing fees, and full transparency.
A comprehensive collection of DevOps utilities and scripts for managing cloud infrastructure, databases, and monitoring across AWS, MongoDB, and other services. This toolkit provides automation scripts for resource tagging, database management, monitoring setup, and infrastructure maintenance.
- Overview
- Repository Structure
- Quick Start
- Tools and Scripts
- Prerequisites
- Installation
- Usage Examples
- Configuration
- Contributing
- Security Notes
- License
The Cloudsmith Toolkit is designed to streamline cloud infrastructure management through automated scripts and utilities. It focuses on:
- AWS Resource Management: Comprehensive tagging, monitoring, and resource discovery (EC2, EBS, S3, VPC, etc.)
- Database Operations: MongoDB replica set management and performance monitoring
- Infrastructure Monitoring: Automated setup of monitoring agents and configurations
- Cost Optimization: Spot fleet management and resource optimization tools
cloudsmith-toolkit/
βββ aws/ # AWS management scripts
β βββ ec2-tags.json # Sample EC2 tag configurations
β βββ fetch-aws-tags.sh # Retrieve tags from AWS resources
β βββ find-volumes-by-ec2-tag.sh # Find volumes by EC2 instance tags
β βββ list-untagged-resources.sh # Identify untagged AWS resources
β βββ spot-fleet-manager.sh # Manage EC2 Spot Fleet requests
β βββ tag-ecr-repos.sh # Apply tags to ECR repositories
β βββ to_tag.csv # Resource list for bulk tagging
β βββ untagged-ec2.csv # Sample report of untagged resources
β βββ update-aws-tags.sh # Bulk tag update utility
βββ docs/ # Documentation
β βββ README-pgbouncer-timescale-setup.md # PGBouncer setup guide
βββ mongodb/ # MongoDB management scripts
β βββ change-sync-source.js # Change replica set sync source
β βββ collection-size-report.js # Generate collection size reports
β βββ detailed-collection-report.js # Detailed database analytics
βββ setup-datadog.sh # Datadog agent installation
βββ .gitignore # Git ignore rules
βββ README.md # This file
-
Clone the repository:
git clone https://github.com/mudassir-ngineous/cloudsmith-toolkit.git cd cloudsmith-toolkit -
Make scripts executable:
find . -name "*.sh" -type f -exec chmod +x {} \;
-
Configure AWS credentials:
aws configure # or export AWS_PROFILE=your-profile-name
-
Run your first script:
./aws/list-untagged-resources.sh --help
| Script | Purpose | Key Features |
|---|---|---|
fetch-aws-tags.sh |
Retrieve existing tags from AWS resources | β’ Auto-detects resource type β’ Supports multiple resource types β’ Colored output |
update-aws-tags.sh |
Bulk update tags on AWS resources | β’ Batch processing β’ Configurable tag templates β’ Error handling |
list-untagged-resources.sh |
Find resources missing required tags | β’ Multi-resource type scanning (EC2, EBS, S3, etc.) β’ CSV export β’ Filtering options β’ S3 bucket support |
tag-ecr-repos.sh |
Tag ECR repositories automatically | β’ Bulk ECR tagging β’ Service-based naming β’ Profile support |
Usage Example:
# Find all untagged EC2 instances
./aws/list-untagged-resources.sh --tag service --output csv
# Find untagged S3 buckets
./aws/list-untagged-resources.sh --tag Environment --resources s3
# Find all untagged resources across multiple types
./aws/list-untagged-resources.sh --tag service --resources ec2,s3,ebs
# Tag multiple resources
./aws/update-aws-tags.sh i-1234567890abcdef0 vol-0987654321fedcba0
# Fetch tags for a specific resource
./aws/fetch-aws-tags.sh i-1234567890abcdef0| Script | Purpose | Key Features |
|---|---|---|
spot-fleet-manager.sh |
Manage EC2 Spot Fleet requests | β’ Create/modify spot fleets β’ Capacity scaling β’ Instance monitoring |
find-volumes-by-ec2-tag.sh |
Find EBS volumes by EC2 tags | β’ Tag-based volume discovery β’ Multiple output formats β’ Cost analysis support |
Usage Example:
# List all spot fleets
./aws/spot-fleet-manager.sh list
# Find volumes for production instances
./aws/find-volumes-by-ec2-tag.sh -t Environment -v Production| Script | Purpose | Key Features |
|---|---|---|
collection-size-report.js |
Generate collection size reports | β’ CSV export format β’ Size sorting β’ Multiple databases |
detailed-collection-report.js |
Comprehensive database analysis | β’ Index analysis β’ Performance metrics β’ Storage optimization |
| Script | Purpose | Key Features |
|---|---|---|
change-sync-source.js |
Modify replica set sync sources | β’ Sync source optimization β’ Network topology aware β’ Failover management |
Usage Example:
# Generate collection size report
mongo --quiet collection-size-report.js > collection_sizes.csv
# Change sync source for replica set member
mongo replica-set-member:27017 change-sync-source.js| Document | Purpose | Key Features |
|---|---|---|
README-pgbouncer-timescale-setup.md |
PGBouncer setup for TimescaleDB | β’ Zero-downtime deployment β’ Read/write routing β’ High availability |
- Operating System: Linux/macOS
- Shell: Bash 4.0+ or compatible
- Network: Internet access for package downloads
- AWS CLI v2.0+
- MongoDB Shell (for MongoDB scripts)
- jq (for JSON processing)
- curl (for downloads)
# AWS CLI
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
# MongoDB Shell
# Ubuntu/Debian
sudo apt-get install mongodb-clients
# CentOS/RHEL
sudo yum install mongodb-org-shell
# jq
sudo apt-get install jq # Ubuntu/Debian
sudo yum install jq # CentOS/RHEL-
Profile Setup:
aws configure --profile production
-
Environment Variables:
export AWS_PROFILE=production export AWS_REGION=ap-south-1
-
Script Configuration: Edit the configuration section in each script:
# Configuration AWS_PROFILE="default" AWS_REGION="ap-south-1"
-
Connection Settings: Update connection strings in MongoDB scripts:
// Connect to specific replica set member var conn = new Mongo("replica-set-member:27017");
-
Authentication: Ensure proper authentication is configured:
db.auth("username", "password");
# 1. Find all untagged resources (including S3 buckets)
./aws/list-untagged-resources.sh --output csv > audit_report.csv
# 2. Specifically audit S3 buckets for compliance
./aws/list-untagged-resources.sh --tag Environment --resources s3 --output table
# 3. Get detailed information about specific resources
./aws/fetch-aws-tags.sh i-1234567890abcdef0
# 4. Apply tags to resources
./aws/update-aws-tags.sh i-1234567890abcdef0 vol-0987654321fedcba0
# 5. Tag all ECR repositories
./aws/tag-ecr-repos.sh --profile production# 1. Generate collection size report
mongo --quiet mongodb/collection-size-report.js > sizes.csv
# 2. Run detailed analysis
mongo mongodb/detailed-collection-report.js
# 3. Optimize replica set topology
mongo secondary-node:27017 mongodb/change-sync-source.js- Never commit credentials to version control
- Use environment variables or AWS profiles for authentication
- Review
.gitignoreto ensure sensitive files are excluded
# Set appropriate permissions for scripts
chmod 750 *.sh
chmod 644 *.md *.json *.csvEnsure your AWS user/role has appropriate permissions:
- EC2:
DescribeInstances,DescribeTags,CreateTags - ECR:
DescribeRepositories,TagResource - EBS:
DescribeVolumes - S3:
ListAllMyBuckets,GetBucketTagging,PutBucketTagging
- Fork the repository
- Create a feature branch:
git checkout -b feature/new-script - Make your changes and test thoroughly
- Add documentation for new scripts
- Commit changes:
git commit -am 'Add new AWS utility script' - Push to branch:
git push origin feature/new-script - Submit a Pull Request
- Use consistent error handling and exit codes
- Include help documentation with
--helpflag - Add colored output for better user experience
- Support multiple output formats where applicable
- Include usage examples in script comments
For issues, questions, or contributions:
- Repository: cloudsmith-toolkit
- Issues: Use GitHub Issues for bug reports and feature requests
This project is licensed under the MIT License - see the LICENSE file for details.
β‘ Quick Commands:
# Make all scripts executable
find . -name "*.sh" -type f -exec chmod +x {} \;
# List all available tools
find . -name "*.sh" -type f -exec basename {} \; | sort
# Get help for any script
./aws/list-untagged-resources.sh --help