cleancloud 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cleancloud-0.1.0/LICENSE +21 -0
- cleancloud-0.1.0/PKG-INFO +321 -0
- cleancloud-0.1.0/README.md +276 -0
- cleancloud-0.1.0/cleancloud/__init__.py +0 -0
- cleancloud-0.1.0/cleancloud/cli.py +388 -0
- cleancloud-0.1.0/cleancloud/exit_policy.py +59 -0
- cleancloud-0.1.0/cleancloud/models/confidence.py +15 -0
- cleancloud-0.1.0/cleancloud/models/finding.py +38 -0
- cleancloud-0.1.0/cleancloud/output/csv.py +31 -0
- cleancloud-0.1.0/cleancloud/output/human.py +29 -0
- cleancloud-0.1.0/cleancloud/output/json.py +21 -0
- cleancloud-0.1.0/cleancloud/output/summary.py +17 -0
- cleancloud-0.1.0/cleancloud/providers/__init__.py +0 -0
- cleancloud-0.1.0/cleancloud/providers/aws/__init__.py +0 -0
- cleancloud-0.1.0/cleancloud/providers/aws/rules/__init__.py +0 -0
- cleancloud-0.1.0/cleancloud/providers/aws/rules/cloudwatch_inactive.py +56 -0
- cleancloud-0.1.0/cleancloud/providers/aws/rules/ebs_snapshot_old.py +58 -0
- cleancloud-0.1.0/cleancloud/providers/aws/rules/ebs_unattached.py +61 -0
- cleancloud-0.1.0/cleancloud/providers/aws/rules/untagged_resources.py +103 -0
- cleancloud-0.1.0/cleancloud/providers/aws/session.py +14 -0
- cleancloud-0.1.0/cleancloud/providers/azure/__init__.py +0 -0
- cleancloud-0.1.0/cleancloud/providers/azure/doctor.py +55 -0
- cleancloud-0.1.0/cleancloud/providers/azure/rules/__init__.py +0 -0
- cleancloud-0.1.0/cleancloud/providers/azure/rules/ebs_snapshots_old.py +85 -0
- cleancloud-0.1.0/cleancloud/providers/azure/rules/public_ip_unused.py +62 -0
- cleancloud-0.1.0/cleancloud/providers/azure/rules/unattached_managed_disks.py +92 -0
- cleancloud-0.1.0/cleancloud/providers/azure/rules/untagged_resources.py +119 -0
- cleancloud-0.1.0/cleancloud/providers/azure/session.py +72 -0
- cleancloud-0.1.0/cleancloud/scoring/__init__.py +0 -0
- cleancloud-0.1.0/cleancloud.egg-info/PKG-INFO +321 -0
- cleancloud-0.1.0/cleancloud.egg-info/SOURCES.txt +35 -0
- cleancloud-0.1.0/cleancloud.egg-info/dependency_links.txt +1 -0
- cleancloud-0.1.0/cleancloud.egg-info/entry_points.txt +2 -0
- cleancloud-0.1.0/cleancloud.egg-info/requires.txt +23 -0
- cleancloud-0.1.0/cleancloud.egg-info/top_level.txt +1 -0
- cleancloud-0.1.0/pyproject.toml +96 -0
- cleancloud-0.1.0/setup.cfg +4 -0
cleancloud-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 CleanCloud
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cleancloud
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Safe, conservative cloud hygiene scanning for AWS and Azure
|
|
5
|
+
Author-email: CleanCloud <suresh.csdp@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/sureshcsdp/cleancloud
|
|
8
|
+
Project-URL: Documentation, https://github.com/sureshcsdp/cleancloud#readme
|
|
9
|
+
Project-URL: Repository, https://github.com/sureshcsdp/cleancloud
|
|
10
|
+
Project-URL: Issues, https://github.com/sureshcsdp/cleancloud/issues
|
|
11
|
+
Keywords: aws,azure,cloud,hygiene,devops,sre,infrastructure
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: System Administrators
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: System :: Systems Administration
|
|
21
|
+
Classifier: Topic :: Utilities
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: click>=8.0.0
|
|
26
|
+
Provides-Extra: aws
|
|
27
|
+
Requires-Dist: boto3>=1.26.0; extra == "aws"
|
|
28
|
+
Requires-Dist: botocore>=1.29.0; extra == "aws"
|
|
29
|
+
Provides-Extra: azure
|
|
30
|
+
Requires-Dist: azure-identity>=1.15.0; extra == "azure"
|
|
31
|
+
Requires-Dist: azure-mgmt-resource>=23.0.0; extra == "azure"
|
|
32
|
+
Requires-Dist: azure-mgmt-compute>=30.0.0; extra == "azure"
|
|
33
|
+
Requires-Dist: azure-mgmt-network>=25.0.0; extra == "azure"
|
|
34
|
+
Requires-Dist: azure-core>=1.29.0; extra == "azure"
|
|
35
|
+
Provides-Extra: all
|
|
36
|
+
Requires-Dist: cleancloud[aws,azure]; extra == "all"
|
|
37
|
+
Provides-Extra: dev
|
|
38
|
+
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
|
39
|
+
Requires-Dist: pytest-mock>=3.12.0; extra == "dev"
|
|
40
|
+
Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
|
|
41
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
42
|
+
Requires-Dist: mypy>=1.7.0; extra == "dev"
|
|
43
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
44
|
+
Dynamic: license-file
|
|
45
|
+
|
|
46
|
+
# CleanCloud
|
|
47
|
+
|
|
48
|
+
**Safe, conservative cloud hygiene scanning for modern infrastructure teams.**
|
|
49
|
+
|
|
50
|
+
CleanCloud helps SRE and DevOps teams identify orphaned, untagged, and potentially inactive cloud resources—without the risk of automated cleanup or aggressive cost optimization heuristics.
|
|
51
|
+
|
|
52
|
+
## Why CleanCloud?
|
|
53
|
+
|
|
54
|
+
Modern cloud environments constantly create and destroy storage and logs. Over time, orphaned resources accumulate — no owner, no signal, and too risky to delete blindly.
|
|
55
|
+
|
|
56
|
+
Most cloud hygiene tools fall into two categories:
|
|
57
|
+
|
|
58
|
+
1. **Auto-delete everything** - Too dangerous for production
|
|
59
|
+
2. **Flag everything** - Too noisy to be useful
|
|
60
|
+
|
|
61
|
+
**CleanCloud is different:**
|
|
62
|
+
|
|
63
|
+
- ✅ **Read-only by design** - Never modifies, deletes, or tags resources
|
|
64
|
+
- ✅ **Conservative signals** - Multiple indicators, age-based confidence thresholds
|
|
65
|
+
- ✅ **IaC-aware** - Designed for elastic, automated infrastructure
|
|
66
|
+
- ✅ **Trust-first** - Review-only recommendations, never destructive actions
|
|
67
|
+
- ✅ **CI/CD friendly** - Exit codes, JSON/CSV output, confidence-based policies
|
|
68
|
+
|
|
69
|
+
**CleanCloud is not:**
|
|
70
|
+
- ❌ A cost optimization tool
|
|
71
|
+
- ❌ An automated cleanup service
|
|
72
|
+
- ❌ A FinOps dashboard
|
|
73
|
+
|
|
74
|
+
It's a **hygiene layer** built for teams who value safety over automation.
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Quick Start
|
|
79
|
+
|
|
80
|
+
### Installation
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
pip install cleancloud
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Validate Credentials
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# AWS
|
|
90
|
+
cleancloud doctor --provider aws
|
|
91
|
+
|
|
92
|
+
# Azure
|
|
93
|
+
cleancloud doctor --provider azure
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Run a Scan
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
# AWS - single region
|
|
100
|
+
cleancloud scan --provider aws --region us-east-1
|
|
101
|
+
|
|
102
|
+
# AWS - all regions
|
|
103
|
+
cleancloud scan --provider aws --all-regions
|
|
104
|
+
|
|
105
|
+
# Azure - all subscriptions
|
|
106
|
+
cleancloud scan --provider azure
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### View Results
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
# Human-readable output (default)
|
|
113
|
+
cleancloud scan --provider aws
|
|
114
|
+
|
|
115
|
+
# JSON output
|
|
116
|
+
cleancloud scan --provider aws --output json --output-file results.json
|
|
117
|
+
|
|
118
|
+
# CSV output
|
|
119
|
+
cleancloud scan --provider azure --output csv --output-file results.csv
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## What CleanCloud Detects
|
|
125
|
+
|
|
126
|
+
### AWS Rules (4 currently)
|
|
127
|
+
- **Unattached EBS volumes** - Volumes not attached to any EC2 instance
|
|
128
|
+
- **Old EBS snapshots** - Snapshots older than 90 days (configurable)
|
|
129
|
+
- **Inactive CloudWatch log groups** - Log groups with infinite retention
|
|
130
|
+
- **Untagged resources** - EBS volumes, S3 buckets, log groups without tags
|
|
131
|
+
|
|
132
|
+
### Azure Rules (4 currently)
|
|
133
|
+
- **Unattached managed disks** - Disks not attached to any VM (7+ days old)
|
|
134
|
+
- **Old snapshots** - Snapshots older than 30 days
|
|
135
|
+
- **Untagged resources** - Managed disks and snapshots without tags
|
|
136
|
+
- **Unused public IPs** - Public IP addresses not attached to any resource
|
|
137
|
+
|
|
138
|
+
See [`docs/rules.md`](docs/rules.md) for detailed rule behavior and confidence thresholds.
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## CI/CD Integration
|
|
143
|
+
|
|
144
|
+
CleanCloud is designed for CI/CD pipelines with predictable exit codes and policy enforcement.
|
|
145
|
+
|
|
146
|
+
### GitHub Actions Example
|
|
147
|
+
|
|
148
|
+
```yaml
|
|
149
|
+
- name: Run CleanCloud hygiene scan
|
|
150
|
+
env:
|
|
151
|
+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
152
|
+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
153
|
+
run: |
|
|
154
|
+
pip install cleancloud
|
|
155
|
+
cleancloud scan --provider aws --output json --output-file scan.json --fail-on-confidence HIGH
|
|
156
|
+
|
|
157
|
+
- name: Upload results
|
|
158
|
+
uses: actions/upload-artifact@v4
|
|
159
|
+
with:
|
|
160
|
+
name: cleancloud-results
|
|
161
|
+
path: scan.json
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Exit Codes
|
|
165
|
+
|
|
166
|
+
| Code | Meaning |
|
|
167
|
+
|------|---------|
|
|
168
|
+
| `0` | Scan completed successfully, no blocking findings |
|
|
169
|
+
| `1` | Configuration or unexpected error |
|
|
170
|
+
| `2` | Policy violation (findings detected with `--fail-on-findings` or `--fail-on-confidence`) |
|
|
171
|
+
| `3` | Missing permissions or invalid credentials |
|
|
172
|
+
|
|
173
|
+
### Policy Enforcement
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
# Fail only on HIGH confidence findings (recommended)
|
|
177
|
+
cleancloud scan --fail-on-confidence HIGH
|
|
178
|
+
|
|
179
|
+
# Fail on MEDIUM or higher confidence
|
|
180
|
+
cleancloud scan --fail-on-confidence MEDIUM
|
|
181
|
+
|
|
182
|
+
# Fail on any findings (strict mode, not recommended)
|
|
183
|
+
cleancloud scan --fail-on-findings
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
See [`docs/ci.md`](docs/ci.md) for complete CI/CD integration examples.
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Configuration
|
|
191
|
+
|
|
192
|
+
### AWS
|
|
193
|
+
|
|
194
|
+
CleanCloud uses standard AWS credential resolution:
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
# Using AWS profile
|
|
198
|
+
aws configure --profile cleancloud
|
|
199
|
+
cleancloud scan --provider aws --profile cleancloud
|
|
200
|
+
|
|
201
|
+
# Using environment variables
|
|
202
|
+
export AWS_ACCESS_KEY_ID=...
|
|
203
|
+
export AWS_SECRET_ACCESS_KEY=...
|
|
204
|
+
export AWS_DEFAULT_REGION=us-east-1
|
|
205
|
+
cleancloud scan --provider aws
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
**Required IAM permissions:** Read-only access to EC2, CloudWatch Logs, and S3.
|
|
209
|
+
|
|
210
|
+
See [`docs/aws.md`](docs/aws.md) for detailed setup and IAM policy.
|
|
211
|
+
|
|
212
|
+
### Azure
|
|
213
|
+
|
|
214
|
+
CleanCloud requires Azure service principal credentials:
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
export AZURE_CLIENT_ID=...
|
|
218
|
+
export AZURE_TENANT_ID=...
|
|
219
|
+
export AZURE_CLIENT_SECRET=...
|
|
220
|
+
export AZURE_SUBSCRIPTION_ID=... # Optional
|
|
221
|
+
|
|
222
|
+
cleancloud scan --provider azure
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
**Required Azure permissions:** Reader role on subscription.
|
|
226
|
+
|
|
227
|
+
See [`docs/azure.md`](docs/azure.md) for detailed setup and RBAC configuration.
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
## Design Philosophy
|
|
232
|
+
|
|
233
|
+
CleanCloud is built on three core principles:
|
|
234
|
+
|
|
235
|
+
### 1. Conservative by Default
|
|
236
|
+
- Age-based confidence thresholds (e.g., disks > 14 days = HIGH confidence)
|
|
237
|
+
- Multiple signals required before flagging resources
|
|
238
|
+
- Explicit confidence levels: LOW, MEDIUM, HIGH
|
|
239
|
+
|
|
240
|
+
### 2. Read-Only Always
|
|
241
|
+
- No `Delete*` permissions required
|
|
242
|
+
- No `Tag*` permissions required
|
|
243
|
+
- No modification APIs called
|
|
244
|
+
- Safe for production accounts
|
|
245
|
+
|
|
246
|
+
### 3. Review-Only Recommendations
|
|
247
|
+
- Findings are candidates for human review, not automated action
|
|
248
|
+
- Clear reasoning provided for each finding
|
|
249
|
+
- Detailed metadata included for investigation
|
|
250
|
+
|
|
251
|
+
This makes CleanCloud safe for:
|
|
252
|
+
- ✅ Regulated environments
|
|
253
|
+
- ✅ Production accounts
|
|
254
|
+
- ✅ Security-reviewed pipelines
|
|
255
|
+
- ✅ Shared infrastructure
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## Roadmap
|
|
260
|
+
|
|
261
|
+
### Coming Soon
|
|
262
|
+
- GCP support
|
|
263
|
+
- Additional AWS rules (unused Elastic IPs, old AMIs, empty security groups)
|
|
264
|
+
- Additional Azure rules (unused NICs, old images)
|
|
265
|
+
- Rule filtering (`--rules` flag)
|
|
266
|
+
- Configuration file support (`cleancloud.yaml`)
|
|
267
|
+
|
|
268
|
+
### Not Planned
|
|
269
|
+
- Automated cleanup or deletion
|
|
270
|
+
- Cost optimization recommendations
|
|
271
|
+
- Rightsizing suggestions
|
|
272
|
+
- Billing data access
|
|
273
|
+
|
|
274
|
+
CleanCloud will remain focused on **safe hygiene detection**, not automation or cost management.
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
## Documentation
|
|
279
|
+
|
|
280
|
+
- [`docs/rules.md`](docs/rules.md) - Detailed rule behavior and signals
|
|
281
|
+
- [`docs/aws.md`](docs/aws.md) - AWS setup and IAM policy
|
|
282
|
+
- [`docs/azure.md`](docs/azure.md) - Azure setup and RBAC configuration
|
|
283
|
+
- [`docs/ci.md`](docs/ci.md) - CI/CD integration examples
|
|
284
|
+
|
|
285
|
+
---
|
|
286
|
+
|
|
287
|
+
## Contributing
|
|
288
|
+
|
|
289
|
+
Contributions are welcome! Please ensure all PRs:
|
|
290
|
+
- Include tests for new rules
|
|
291
|
+
- Follow the conservative design philosophy
|
|
292
|
+
- Maintain read-only operation
|
|
293
|
+
- Include documentation updates
|
|
294
|
+
|
|
295
|
+
See [`CONTRIBUTING.md`](CONTRIBUTING.md) for details.
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
299
|
+
## Security
|
|
300
|
+
|
|
301
|
+
CleanCloud never requires you to commit cloud credentials.
|
|
302
|
+
All scans run using standard AWS/Azure SDK credential resolution
|
|
303
|
+
(AWS profiles, env vars, or workload identity).
|
|
304
|
+
|
|
305
|
+
⚠️ Never commit secrets into this repository.
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
309
|
+
## License
|
|
310
|
+
|
|
311
|
+
[MIT License](LICENSE)
|
|
312
|
+
|
|
313
|
+
---
|
|
314
|
+
|
|
315
|
+
## Why "CleanCloud"?
|
|
316
|
+
|
|
317
|
+
Because clean code matters, clean infrastructure matters, and cleaning up cloud resources should be **safe, deliberate, and human-reviewed**—not automated and risky.
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
**Built for SRE teams who value trust over automation.**
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
# CleanCloud
|
|
2
|
+
|
|
3
|
+
**Safe, conservative cloud hygiene scanning for modern infrastructure teams.**
|
|
4
|
+
|
|
5
|
+
CleanCloud helps SRE and DevOps teams identify orphaned, untagged, and potentially inactive cloud resources—without the risk of automated cleanup or aggressive cost optimization heuristics.
|
|
6
|
+
|
|
7
|
+
## Why CleanCloud?
|
|
8
|
+
|
|
9
|
+
Modern cloud environments constantly create and destroy storage and logs. Over time, orphaned resources accumulate — no owner, no signal, and too risky to delete blindly.
|
|
10
|
+
|
|
11
|
+
Most cloud hygiene tools fall into two categories:
|
|
12
|
+
|
|
13
|
+
1. **Auto-delete everything** - Too dangerous for production
|
|
14
|
+
2. **Flag everything** - Too noisy to be useful
|
|
15
|
+
|
|
16
|
+
**CleanCloud is different:**
|
|
17
|
+
|
|
18
|
+
- ✅ **Read-only by design** - Never modifies, deletes, or tags resources
|
|
19
|
+
- ✅ **Conservative signals** - Multiple indicators, age-based confidence thresholds
|
|
20
|
+
- ✅ **IaC-aware** - Designed for elastic, automated infrastructure
|
|
21
|
+
- ✅ **Trust-first** - Review-only recommendations, never destructive actions
|
|
22
|
+
- ✅ **CI/CD friendly** - Exit codes, JSON/CSV output, confidence-based policies
|
|
23
|
+
|
|
24
|
+
**CleanCloud is not:**
|
|
25
|
+
- ❌ A cost optimization tool
|
|
26
|
+
- ❌ An automated cleanup service
|
|
27
|
+
- ❌ A FinOps dashboard
|
|
28
|
+
|
|
29
|
+
It's a **hygiene layer** built for teams who value safety over automation.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Quick Start
|
|
34
|
+
|
|
35
|
+
### Installation
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pip install cleancloud
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Validate Credentials
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# AWS
|
|
45
|
+
cleancloud doctor --provider aws
|
|
46
|
+
|
|
47
|
+
# Azure
|
|
48
|
+
cleancloud doctor --provider azure
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Run a Scan
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# AWS - single region
|
|
55
|
+
cleancloud scan --provider aws --region us-east-1
|
|
56
|
+
|
|
57
|
+
# AWS - all regions
|
|
58
|
+
cleancloud scan --provider aws --all-regions
|
|
59
|
+
|
|
60
|
+
# Azure - all subscriptions
|
|
61
|
+
cleancloud scan --provider azure
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### View Results
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Human-readable output (default)
|
|
68
|
+
cleancloud scan --provider aws
|
|
69
|
+
|
|
70
|
+
# JSON output
|
|
71
|
+
cleancloud scan --provider aws --output json --output-file results.json
|
|
72
|
+
|
|
73
|
+
# CSV output
|
|
74
|
+
cleancloud scan --provider azure --output csv --output-file results.csv
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## What CleanCloud Detects
|
|
80
|
+
|
|
81
|
+
### AWS Rules (4 currently)
|
|
82
|
+
- **Unattached EBS volumes** - Volumes not attached to any EC2 instance
|
|
83
|
+
- **Old EBS snapshots** - Snapshots older than 90 days (configurable)
|
|
84
|
+
- **Inactive CloudWatch log groups** - Log groups with infinite retention
|
|
85
|
+
- **Untagged resources** - EBS volumes, S3 buckets, log groups without tags
|
|
86
|
+
|
|
87
|
+
### Azure Rules (4 currently)
|
|
88
|
+
- **Unattached managed disks** - Disks not attached to any VM (7+ days old)
|
|
89
|
+
- **Old snapshots** - Snapshots older than 30 days
|
|
90
|
+
- **Untagged resources** - Managed disks and snapshots without tags
|
|
91
|
+
- **Unused public IPs** - Public IP addresses not attached to any resource
|
|
92
|
+
|
|
93
|
+
See [`docs/rules.md`](docs/rules.md) for detailed rule behavior and confidence thresholds.
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## CI/CD Integration
|
|
98
|
+
|
|
99
|
+
CleanCloud is designed for CI/CD pipelines with predictable exit codes and policy enforcement.
|
|
100
|
+
|
|
101
|
+
### GitHub Actions Example
|
|
102
|
+
|
|
103
|
+
```yaml
|
|
104
|
+
- name: Run CleanCloud hygiene scan
|
|
105
|
+
env:
|
|
106
|
+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
107
|
+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
108
|
+
run: |
|
|
109
|
+
pip install cleancloud
|
|
110
|
+
cleancloud scan --provider aws --output json --output-file scan.json --fail-on-confidence HIGH
|
|
111
|
+
|
|
112
|
+
- name: Upload results
|
|
113
|
+
uses: actions/upload-artifact@v4
|
|
114
|
+
with:
|
|
115
|
+
name: cleancloud-results
|
|
116
|
+
path: scan.json
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Exit Codes
|
|
120
|
+
|
|
121
|
+
| Code | Meaning |
|
|
122
|
+
|------|---------|
|
|
123
|
+
| `0` | Scan completed successfully, no blocking findings |
|
|
124
|
+
| `1` | Configuration or unexpected error |
|
|
125
|
+
| `2` | Policy violation (findings detected with `--fail-on-findings` or `--fail-on-confidence`) |
|
|
126
|
+
| `3` | Missing permissions or invalid credentials |
|
|
127
|
+
|
|
128
|
+
### Policy Enforcement
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
# Fail only on HIGH confidence findings (recommended)
|
|
132
|
+
cleancloud scan --fail-on-confidence HIGH
|
|
133
|
+
|
|
134
|
+
# Fail on MEDIUM or higher confidence
|
|
135
|
+
cleancloud scan --fail-on-confidence MEDIUM
|
|
136
|
+
|
|
137
|
+
# Fail on any findings (strict mode, not recommended)
|
|
138
|
+
cleancloud scan --fail-on-findings
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
See [`docs/ci.md`](docs/ci.md) for complete CI/CD integration examples.
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Configuration
|
|
146
|
+
|
|
147
|
+
### AWS
|
|
148
|
+
|
|
149
|
+
CleanCloud uses standard AWS credential resolution:
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
# Using AWS profile
|
|
153
|
+
aws configure --profile cleancloud
|
|
154
|
+
cleancloud scan --provider aws --profile cleancloud
|
|
155
|
+
|
|
156
|
+
# Using environment variables
|
|
157
|
+
export AWS_ACCESS_KEY_ID=...
|
|
158
|
+
export AWS_SECRET_ACCESS_KEY=...
|
|
159
|
+
export AWS_DEFAULT_REGION=us-east-1
|
|
160
|
+
cleancloud scan --provider aws
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
**Required IAM permissions:** Read-only access to EC2, CloudWatch Logs, and S3.
|
|
164
|
+
|
|
165
|
+
See [`docs/aws.md`](docs/aws.md) for detailed setup and IAM policy.
|
|
166
|
+
|
|
167
|
+
### Azure
|
|
168
|
+
|
|
169
|
+
CleanCloud requires Azure service principal credentials:
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
export AZURE_CLIENT_ID=...
|
|
173
|
+
export AZURE_TENANT_ID=...
|
|
174
|
+
export AZURE_CLIENT_SECRET=...
|
|
175
|
+
export AZURE_SUBSCRIPTION_ID=... # Optional
|
|
176
|
+
|
|
177
|
+
cleancloud scan --provider azure
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
**Required Azure permissions:** Reader role on subscription.
|
|
181
|
+
|
|
182
|
+
See [`docs/azure.md`](docs/azure.md) for detailed setup and RBAC configuration.
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Design Philosophy
|
|
187
|
+
|
|
188
|
+
CleanCloud is built on three core principles:
|
|
189
|
+
|
|
190
|
+
### 1. Conservative by Default
|
|
191
|
+
- Age-based confidence thresholds (e.g., disks > 14 days = HIGH confidence)
|
|
192
|
+
- Multiple signals required before flagging resources
|
|
193
|
+
- Explicit confidence levels: LOW, MEDIUM, HIGH
|
|
194
|
+
|
|
195
|
+
### 2. Read-Only Always
|
|
196
|
+
- No `Delete*` permissions required
|
|
197
|
+
- No `Tag*` permissions required
|
|
198
|
+
- No modification APIs called
|
|
199
|
+
- Safe for production accounts
|
|
200
|
+
|
|
201
|
+
### 3. Review-Only Recommendations
|
|
202
|
+
- Findings are candidates for human review, not automated action
|
|
203
|
+
- Clear reasoning provided for each finding
|
|
204
|
+
- Detailed metadata included for investigation
|
|
205
|
+
|
|
206
|
+
This makes CleanCloud safe for:
|
|
207
|
+
- ✅ Regulated environments
|
|
208
|
+
- ✅ Production accounts
|
|
209
|
+
- ✅ Security-reviewed pipelines
|
|
210
|
+
- ✅ Shared infrastructure
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## Roadmap
|
|
215
|
+
|
|
216
|
+
### Coming Soon
|
|
217
|
+
- GCP support
|
|
218
|
+
- Additional AWS rules (unused Elastic IPs, old AMIs, empty security groups)
|
|
219
|
+
- Additional Azure rules (unused NICs, old images)
|
|
220
|
+
- Rule filtering (`--rules` flag)
|
|
221
|
+
- Configuration file support (`cleancloud.yaml`)
|
|
222
|
+
|
|
223
|
+
### Not Planned
|
|
224
|
+
- Automated cleanup or deletion
|
|
225
|
+
- Cost optimization recommendations
|
|
226
|
+
- Rightsizing suggestions
|
|
227
|
+
- Billing data access
|
|
228
|
+
|
|
229
|
+
CleanCloud will remain focused on **safe hygiene detection**, not automation or cost management.
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## Documentation
|
|
234
|
+
|
|
235
|
+
- [`docs/rules.md`](docs/rules.md) - Detailed rule behavior and signals
|
|
236
|
+
- [`docs/aws.md`](docs/aws.md) - AWS setup and IAM policy
|
|
237
|
+
- [`docs/azure.md`](docs/azure.md) - Azure setup and RBAC configuration
|
|
238
|
+
- [`docs/ci.md`](docs/ci.md) - CI/CD integration examples
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## Contributing
|
|
243
|
+
|
|
244
|
+
Contributions are welcome! Please ensure all PRs:
|
|
245
|
+
- Include tests for new rules
|
|
246
|
+
- Follow the conservative design philosophy
|
|
247
|
+
- Maintain read-only operation
|
|
248
|
+
- Include documentation updates
|
|
249
|
+
|
|
250
|
+
See [`CONTRIBUTING.md`](CONTRIBUTING.md) for details.
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## Security
|
|
255
|
+
|
|
256
|
+
CleanCloud never requires you to commit cloud credentials.
|
|
257
|
+
All scans run using standard AWS/Azure SDK credential resolution
|
|
258
|
+
(AWS profiles, env vars, or workload identity).
|
|
259
|
+
|
|
260
|
+
⚠️ Never commit secrets into this repository.
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
## License
|
|
265
|
+
|
|
266
|
+
[MIT License](LICENSE)
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## Why "CleanCloud"?
|
|
271
|
+
|
|
272
|
+
Because clean code matters, clean infrastructure matters, and cleaning up cloud resources should be **safe, deliberate, and human-reviewed**—not automated and risky.
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
**Built for SRE teams who value trust over automation.**
|
|
File without changes
|