aws-inventory-manager 0.2.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.
Potentially problematic release.
This version of aws-inventory-manager might be problematic. Click here for more details.
- aws_inventory_manager-0.2.0/CLAUDE.md +32 -0
- aws_inventory_manager-0.2.0/LICENSE +21 -0
- aws_inventory_manager-0.2.0/MANIFEST.in +27 -0
- aws_inventory_manager-0.2.0/PKG-INFO +508 -0
- aws_inventory_manager-0.2.0/README.md +465 -0
- aws_inventory_manager-0.2.0/TESTING.md +241 -0
- aws_inventory_manager-0.2.0/aws_inventory_manager.egg-info/PKG-INFO +508 -0
- aws_inventory_manager-0.2.0/aws_inventory_manager.egg-info/SOURCES.txt +72 -0
- aws_inventory_manager-0.2.0/aws_inventory_manager.egg-info/dependency_links.txt +1 -0
- aws_inventory_manager-0.2.0/aws_inventory_manager.egg-info/entry_points.txt +2 -0
- aws_inventory_manager-0.2.0/aws_inventory_manager.egg-info/requires.txt +15 -0
- aws_inventory_manager-0.2.0/aws_inventory_manager.egg-info/top_level.txt +1 -0
- aws_inventory_manager-0.2.0/pyproject.toml +102 -0
- aws_inventory_manager-0.2.0/requirements.txt +8 -0
- aws_inventory_manager-0.2.0/setup.cfg +4 -0
- aws_inventory_manager-0.2.0/src/__init__.py +3 -0
- aws_inventory_manager-0.2.0/src/aws/__init__.py +11 -0
- aws_inventory_manager-0.2.0/src/aws/client.py +128 -0
- aws_inventory_manager-0.2.0/src/aws/credentials.py +191 -0
- aws_inventory_manager-0.2.0/src/aws/rate_limiter.py +177 -0
- aws_inventory_manager-0.2.0/src/cli/__init__.py +5 -0
- aws_inventory_manager-0.2.0/src/cli/config.py +130 -0
- aws_inventory_manager-0.2.0/src/cli/main.py +1450 -0
- aws_inventory_manager-0.2.0/src/cost/__init__.py +5 -0
- aws_inventory_manager-0.2.0/src/cost/analyzer.py +226 -0
- aws_inventory_manager-0.2.0/src/cost/explorer.py +209 -0
- aws_inventory_manager-0.2.0/src/cost/reporter.py +237 -0
- aws_inventory_manager-0.2.0/src/delta/__init__.py +5 -0
- aws_inventory_manager-0.2.0/src/delta/calculator.py +180 -0
- aws_inventory_manager-0.2.0/src/delta/reporter.py +225 -0
- aws_inventory_manager-0.2.0/src/models/__init__.py +17 -0
- aws_inventory_manager-0.2.0/src/models/cost_report.py +87 -0
- aws_inventory_manager-0.2.0/src/models/delta_report.py +111 -0
- aws_inventory_manager-0.2.0/src/models/inventory.py +124 -0
- aws_inventory_manager-0.2.0/src/models/resource.py +99 -0
- aws_inventory_manager-0.2.0/src/models/snapshot.py +108 -0
- aws_inventory_manager-0.2.0/src/snapshot/__init__.py +6 -0
- aws_inventory_manager-0.2.0/src/snapshot/capturer.py +347 -0
- aws_inventory_manager-0.2.0/src/snapshot/filter.py +245 -0
- aws_inventory_manager-0.2.0/src/snapshot/inventory_storage.py +264 -0
- aws_inventory_manager-0.2.0/src/snapshot/resource_collectors/__init__.py +5 -0
- aws_inventory_manager-0.2.0/src/snapshot/resource_collectors/apigateway.py +140 -0
- aws_inventory_manager-0.2.0/src/snapshot/resource_collectors/backup.py +136 -0
- aws_inventory_manager-0.2.0/src/snapshot/resource_collectors/base.py +81 -0
- aws_inventory_manager-0.2.0/src/snapshot/resource_collectors/cloudformation.py +55 -0
- aws_inventory_manager-0.2.0/src/snapshot/resource_collectors/cloudwatch.py +109 -0
- aws_inventory_manager-0.2.0/src/snapshot/resource_collectors/codebuild.py +69 -0
- aws_inventory_manager-0.2.0/src/snapshot/resource_collectors/codepipeline.py +82 -0
- aws_inventory_manager-0.2.0/src/snapshot/resource_collectors/dynamodb.py +65 -0
- aws_inventory_manager-0.2.0/src/snapshot/resource_collectors/ec2.py +240 -0
- aws_inventory_manager-0.2.0/src/snapshot/resource_collectors/ecs.py +215 -0
- aws_inventory_manager-0.2.0/src/snapshot/resource_collectors/eks.py +200 -0
- aws_inventory_manager-0.2.0/src/snapshot/resource_collectors/elb.py +126 -0
- aws_inventory_manager-0.2.0/src/snapshot/resource_collectors/eventbridge.py +156 -0
- aws_inventory_manager-0.2.0/src/snapshot/resource_collectors/iam.py +188 -0
- aws_inventory_manager-0.2.0/src/snapshot/resource_collectors/kms.py +111 -0
- aws_inventory_manager-0.2.0/src/snapshot/resource_collectors/lambda_func.py +112 -0
- aws_inventory_manager-0.2.0/src/snapshot/resource_collectors/rds.py +109 -0
- aws_inventory_manager-0.2.0/src/snapshot/resource_collectors/route53.py +86 -0
- aws_inventory_manager-0.2.0/src/snapshot/resource_collectors/s3.py +105 -0
- aws_inventory_manager-0.2.0/src/snapshot/resource_collectors/secretsmanager.py +70 -0
- aws_inventory_manager-0.2.0/src/snapshot/resource_collectors/sns.py +68 -0
- aws_inventory_manager-0.2.0/src/snapshot/resource_collectors/sqs.py +72 -0
- aws_inventory_manager-0.2.0/src/snapshot/resource_collectors/ssm.py +160 -0
- aws_inventory_manager-0.2.0/src/snapshot/resource_collectors/stepfunctions.py +74 -0
- aws_inventory_manager-0.2.0/src/snapshot/resource_collectors/vpcendpoints.py +79 -0
- aws_inventory_manager-0.2.0/src/snapshot/resource_collectors/waf.py +159 -0
- aws_inventory_manager-0.2.0/src/snapshot/storage.py +259 -0
- aws_inventory_manager-0.2.0/src/utils/__init__.py +12 -0
- aws_inventory_manager-0.2.0/src/utils/export.py +87 -0
- aws_inventory_manager-0.2.0/src/utils/hash.py +60 -0
- aws_inventory_manager-0.2.0/src/utils/logging.py +63 -0
- aws_inventory_manager-0.2.0/src/utils/paths.py +51 -0
- aws_inventory_manager-0.2.0/src/utils/progress.py +41 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# aws-baseline Development Guidelines
|
|
2
|
+
|
|
3
|
+
Auto-generated from all feature plans. Last updated: 2025-10-26
|
|
4
|
+
|
|
5
|
+
## Active Technologies
|
|
6
|
+
- Python 3.8+ (supports 3.8-3.13 per pyproject.toml) + boto3 (AWS SDK), typer (CLI), rich (terminal UI), pyyaml (storage), python-dateutil (timestamps) (002-inventory-management)
|
|
7
|
+
- Local filesystem YAML files (.snapshots/inventories.yaml, .snapshots/snapshots/*.yaml) (002-inventory-management)
|
|
8
|
+
|
|
9
|
+
- Python 3.8+ (supports 3.8-3.13 based on project standards) (001-aws-baseline-snapshot)
|
|
10
|
+
|
|
11
|
+
## Project Structure
|
|
12
|
+
|
|
13
|
+
```text
|
|
14
|
+
src/
|
|
15
|
+
tests/
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Commands
|
|
19
|
+
|
|
20
|
+
cd src [ONLY COMMANDS FOR ACTIVE TECHNOLOGIES][ONLY COMMANDS FOR ACTIVE TECHNOLOGIES] pytest [ONLY COMMANDS FOR ACTIVE TECHNOLOGIES][ONLY COMMANDS FOR ACTIVE TECHNOLOGIES] ruff check .
|
|
21
|
+
|
|
22
|
+
## Code Style
|
|
23
|
+
|
|
24
|
+
Python 3.8+ (supports 3.8-3.13 based on project standards): Follow standard conventions
|
|
25
|
+
|
|
26
|
+
## Recent Changes
|
|
27
|
+
- 002-inventory-management: Added Python 3.8+ (supports 3.8-3.13 per pyproject.toml) + boto3 (AWS SDK), typer (CLI), rich (terminal UI), pyyaml (storage), python-dateutil (timestamps)
|
|
28
|
+
|
|
29
|
+
- 001-aws-baseline-snapshot: Added Python 3.8+ (supports 3.8-3.13 based on project standards)
|
|
30
|
+
|
|
31
|
+
<!-- MANUAL ADDITIONS START -->
|
|
32
|
+
<!-- MANUAL ADDITIONS END -->
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 AWS Audit Team
|
|
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,27 @@
|
|
|
1
|
+
# Include essential documentation
|
|
2
|
+
include README.md
|
|
3
|
+
include LICENSE
|
|
4
|
+
include TESTING.md
|
|
5
|
+
include CLAUDE.md
|
|
6
|
+
|
|
7
|
+
# Include configuration files
|
|
8
|
+
include pyproject.toml
|
|
9
|
+
include requirements.txt
|
|
10
|
+
|
|
11
|
+
# Include all Python source files
|
|
12
|
+
recursive-include src *.py
|
|
13
|
+
|
|
14
|
+
# Exclude test files and build artifacts
|
|
15
|
+
recursive-exclude tests *
|
|
16
|
+
recursive-exclude .github *
|
|
17
|
+
recursive-exclude htmlcov *
|
|
18
|
+
exclude .coverage
|
|
19
|
+
exclude .gitignore
|
|
20
|
+
exclude tasks.py
|
|
21
|
+
|
|
22
|
+
# Exclude spec files (development only)
|
|
23
|
+
recursive-exclude specs *
|
|
24
|
+
recursive-exclude .specify *
|
|
25
|
+
|
|
26
|
+
# Exclude snapshots directory
|
|
27
|
+
recursive-exclude .snapshots *
|
|
@@ -0,0 +1,508 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: aws-inventory-manager
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: AWS Resource Inventory Management & Delta Tracking CLI tool
|
|
5
|
+
Author-email: Troy Larson <troy@calvinware.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/troylar/aws-inventory-manager
|
|
8
|
+
Project-URL: Documentation, https://github.com/troylar/aws-inventory-manager#readme
|
|
9
|
+
Project-URL: Repository, https://github.com/troylar/aws-inventory-manager
|
|
10
|
+
Project-URL: Issues, https://github.com/troylar/aws-inventory-manager/issues
|
|
11
|
+
Keywords: aws,cloud,infrastructure,snapshot,audit,cost-tracking,inventory
|
|
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.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Topic :: System :: Systems Administration
|
|
24
|
+
Classifier: Topic :: Utilities
|
|
25
|
+
Requires-Python: >=3.8
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: boto3>=1.28.0
|
|
29
|
+
Requires-Dist: typer>=0.9.0
|
|
30
|
+
Requires-Dist: rich>=13.0.0
|
|
31
|
+
Requires-Dist: pyyaml>=6.0
|
|
32
|
+
Requires-Dist: python-dateutil>=2.8.0
|
|
33
|
+
Provides-Extra: dev
|
|
34
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
35
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
36
|
+
Requires-Dist: pytest-mock>=3.12.0; extra == "dev"
|
|
37
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
38
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
39
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
40
|
+
Requires-Dist: types-PyYAML>=6.0.0; extra == "dev"
|
|
41
|
+
Requires-Dist: invoke>=2.0.0; extra == "dev"
|
|
42
|
+
Dynamic: license-file
|
|
43
|
+
|
|
44
|
+
<div align="center">
|
|
45
|
+
|
|
46
|
+
# 📦 AWS Inventory Manager
|
|
47
|
+
|
|
48
|
+
**Track, snapshot, and manage your AWS resources with cost analysis**
|
|
49
|
+
|
|
50
|
+
[](https://github.com/troylar/aws-inventory-manager/actions/workflows/ci.yml)
|
|
51
|
+
[](https://codecov.io/gh/troylar/aws-inventory-manager)
|
|
52
|
+
[](https://pypi.org/project/aws-inventory-manager/)
|
|
53
|
+
[](https://www.python.org/downloads/)
|
|
54
|
+
[](https://opensource.org/licenses/MIT)
|
|
55
|
+
|
|
56
|
+
A Python CLI tool that captures point-in-time snapshots of AWS resources organized by inventory, tracks resource deltas over time, analyzes costs per inventory, and provides restoration capabilities.
|
|
57
|
+
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Features
|
|
63
|
+
|
|
64
|
+
- **📦 Inventory Management**: Organize snapshots into named inventories with optional tag-based filters
|
|
65
|
+
- **📸 Resource Snapshots**: Capture complete inventory of AWS resources across multiple regions
|
|
66
|
+
- **🔄 Delta Tracking**: Identify resources added, modified, or removed since a snapshot
|
|
67
|
+
- **💰 Cost Analysis**: Analyze costs for resources within a specific inventory
|
|
68
|
+
- **🔧 Resource Restoration**: Remove resources added since a snapshot to return to that state
|
|
69
|
+
- **🏷️ Filtered Snapshots**: Create snapshots filtered by tags for specific teams or environments
|
|
70
|
+
- **🔀 Multi-Account Support**: Manage inventories across multiple AWS accounts
|
|
71
|
+
- **📊 Snapshot Management**: Manage multiple snapshots per inventory with active snapshot tracking
|
|
72
|
+
|
|
73
|
+
## Quick Start
|
|
74
|
+
|
|
75
|
+
### Installation
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# Install from PyPI
|
|
79
|
+
pip install aws-inventory-manager
|
|
80
|
+
|
|
81
|
+
# Or install from source
|
|
82
|
+
git clone https://github.com/troylar/aws-inventory-manager.git
|
|
83
|
+
cd aws-inventory-manager
|
|
84
|
+
pip install -e .
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Prerequisites
|
|
88
|
+
|
|
89
|
+
- Python 3.8 or higher
|
|
90
|
+
- AWS CLI configured with credentials
|
|
91
|
+
- IAM permissions for resource read/write operations
|
|
92
|
+
|
|
93
|
+
### Getting Started in 5 Minutes
|
|
94
|
+
|
|
95
|
+
Follow these steps for a complete walkthrough from setup to cost analysis:
|
|
96
|
+
|
|
97
|
+
**1. Create an inventory** (a named collection for organizing snapshots)
|
|
98
|
+
```bash
|
|
99
|
+
awsinv inventory create prod-baseline --description "Production baseline resources"
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**2. Take your first snapshot** (capture current AWS resources)
|
|
103
|
+
```bash
|
|
104
|
+
awsinv snapshot create initial --regions us-east-1 --inventory prod-baseline
|
|
105
|
+
```
|
|
106
|
+
This captures all resources in `us-east-1` and stores them in the `prod-baseline` inventory.
|
|
107
|
+
|
|
108
|
+
**3. Make changes to your AWS environment** (optional)
|
|
109
|
+
- Deploy new resources, update configurations, etc.
|
|
110
|
+
- Then take another snapshot to track what changed
|
|
111
|
+
|
|
112
|
+
**4. Compare snapshots** (see what changed)
|
|
113
|
+
```bash
|
|
114
|
+
awsinv delta --snapshot initial --inventory prod-baseline
|
|
115
|
+
```
|
|
116
|
+
This shows all resources added, removed, or modified since the `initial` snapshot.
|
|
117
|
+
|
|
118
|
+
**5. Analyze costs**
|
|
119
|
+
```bash
|
|
120
|
+
# Costs since snapshot was created
|
|
121
|
+
awsinv cost --snapshot initial --inventory prod-baseline
|
|
122
|
+
|
|
123
|
+
# Costs for specific date range
|
|
124
|
+
awsinv cost --snapshot initial --inventory prod-baseline \
|
|
125
|
+
--start-date 2025-01-01 --end-date 2025-01-31
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**6. List your resources**
|
|
129
|
+
```bash
|
|
130
|
+
# List all inventories
|
|
131
|
+
awsinv inventory list
|
|
132
|
+
|
|
133
|
+
# List snapshots in your inventory
|
|
134
|
+
awsinv snapshot list --inventory prod-baseline
|
|
135
|
+
|
|
136
|
+
# Show snapshot details
|
|
137
|
+
awsinv snapshot show initial --inventory prod-baseline
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
**Advanced: Use AWS profiles and tag filtering**
|
|
141
|
+
```bash
|
|
142
|
+
# Use a specific AWS profile
|
|
143
|
+
awsinv --profile production snapshot create initial --regions us-east-1 --inventory prod-baseline
|
|
144
|
+
|
|
145
|
+
# Filter snapshot by tags (only include resources with specific tags)
|
|
146
|
+
awsinv snapshot create prod-only --regions us-east-1 \
|
|
147
|
+
--include-tags Environment=production,Team=platform
|
|
148
|
+
|
|
149
|
+
# Exclude resources with certain tags
|
|
150
|
+
awsinv snapshot create non-dev --regions us-east-1 \
|
|
151
|
+
--exclude-tags Environment=development
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
That's it! You're now tracking AWS resources, comparing changes, and analyzing costs.
|
|
155
|
+
|
|
156
|
+
### Configuration
|
|
157
|
+
|
|
158
|
+
The tool stores snapshots in `~/.snapshots` by default. You can customize this using:
|
|
159
|
+
|
|
160
|
+
**Environment Variable:**
|
|
161
|
+
```bash
|
|
162
|
+
export AWS_INVENTORY_STORAGE_PATH=/path/to/snapshots
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
**CLI Parameter** (highest priority):
|
|
166
|
+
```bash
|
|
167
|
+
awsinv --storage-path /custom/path inventory list
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
**Precedence:** CLI parameter > Environment variable > Default (`~/.snapshots`)
|
|
171
|
+
|
|
172
|
+
### Basic Usage
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
# Create a named inventory for organizing snapshots
|
|
176
|
+
awsinv inventory create infrastructure \
|
|
177
|
+
--description "Core infrastructure resources"
|
|
178
|
+
|
|
179
|
+
# Create a filtered inventory for a specific team
|
|
180
|
+
awsinv inventory create team-alpha \
|
|
181
|
+
--description "Team Alpha resources" \
|
|
182
|
+
--include-tags "Team=Alpha"
|
|
183
|
+
|
|
184
|
+
# Take a snapshot (automatically uses 'default' inventory if none specified)
|
|
185
|
+
awsinv snapshot create
|
|
186
|
+
|
|
187
|
+
# Take a snapshot within a specific inventory
|
|
188
|
+
awsinv snapshot create --inventory infrastructure
|
|
189
|
+
|
|
190
|
+
# List all inventories
|
|
191
|
+
awsinv inventory list
|
|
192
|
+
|
|
193
|
+
# View what's changed since the snapshot
|
|
194
|
+
awsinv delta
|
|
195
|
+
|
|
196
|
+
# View delta for specific inventory
|
|
197
|
+
awsinv delta --inventory team-alpha
|
|
198
|
+
|
|
199
|
+
# Analyze costs for a specific inventory
|
|
200
|
+
awsinv cost --inventory infrastructure
|
|
201
|
+
|
|
202
|
+
# Analyze costs for team inventory
|
|
203
|
+
awsinv cost --inventory team-alpha
|
|
204
|
+
|
|
205
|
+
# List all snapshots
|
|
206
|
+
awsinv snapshot list
|
|
207
|
+
|
|
208
|
+
# Migrate legacy snapshots to inventory structure
|
|
209
|
+
awsinv inventory migrate
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## Use Cases
|
|
213
|
+
|
|
214
|
+
### Multi-Account Resource Management
|
|
215
|
+
Organize snapshots by AWS account and purpose. Track costs per account.
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
# Create inventory for core infrastructure account
|
|
219
|
+
awsinv inventory create infrastructure \
|
|
220
|
+
--description "Core infrastructure resources"
|
|
221
|
+
|
|
222
|
+
# Take snapshot
|
|
223
|
+
awsinv snapshot create --inventory infrastructure
|
|
224
|
+
|
|
225
|
+
# Analyze costs for this inventory
|
|
226
|
+
awsinv cost --inventory infrastructure
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### Team-Based Resource Tracking
|
|
230
|
+
Create filtered inventories for different teams to track their resources and costs independently.
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
# Create team-specific inventories with tag filters
|
|
234
|
+
awsinv inventory create team-alpha \
|
|
235
|
+
--include-tags "Team=Alpha" \
|
|
236
|
+
--description "Team Alpha resources"
|
|
237
|
+
|
|
238
|
+
awsinv inventory create team-beta \
|
|
239
|
+
--include-tags "Team=Beta" \
|
|
240
|
+
--description "Team Beta resources"
|
|
241
|
+
|
|
242
|
+
# Take filtered snapshots for each team
|
|
243
|
+
awsinv snapshot create --inventory team-alpha
|
|
244
|
+
awsinv snapshot create --inventory team-beta
|
|
245
|
+
|
|
246
|
+
# Analyze costs per team
|
|
247
|
+
awsinv cost --inventory team-alpha
|
|
248
|
+
awsinv cost --inventory team-beta
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### Environment Isolation
|
|
252
|
+
Separate production, staging, and development resources for independent tracking.
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
# Create environment-specific inventories
|
|
256
|
+
awsinv inventory create production \
|
|
257
|
+
--include-tags "Environment=production"
|
|
258
|
+
|
|
259
|
+
awsinv inventory create staging \
|
|
260
|
+
--include-tags "Environment=staging"
|
|
261
|
+
|
|
262
|
+
# Track changes for each environment
|
|
263
|
+
awsinv delta --inventory production
|
|
264
|
+
awsinv delta --inventory staging
|
|
265
|
+
|
|
266
|
+
# Analyze costs per environment
|
|
267
|
+
awsinv cost --inventory production
|
|
268
|
+
awsinv cost --inventory staging
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
## Documentation
|
|
272
|
+
|
|
273
|
+
For complete documentation including installation guide, command reference, usage examples, and best practices, run:
|
|
274
|
+
|
|
275
|
+
```bash
|
|
276
|
+
awsinv --help
|
|
277
|
+
awsinv quickstart
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
## Supported AWS Services
|
|
281
|
+
|
|
282
|
+
The tool captures resources from **25 AWS services**:
|
|
283
|
+
|
|
284
|
+
- **IAM**: Roles, Users, Groups, Customer-Managed Policies
|
|
285
|
+
- **Lambda**: Functions, Layers
|
|
286
|
+
- **S3**: Buckets (with versioning, encryption metadata)
|
|
287
|
+
- **EC2**: Instances, Volumes, VPCs, Security Groups, Subnets, VPC Endpoints (Interface & Gateway)
|
|
288
|
+
- **RDS**: DB Instances, DB Clusters (Aurora)
|
|
289
|
+
- **CloudWatch**: Alarms (Metric & Composite), Log Groups
|
|
290
|
+
- **SNS**: Topics
|
|
291
|
+
- **SQS**: Queues
|
|
292
|
+
- **DynamoDB**: Tables
|
|
293
|
+
- **ELB**: Load Balancers (Classic ELB, ALB, NLB, GWLB)
|
|
294
|
+
- **CloudFormation**: Stacks
|
|
295
|
+
- **API Gateway**: REST APIs, HTTP APIs, WebSocket APIs
|
|
296
|
+
- **EventBridge**: Event Buses, Event Rules
|
|
297
|
+
- **Secrets Manager**: Secrets (metadata only, values excluded)
|
|
298
|
+
- **KMS**: Customer-Managed Keys (with rotation status)
|
|
299
|
+
- **Systems Manager**: Parameter Store Parameters, SSM Documents
|
|
300
|
+
- **Route53**: Hosted Zones (public and private)
|
|
301
|
+
- **ECS**: Clusters, Services, Task Definitions
|
|
302
|
+
- **EKS**: Clusters, Node Groups, Fargate Profiles
|
|
303
|
+
- **Step Functions**: State Machines
|
|
304
|
+
- **WAF**: Web ACLs (Regional and CloudFront)
|
|
305
|
+
- **CodePipeline**: CI/CD Pipelines
|
|
306
|
+
- **CodeBuild**: Build Projects
|
|
307
|
+
- **Backup**: Backup Plans, Backup Vaults
|
|
308
|
+
|
|
309
|
+
## Architecture
|
|
310
|
+
|
|
311
|
+
- **Language**: Python 3.8+
|
|
312
|
+
- **CLI Framework**: Typer
|
|
313
|
+
- **AWS SDK**: boto3
|
|
314
|
+
- **Output**: Rich terminal UI
|
|
315
|
+
- **Storage**: Local YAML files
|
|
316
|
+
|
|
317
|
+
## Development
|
|
318
|
+
|
|
319
|
+
### Setup
|
|
320
|
+
|
|
321
|
+
```bash
|
|
322
|
+
# Install development dependencies
|
|
323
|
+
pip install -e ".[dev]"
|
|
324
|
+
|
|
325
|
+
# Verify installation
|
|
326
|
+
awsinv --help
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
### Testing
|
|
330
|
+
|
|
331
|
+
Use invoke for all development tasks:
|
|
332
|
+
|
|
333
|
+
```bash
|
|
334
|
+
# Run all tests with coverage
|
|
335
|
+
invoke test
|
|
336
|
+
|
|
337
|
+
# Run unit tests only
|
|
338
|
+
invoke test-unit
|
|
339
|
+
|
|
340
|
+
# Run integration tests only
|
|
341
|
+
invoke test-integration
|
|
342
|
+
|
|
343
|
+
# Run tests with verbose output
|
|
344
|
+
invoke test --verbose
|
|
345
|
+
|
|
346
|
+
# Generate HTML coverage report
|
|
347
|
+
invoke coverage-report
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
### Code Quality
|
|
351
|
+
|
|
352
|
+
```bash
|
|
353
|
+
# Run all quality checks (format, lint, typecheck)
|
|
354
|
+
invoke quality
|
|
355
|
+
|
|
356
|
+
# Auto-fix formatting and linting issues
|
|
357
|
+
invoke quality --fix
|
|
358
|
+
|
|
359
|
+
# Format code
|
|
360
|
+
invoke format
|
|
361
|
+
|
|
362
|
+
# Check formatting without changes
|
|
363
|
+
invoke format --check
|
|
364
|
+
|
|
365
|
+
# Lint code
|
|
366
|
+
invoke lint
|
|
367
|
+
|
|
368
|
+
# Auto-fix linting issues
|
|
369
|
+
invoke lint --fix
|
|
370
|
+
|
|
371
|
+
# Type check
|
|
372
|
+
invoke typecheck
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
### Build & Release
|
|
376
|
+
|
|
377
|
+
```bash
|
|
378
|
+
# Clean build artifacts
|
|
379
|
+
invoke clean
|
|
380
|
+
|
|
381
|
+
# Build package
|
|
382
|
+
invoke build
|
|
383
|
+
|
|
384
|
+
# Show version
|
|
385
|
+
invoke version
|
|
386
|
+
|
|
387
|
+
# Run all CI checks (quality + tests)
|
|
388
|
+
invoke ci
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
### Available Invoke Tasks
|
|
392
|
+
|
|
393
|
+
```bash
|
|
394
|
+
# List all available tasks
|
|
395
|
+
invoke --list
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
## Project Structure
|
|
399
|
+
|
|
400
|
+
```
|
|
401
|
+
aws-inventory-manager/
|
|
402
|
+
├── src/
|
|
403
|
+
│ ├── cli/ # CLI entry point and commands
|
|
404
|
+
│ ├── models/ # Data models (Snapshot, Inventory, Resource, etc.)
|
|
405
|
+
│ ├── snapshot/ # Snapshot capture and inventory storage
|
|
406
|
+
│ ├── delta/ # Delta calculation
|
|
407
|
+
│ ├── cost/ # Cost analysis
|
|
408
|
+
│ ├── aws/ # AWS client utilities
|
|
409
|
+
│ └── utils/ # Shared utilities
|
|
410
|
+
├── tests/
|
|
411
|
+
│ ├── unit/ # Unit tests
|
|
412
|
+
│ └── integration/ # Integration tests
|
|
413
|
+
└── ~/.snapshots/ # Default snapshot storage
|
|
414
|
+
├── inventories.yaml # Inventory metadata
|
|
415
|
+
└── snapshots/ # Individual snapshot files
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
## Command Reference
|
|
419
|
+
|
|
420
|
+
### Inventory Commands
|
|
421
|
+
|
|
422
|
+
```bash
|
|
423
|
+
# Create an inventory
|
|
424
|
+
awsinv inventory create <name> \
|
|
425
|
+
[--description "Description"] \
|
|
426
|
+
[--include-tags "Key1=Value1,Key2=Value2"] \
|
|
427
|
+
[--exclude-tags "Key3=Value3"] \
|
|
428
|
+
[--profile <aws-profile>]
|
|
429
|
+
|
|
430
|
+
# List all inventories for current account
|
|
431
|
+
awsinv inventory list [--profile <aws-profile>]
|
|
432
|
+
|
|
433
|
+
# Show detailed inventory information
|
|
434
|
+
awsinv inventory show <name> [--profile <aws-profile>]
|
|
435
|
+
|
|
436
|
+
# Delete an inventory
|
|
437
|
+
awsinv inventory delete <name> \
|
|
438
|
+
[--force] \
|
|
439
|
+
[--profile <aws-profile>]
|
|
440
|
+
|
|
441
|
+
# Migrate legacy snapshots to inventory structure
|
|
442
|
+
awsinv inventory migrate [--profile <aws-profile>]
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
### Snapshot Commands
|
|
446
|
+
|
|
447
|
+
```bash
|
|
448
|
+
# Create a snapshot
|
|
449
|
+
awsinv snapshot create [name] \
|
|
450
|
+
[--inventory <inventory-name>] \
|
|
451
|
+
[--regions <region1,region2>] \
|
|
452
|
+
[--include-tags "Key=Value"] \
|
|
453
|
+
[--exclude-tags "Key=Value"] \
|
|
454
|
+
[--before-date YYYY-MM-DD] \
|
|
455
|
+
[--after-date YYYY-MM-DD] \
|
|
456
|
+
[--compress] \
|
|
457
|
+
[--profile <aws-profile>]
|
|
458
|
+
|
|
459
|
+
# List all snapshots
|
|
460
|
+
awsinv snapshot list [--profile <aws-profile>]
|
|
461
|
+
|
|
462
|
+
# Show snapshot details
|
|
463
|
+
awsinv snapshot show <name> [--profile <aws-profile>]
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
### Analysis Commands
|
|
467
|
+
|
|
468
|
+
```bash
|
|
469
|
+
# View resource delta
|
|
470
|
+
awsinv delta \
|
|
471
|
+
[--inventory <inventory-name>] \
|
|
472
|
+
[--snapshot <snapshot-name>] \
|
|
473
|
+
[--resource-type <type>] \
|
|
474
|
+
[--region <region>] \
|
|
475
|
+
[--show-details] \
|
|
476
|
+
[--export <file.json|file.csv>] \
|
|
477
|
+
[--profile <aws-profile>]
|
|
478
|
+
|
|
479
|
+
# Analyze costs for an inventory
|
|
480
|
+
awsinv cost \
|
|
481
|
+
[--inventory <inventory-name>] \
|
|
482
|
+
[--snapshot <snapshot-name>] \
|
|
483
|
+
[--start-date YYYY-MM-DD] \
|
|
484
|
+
[--end-date YYYY-MM-DD] \
|
|
485
|
+
[--granularity DAILY|MONTHLY] \
|
|
486
|
+
[--show-services] \
|
|
487
|
+
[--export <file.json|file.csv>] \
|
|
488
|
+
[--profile <aws-profile>]
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
## Contributing
|
|
492
|
+
|
|
493
|
+
Contributions are welcome! Please read the contributing guidelines before submitting pull requests.
|
|
494
|
+
|
|
495
|
+
## License
|
|
496
|
+
|
|
497
|
+
MIT License - see LICENSE file for details
|
|
498
|
+
|
|
499
|
+
## Support
|
|
500
|
+
|
|
501
|
+
- Report issues: https://github.com/troylar/aws-inventory-manager/issues
|
|
502
|
+
- Documentation: https://github.com/troylar/aws-inventory-manager#readme
|
|
503
|
+
|
|
504
|
+
---
|
|
505
|
+
|
|
506
|
+
**Version**: 0.2.0
|
|
507
|
+
**Status**: Alpha
|
|
508
|
+
**Python**: 3.8 - 3.13
|