reverse-diagrams 1.3.4__py3-none-any.whl → 2.0.0__py3-none-any.whl
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.
- reverse_diagrams-2.0.0.dist-info/METADATA +706 -0
- reverse_diagrams-2.0.0.dist-info/RECORD +35 -0
- {reverse_diagrams-1.3.4.dist-info → reverse_diagrams-2.0.0.dist-info}/WHEEL +1 -1
- src/aws/client_manager.py +217 -0
- src/aws/describe_identity_store.py +8 -0
- src/aws/describe_organization.py +324 -445
- src/aws/describe_sso.py +170 -143
- src/aws/exceptions.py +26 -0
- src/banner/banner.py +43 -40
- src/config.py +153 -0
- src/models.py +242 -0
- src/plugins/__init__.py +12 -0
- src/plugins/base.py +292 -0
- src/plugins/builtin/__init__.py +12 -0
- src/plugins/builtin/ec2_plugin.py +228 -0
- src/plugins/builtin/identity_center_plugin.py +496 -0
- src/plugins/builtin/organizations_plugin.py +376 -0
- src/plugins/registry.py +126 -0
- src/reports/console_view.py +57 -19
- src/reports/save_results.py +210 -15
- src/reverse_diagrams.py +331 -38
- src/utils/__init__.py +1 -0
- src/utils/cache.py +274 -0
- src/utils/concurrent.py +361 -0
- src/utils/progress.py +257 -0
- src/version.py +1 -1
- reverse_diagrams-1.3.4.dist-info/METADATA +0 -247
- reverse_diagrams-1.3.4.dist-info/RECORD +0 -21
- src/reports/tes.py +0 -366
- {reverse_diagrams-1.3.4.dist-info → reverse_diagrams-2.0.0.dist-info}/entry_points.txt +0 -0
- {reverse_diagrams-1.3.4.dist-info → reverse_diagrams-2.0.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,706 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: reverse_diagrams
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: Continuous Documentation Tool - Documentation as Code Tool - This package create reverse diagrams based on your current state in your cloud environment using diagrams library
|
|
5
|
+
Project-URL: Homepage, https://github.com/velez94/reverse_diagrams
|
|
6
|
+
Project-URL: Bug Tracker, https://github.com/velez94/reverse_diagrams/issues
|
|
7
|
+
Author-email: Alejandro Velez <avelez@labvel.io>
|
|
8
|
+
License: Copyright [2024] [Alejandro Velez]
|
|
9
|
+
|
|
10
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
11
|
+
you may not use this file except in compliance with the License.
|
|
12
|
+
You may obtain a copy of the License at
|
|
13
|
+
|
|
14
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
+
|
|
16
|
+
Unless required by applicable law or agreed to in writing, software
|
|
17
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
18
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19
|
+
See the License for the specific language governing permissions and
|
|
20
|
+
limitations under the License.
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Classifier: Operating System :: OS Independent
|
|
23
|
+
Classifier: Programming Language :: Python :: 3
|
|
24
|
+
Requires-Python: >=3.8
|
|
25
|
+
Requires-Dist: argcomplete>=3.6.3
|
|
26
|
+
Requires-Dist: boto3>=1.42.19
|
|
27
|
+
Requires-Dist: colorama>=0.4.6
|
|
28
|
+
Requires-Dist: diagrams>=0.25.1
|
|
29
|
+
Requires-Dist: emoji>=2.15.0
|
|
30
|
+
Requires-Dist: inquirer>=3.4.1
|
|
31
|
+
Requires-Dist: rich>=14.2.0
|
|
32
|
+
Provides-Extra: dev
|
|
33
|
+
Requires-Dist: black>=23.0.0; extra == 'dev'
|
|
34
|
+
Requires-Dist: flake8>=6.0.0; extra == 'dev'
|
|
35
|
+
Requires-Dist: isort>=5.12.0; extra == 'dev'
|
|
36
|
+
Requires-Dist: mypy>=1.0.0; extra == 'dev'
|
|
37
|
+
Requires-Dist: pre-commit>=3.0.0; extra == 'dev'
|
|
38
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
|
|
39
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
|
|
40
|
+
Requires-Dist: pytest-mock>=3.10.0; extra == 'dev'
|
|
41
|
+
Requires-Dist: pytest>=7.0.0; extra == 'dev'
|
|
42
|
+
Provides-Extra: plugins
|
|
43
|
+
Requires-Dist: importlib-metadata>=4.0.0; extra == 'plugins'
|
|
44
|
+
Provides-Extra: test
|
|
45
|
+
Requires-Dist: moto>=4.2.0; extra == 'test'
|
|
46
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'test'
|
|
47
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == 'test'
|
|
48
|
+
Requires-Dist: pytest-mock>=3.10.0; extra == 'test'
|
|
49
|
+
Requires-Dist: pytest>=7.0.0; extra == 'test'
|
|
50
|
+
Requires-Dist: responses>=0.23.0; extra == 'test'
|
|
51
|
+
Description-Content-Type: text/markdown
|
|
52
|
+
|
|
53
|
+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
|
54
|
+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
|
55
|
+
**Table of Contents**
|
|
56
|
+
|
|
57
|
+
- [Reverse Diagrams](#reverse-diagrams)
|
|
58
|
+
- [Requirement](#requirement)
|
|
59
|
+
- [Install](#install)
|
|
60
|
+
- [Use](#use)
|
|
61
|
+
- [Subcommands](#subcommands)
|
|
62
|
+
- [watch](#watch)
|
|
63
|
+
- [Service supported](#service-supported)
|
|
64
|
+
- [Built-in Services](#built-in-services)
|
|
65
|
+
- [AWS Organizations](#aws-organizations)
|
|
66
|
+
- [Identity and Access Manager Center (SSO)](#identity-and-access-manager-center-sso)
|
|
67
|
+
- [EC2 Infrastructure (Plugin)](#ec2-infrastructure-plugin)
|
|
68
|
+
- [Plugin Architecture](#plugin-architecture)
|
|
69
|
+
- [Using Plugins](#using-plugins)
|
|
70
|
+
- [Creating Custom Plugins](#creating-custom-plugins)
|
|
71
|
+
- [Additional Commands](#additional-commands)
|
|
72
|
+
- [watch](#watch-1)
|
|
73
|
+
- [Options](#options)
|
|
74
|
+
- [Combine the options](#combine-the-options)
|
|
75
|
+
- [Tag-Based Filtering (Coming Soon)](#tag-based-filtering-coming-soon)
|
|
76
|
+
- [Troubleshooting](#troubleshooting)
|
|
77
|
+
- [IAM Identity Center Not Enabled](#iam-identity-center-not-enabled)
|
|
78
|
+
- [AWS Credentials Not Found](#aws-credentials-not-found)
|
|
79
|
+
- [Plugin Not Loading](#plugin-not-loading)
|
|
80
|
+
- [Permission Denied Errors](#permission-denied-errors)
|
|
81
|
+
- [Performance Issues with Large Organizations](#performance-issues-with-large-organizations)
|
|
82
|
+
- [Extras](#extras)
|
|
83
|
+
- [Enable autocomplete](#enable-autocomplete)
|
|
84
|
+
|
|
85
|
+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
|
86
|
+
|
|
87
|
+
# Reverse Diagrams
|
|
88
|
+
|
|
89
|
+
> Continuous Documentation Tool - Documentation as Code Tool
|
|
90
|
+
|
|
91
|
+
This package creates diagrams and helps audit your AWS services from your shell using a modern plugin architecture.
|
|
92
|
+
|
|
93
|
+

|
|
94
|
+
|
|
95
|
+
## What's New in v1.3.5
|
|
96
|
+
|
|
97
|
+
### 🔌 Plugin Architecture
|
|
98
|
+
Extensible system for adding new AWS services with minimal code. Built-in plugins for Organizations, Identity Center, and EC2.
|
|
99
|
+
|
|
100
|
+
**Benefits:**
|
|
101
|
+
- Easy to add new AWS services
|
|
102
|
+
- Consistent interface across all services
|
|
103
|
+
- Automatic plugin discovery
|
|
104
|
+
- Backward compatible with existing commands
|
|
105
|
+
|
|
106
|
+
### 🏗️ Enhanced Error Handling
|
|
107
|
+
Comprehensive error messages with actionable suggestions and graceful fallbacks.
|
|
108
|
+
|
|
109
|
+
**Features:**
|
|
110
|
+
- Clear error messages for common issues
|
|
111
|
+
- Automatic retry with exponential backoff
|
|
112
|
+
- Graceful degradation when services unavailable
|
|
113
|
+
- Detailed logging for troubleshooting
|
|
114
|
+
|
|
115
|
+
### ⚡ Performance Improvements
|
|
116
|
+
Concurrent processing and intelligent caching for faster diagram generation.
|
|
117
|
+
|
|
118
|
+
**Optimizations:**
|
|
119
|
+
- Multi-threaded AWS API calls with `--concurrent` flag
|
|
120
|
+
- TTL-based caching for API responses
|
|
121
|
+
- Connection pooling and reuse
|
|
122
|
+
- Configurable pagination limits
|
|
123
|
+
|
|
124
|
+
### 📊 Progress Tracking
|
|
125
|
+
Rich console output with progress bars, spinners, and status indicators.
|
|
126
|
+
|
|
127
|
+
**Features:**
|
|
128
|
+
- Real-time progress bars for long operations
|
|
129
|
+
- Color-coded status messages
|
|
130
|
+
- Operation-specific tracking
|
|
131
|
+
- Clear success/error feedback
|
|
132
|
+
|
|
133
|
+
### 🎯 Coming Soon: Tag-Based Filtering
|
|
134
|
+
Filter AWS resources by tags when generating diagrams (specification complete, implementation in progress).
|
|
135
|
+
|
|
136
|
+
**Planned capabilities:**
|
|
137
|
+
- Service-specific filtering: `--service-tag ec2 Environment=Production`
|
|
138
|
+
- Account-wide filtering: `--tag Environment=Production`
|
|
139
|
+
- Multiple tags with AND/OR logic
|
|
140
|
+
- Exclude filters and preset management
|
|
141
|
+
|
|
142
|
+
See [Tag-Based Filtering](#tag-based-filtering-coming-soon) section for details.
|
|
143
|
+
|
|
144
|
+
# Requirement
|
|
145
|
+
|
|
146
|
+
AWS programmatic access using AWS CLI. [Configuring the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html)
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
# Install
|
|
150
|
+
|
|
151
|
+
`pip install reverse-diagrams`
|
|
152
|
+
|
|
153
|
+
# Use
|
|
154
|
+
|
|
155
|
+
The following are the available options
|
|
156
|
+
|
|
157
|
+
```commandline
|
|
158
|
+
$ reverse_diagrams -h
|
|
159
|
+
usage: reverse_diagrams [-h] [-p PROFILE] [-od OUTPUT_DIR_PATH] [-r REGION] [-o] [-i] [-a] [--plugin PLUGINS]
|
|
160
|
+
[--list-plugins] [--concurrent] [-v] [-d]
|
|
161
|
+
{watch} ...
|
|
162
|
+
|
|
163
|
+
Create architecture diagram, inspect and audit your AWS services from your current state.
|
|
164
|
+
|
|
165
|
+
options:
|
|
166
|
+
-h, --help show this help message and exit
|
|
167
|
+
-p PROFILE, --profile PROFILE
|
|
168
|
+
AWS cli profile for AWS Apis
|
|
169
|
+
-od OUTPUT_DIR_PATH, --output_dir_path OUTPUT_DIR_PATH
|
|
170
|
+
Name of folder to save the diagrams python code files
|
|
171
|
+
-r REGION, --region REGION
|
|
172
|
+
AWS region
|
|
173
|
+
-o, --graph_organization
|
|
174
|
+
Set if you want to create graph for your organization
|
|
175
|
+
-i, --graph_identity Set if you want to create graph for your IAM Center
|
|
176
|
+
-a, --auto_create Create Automatically diagrams
|
|
177
|
+
--plugin PLUGINS Use specific plugin for diagram generation (e.g., ec2, rds)
|
|
178
|
+
--list-plugins List available plugins
|
|
179
|
+
--concurrent Enable concurrent processing for better performance
|
|
180
|
+
-v, --version Show version
|
|
181
|
+
-d, --debug Debug Mode
|
|
182
|
+
|
|
183
|
+
Commands:
|
|
184
|
+
Command and functionalities
|
|
185
|
+
|
|
186
|
+
{watch} reverse_diagrams Commands
|
|
187
|
+
watch Create pretty console view
|
|
188
|
+
For example: reverse_diagrams watch -wi diagrams/json/account_assignments.json
|
|
189
|
+
|
|
190
|
+
Thanks for using reverse_diagrams!
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
For example:
|
|
194
|
+
|
|
195
|
+
```commandline
|
|
196
|
+
reverse_diagrams -p labvel-master -o -i -r us-east-1
|
|
197
|
+
|
|
198
|
+
❇️ Describe Organization
|
|
199
|
+
❇️ Getting Organization Info
|
|
200
|
+
❇️ Listing Organizational Units
|
|
201
|
+
❇️ Getting the Account list info
|
|
202
|
+
ℹ️ There are 11 Accounts in your organization
|
|
203
|
+
ℹ️ The accounts are stored in diagrams/json/organizations.json
|
|
204
|
+
❇️ Creating diagrams in diagrams/code
|
|
205
|
+
❇️ Getting Identity store instance info
|
|
206
|
+
❇️ List groups
|
|
207
|
+
ℹ️ There are 10 Groups in your Identity Store
|
|
208
|
+
❇️ Get groups and Users info
|
|
209
|
+
Getting groups members... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:07
|
|
210
|
+
Getting account assignments ... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:05:23
|
|
211
|
+
Create user and groups assignments ... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00
|
|
212
|
+
❇️ Getting account assignments, users and groups
|
|
213
|
+
ℹ️ The accounts are stored in diagrams/json/account_assignments.json
|
|
214
|
+
ℹ️ The accounts are stored in diagrams/json/groups.json
|
|
215
|
+
❇️ Creating diagrams in diagrams/code
|
|
216
|
+
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
**Using concurrent processing for better performance:**
|
|
220
|
+
|
|
221
|
+
```commandline
|
|
222
|
+
reverse_diagrams -p labvel-master -o -i --concurrent -r us-east-1
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
**Using specific plugins:**
|
|
226
|
+
|
|
227
|
+
```commandline
|
|
228
|
+
# List available plugins
|
|
229
|
+
reverse_diagrams --list-plugins
|
|
230
|
+
|
|
231
|
+
# Use EC2 plugin
|
|
232
|
+
reverse_diagrams --plugin ec2 -p labvel-master -r us-east-1
|
|
233
|
+
|
|
234
|
+
# Use Organizations plugin explicitly
|
|
235
|
+
reverse_diagrams --plugin organizations -p labvel-master -r us-east-1
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
Then run `python3 graph_org.py` to create a png screenshot (`organizations-state.png`) for your current state.
|
|
239
|
+
|
|
240
|
+
> Both files are saved into the current directory.
|
|
241
|
+
|
|
242
|
+
```commandline
|
|
243
|
+
$ reverse_diagrams -p labvel-master -o -r us-east-2
|
|
244
|
+
Date: 2022-12-17 22:44:07.623260
|
|
245
|
+
❇️ Getting Organization Info
|
|
246
|
+
❇️ The Organizational Units list
|
|
247
|
+
❇️ Getting the Account list info
|
|
248
|
+
Run -> python3 graph_org.py
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
$ python3 graph_org.py
|
|
252
|
+
$ ls
|
|
253
|
+
graph_org.py
|
|
254
|
+
organizations-state.png
|
|
255
|
+
```
|
|
256
|
+
For example:
|
|
257
|
+
|
|
258
|
+

|
|
259
|
+
|
|
260
|
+
Now you can edit `graph_org.py` file or add to your repositories for keeping the documentation update.
|
|
261
|
+
|
|
262
|
+
## Output Files
|
|
263
|
+
|
|
264
|
+
The tool generates several types of output files organized in the `diagrams/` directory:
|
|
265
|
+
|
|
266
|
+
### Directory Structure
|
|
267
|
+
```
|
|
268
|
+
diagrams/
|
|
269
|
+
├── json/ # Raw AWS data exports
|
|
270
|
+
│ ├── organizations.json # Organization structure
|
|
271
|
+
│ ├── organizations_complete.json
|
|
272
|
+
│ ├── groups.json # Identity Center groups
|
|
273
|
+
│ ├── account_assignments.json
|
|
274
|
+
│ └── *_data.json # Plugin-generated data
|
|
275
|
+
├── code/ # Generated Python diagram code
|
|
276
|
+
│ ├── graph_org.py # Organizations diagram script
|
|
277
|
+
│ ├── graph_sso.py # SSO diagram script
|
|
278
|
+
│ └── graph_*.py # Plugin-generated scripts
|
|
279
|
+
└── images/ # Generated diagram images
|
|
280
|
+
└── *.png # Diagram output files
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
### JSON Files
|
|
284
|
+
JSON files contain the raw AWS data collected from your account. These files can be:
|
|
285
|
+
- Used with the `watch` command for console viewing
|
|
286
|
+
- Imported into other tools for analysis
|
|
287
|
+
- Version controlled to track infrastructure changes over time
|
|
288
|
+
- Shared with team members for documentation
|
|
289
|
+
|
|
290
|
+
### Python Diagram Code
|
|
291
|
+
Generated Python files use the [diagrams](https://diagrams.mingrammer.com/) library to create visual representations. You can:
|
|
292
|
+
- Edit the code to customize diagram appearance
|
|
293
|
+
- Add additional resources manually
|
|
294
|
+
- Integrate into CI/CD pipelines
|
|
295
|
+
- Version control alongside your infrastructure code
|
|
296
|
+
|
|
297
|
+
### Running Generated Diagrams
|
|
298
|
+
```commandline
|
|
299
|
+
# Navigate to the code directory
|
|
300
|
+
cd diagrams/code
|
|
301
|
+
|
|
302
|
+
# Run the generated script
|
|
303
|
+
python3 graph_org.py
|
|
304
|
+
|
|
305
|
+
# View the generated PNG
|
|
306
|
+
ls -la *.png
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
## Subcommands
|
|
310
|
+
|
|
311
|
+
### watch
|
|
312
|
+
|
|
313
|
+
Watch the result in console with a beautiful print style.
|
|
314
|
+
```commandline
|
|
315
|
+
reverse_diagrams watch -h
|
|
316
|
+
usage: reverse_diagrams watch [-h] [-wo WATCH_GRAPH_ORGANIZATION] [-wi WATCH_GRAPH_IDENTITY] [-wa WATCH_GRAPH_ACCOUNTS_ASSIGNMENTS]
|
|
317
|
+
|
|
318
|
+
Create view of diagrams in console based on kind of diagram and json file.
|
|
319
|
+
|
|
320
|
+
options:
|
|
321
|
+
-h, --help show this help message and exit
|
|
322
|
+
|
|
323
|
+
Create view of diagrams in console based on kind of diagram and json file.:
|
|
324
|
+
-wo WATCH_GRAPH_ORGANIZATION, --watch_graph_organization WATCH_GRAPH_ORGANIZATION
|
|
325
|
+
Set if you want to see graph for your organization structure summary. For example: reverse_diagrams watch watch -wi diagrams/json/organizations.json
|
|
326
|
+
-wi WATCH_GRAPH_IDENTITY, --watch_graph_identity WATCH_GRAPH_IDENTITY
|
|
327
|
+
Set if you want to see graph for your groups and users. For example: reverse_diagrams watch watch -wi diagrams/json/groups.json
|
|
328
|
+
-wa WATCH_GRAPH_ACCOUNTS_ASSIGNMENTS, --watch_graph_accounts_assignments WATCH_GRAPH_ACCOUNTS_ASSIGNMENTS
|
|
329
|
+
Set if you want to see graph for your IAM Center- Accounts assignments. For example: reverse_diagrams watch watch -wi
|
|
330
|
+
diagrams/json/account_assignments.json.jso
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
# Service supported
|
|
334
|
+
|
|
335
|
+
The tool uses a modern plugin architecture that makes it easy to extend with new AWS services.
|
|
336
|
+
|
|
337
|
+
## Built-in Services
|
|
338
|
+
|
|
339
|
+
### AWS Organizations
|
|
340
|
+
|
|
341
|
+
Generate diagrams of your AWS Organizations structure including organizational units, accounts, and hierarchies.
|
|
342
|
+
|
|
343
|
+
```commandline
|
|
344
|
+
reverse_diagrams -p my-profile -o -r us-east-2
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
**Features:**
|
|
348
|
+
- Visualize organizational unit hierarchies
|
|
349
|
+
- Map account relationships
|
|
350
|
+
- Show complete organization structure
|
|
351
|
+
- Export to JSON and PNG formats
|
|
352
|
+
|
|
353
|
+
### Identity and Access Manager Center (SSO)
|
|
354
|
+
|
|
355
|
+
Create diagrams for IAM Identity Center configurations including groups, users, and permission assignments.
|
|
356
|
+
|
|
357
|
+
```commandline
|
|
358
|
+
reverse_diagrams -p my-profile -i -r us-east-2
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
**Features:**
|
|
362
|
+
- Map groups and users
|
|
363
|
+
- Visualize permission sets
|
|
364
|
+
- Show account assignments
|
|
365
|
+
- Track group memberships
|
|
366
|
+
|
|
367
|
+
**Note:** Requires IAM Identity Center to be enabled in your AWS account. If not enabled, you'll receive a clear error message with instructions.
|
|
368
|
+
|
|
369
|
+
### EC2 Infrastructure (Plugin)
|
|
370
|
+
|
|
371
|
+
Generate diagrams for EC2 instances, VPCs, security groups, and related networking resources.
|
|
372
|
+
|
|
373
|
+
```commandline
|
|
374
|
+
reverse_diagrams --plugin ec2 -p my-profile -r us-east-2
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
**Features:**
|
|
378
|
+
- VPC and subnet visualization
|
|
379
|
+
- EC2 instance mapping
|
|
380
|
+
- Security group relationships
|
|
381
|
+
- Network topology
|
|
382
|
+
|
|
383
|
+
## Plugin Architecture
|
|
384
|
+
|
|
385
|
+
The tool supports extensible plugins for adding new AWS services. Each plugin can:
|
|
386
|
+
- Collect data from specific AWS services
|
|
387
|
+
- Generate custom diagram code
|
|
388
|
+
- Export data in JSON format
|
|
389
|
+
- Integrate with the concurrent processing system
|
|
390
|
+
|
|
391
|
+
### Using Plugins
|
|
392
|
+
|
|
393
|
+
**List available plugins:**
|
|
394
|
+
```commandline
|
|
395
|
+
reverse_diagrams --list-plugins
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
**Use a specific plugin:**
|
|
399
|
+
```commandline
|
|
400
|
+
reverse_diagrams --plugin ec2 -p my-profile -r us-east-2
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
**Enable concurrent processing for better performance:**
|
|
404
|
+
```commandline
|
|
405
|
+
reverse_diagrams -o -i --concurrent -p my-profile -r us-east-2
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
### Creating Custom Plugins
|
|
409
|
+
|
|
410
|
+
To create a custom plugin:
|
|
411
|
+
|
|
412
|
+
1. Extend the `AWSServicePlugin` base class
|
|
413
|
+
2. Implement required methods: `collect_data()` and `generate_diagram_code()`
|
|
414
|
+
3. Define plugin metadata (name, version, AWS services)
|
|
415
|
+
4. Place in `src/plugins/builtin/` or external plugin directory
|
|
416
|
+
|
|
417
|
+
Example plugin structure:
|
|
418
|
+
```python
|
|
419
|
+
from src.plugins.base import AWSServicePlugin, PluginMetadata
|
|
420
|
+
|
|
421
|
+
class MyServicePlugin(AWSServicePlugin):
|
|
422
|
+
@property
|
|
423
|
+
def metadata(self) -> PluginMetadata:
|
|
424
|
+
return PluginMetadata(
|
|
425
|
+
name="myservice",
|
|
426
|
+
version="1.0.0",
|
|
427
|
+
description="My AWS service plugin",
|
|
428
|
+
author="Your Name",
|
|
429
|
+
aws_services=["myservice"]
|
|
430
|
+
)
|
|
431
|
+
|
|
432
|
+
def collect_data(self, client_manager, region, **kwargs):
|
|
433
|
+
# Collect data from AWS
|
|
434
|
+
pass
|
|
435
|
+
|
|
436
|
+
def generate_diagram_code(self, data, config):
|
|
437
|
+
# Generate diagram code
|
|
438
|
+
pass
|
|
439
|
+
```
|
|
440
|
+
# Additional Commands
|
|
441
|
+
|
|
442
|
+
## watch
|
|
443
|
+
You can watch the configuration and summary in your shell based on json files generated previously.
|
|
444
|
+
|
|
445
|
+
### Options
|
|
446
|
+
|
|
447
|
+
```commandline
|
|
448
|
+
$ reverse_diagrams watch -h
|
|
449
|
+
usage: reverse_diagrams watch [-h] [-wo WATCH_GRAPH_ORGANIZATION] [-wi WATCH_GRAPH_IDENTITY] [-wa WATCH_GRAPH_ACCOUNTS_ASSIGNMENTS]
|
|
450
|
+
|
|
451
|
+
Create view of diagrams in console based on kind of diagram and json file.
|
|
452
|
+
|
|
453
|
+
options:
|
|
454
|
+
-h, --help show this help message and exit
|
|
455
|
+
|
|
456
|
+
Create view of diagrams in console based on kind of diagram and json file.:
|
|
457
|
+
-wo WATCH_GRAPH_ORGANIZATION, --watch_graph_organization WATCH_GRAPH_ORGANIZATION
|
|
458
|
+
Set if you want to see graph for your organization structure summary. For example: reverse_diagrams watch watch -wo diagrams/json/organizations.json
|
|
459
|
+
-wi WATCH_GRAPH_IDENTITY, --watch_graph_identity WATCH_GRAPH_IDENTITY
|
|
460
|
+
Set if you want to see graph for your groups and users. For example: reverse_diagrams watch watch -wi diagrams/json/groups.json
|
|
461
|
+
-wa WATCH_GRAPH_ACCOUNTS_ASSIGNMENTS, --watch_graph_accounts_assignments WATCH_GRAPH_ACCOUNTS_ASSIGNMENTS
|
|
462
|
+
Set if you want to see graph for your IAM Center- Accounts assignments. For example: reverse_diagrams watch watch -wa diagrams/json/account_assignments.json
|
|
463
|
+
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
For example, to watch account assignments:
|
|
467
|
+
|
|
468
|
+

|
|
469
|
+
|
|
470
|
+
### Combine the options
|
|
471
|
+
|
|
472
|
+
```commandline
|
|
473
|
+
reverse_diagrams -p my-profile -o -i -r us-east-2
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
## Tag-Based Filtering (Coming Soon)
|
|
477
|
+
|
|
478
|
+
Filter AWS resources by tags when generating diagrams. This feature is currently in specification and will be available in a future release.
|
|
479
|
+
|
|
480
|
+
**Planned capabilities:**
|
|
481
|
+
|
|
482
|
+
**Service-specific filtering** - Filter only specific services:
|
|
483
|
+
```commandline
|
|
484
|
+
# Filter only EC2 instances by environment tag
|
|
485
|
+
reverse_diagrams --service-tag ec2 Environment=Production -p my-profile -r us-east-1
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
**Account-wide filtering** - Apply filters across all services:
|
|
489
|
+
```commandline
|
|
490
|
+
# Filter all services by environment tag
|
|
491
|
+
reverse_diagrams -o -i --tag Environment=Production -p my-profile -r us-east-1
|
|
492
|
+
|
|
493
|
+
# Multiple tags with AND logic
|
|
494
|
+
reverse_diagrams -o --tag Environment=Production --tag Team=DevOps -p my-profile
|
|
495
|
+
|
|
496
|
+
# Multiple tags with OR logic
|
|
497
|
+
reverse_diagrams -o --tag Environment=Production --tag Environment=Staging --tag-logic OR -p my-profile
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
**Exclude filters** - Exclude resources with specific tags:
|
|
501
|
+
```commandline
|
|
502
|
+
reverse_diagrams -o --tag Environment=Production --exclude-tag Status=Deprecated -p my-profile
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
**Filter presets** - Save and reuse common filter configurations:
|
|
506
|
+
```commandline
|
|
507
|
+
# Save a preset
|
|
508
|
+
reverse_diagrams --tag Environment=Production --save-preset prod-only
|
|
509
|
+
|
|
510
|
+
# Use a preset
|
|
511
|
+
reverse_diagrams -o -i --preset prod-only -p my-profile
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
For more details, see the specification in `.kiro/specs/tag-based-filtering/`.
|
|
515
|
+
|
|
516
|
+
## Troubleshooting
|
|
517
|
+
|
|
518
|
+
### IAM Identity Center Not Enabled
|
|
519
|
+
|
|
520
|
+
**Error:** "list index out of range" when using `-i` flag
|
|
521
|
+
|
|
522
|
+
**Cause:** Your AWS account doesn't have IAM Identity Center (formerly AWS SSO) enabled.
|
|
523
|
+
|
|
524
|
+
**Solution:**
|
|
525
|
+
1. Go to AWS Console
|
|
526
|
+
2. Navigate to IAM Identity Center
|
|
527
|
+
3. Enable the service
|
|
528
|
+
4. Run the command again: `reverse_diagrams -i -p my-profile -r us-east-1`
|
|
529
|
+
|
|
530
|
+
**Workaround:** Use only the `-o` flag for Organizations diagrams if you don't need Identity Center.
|
|
531
|
+
|
|
532
|
+
### AWS Credentials Not Found
|
|
533
|
+
|
|
534
|
+
**Error:** "No AWS credentials found"
|
|
535
|
+
|
|
536
|
+
**Cause:** AWS CLI is not configured or the specified profile doesn't exist.
|
|
537
|
+
|
|
538
|
+
**Solution:**
|
|
539
|
+
1. Configure AWS CLI: `aws configure --profile my-profile`
|
|
540
|
+
2. Or set environment variables:
|
|
541
|
+
```bash
|
|
542
|
+
export AWS_ACCESS_KEY_ID=your_key
|
|
543
|
+
export AWS_SECRET_ACCESS_KEY=your_secret
|
|
544
|
+
export AWS_DEFAULT_REGION=us-east-1
|
|
545
|
+
```
|
|
546
|
+
3. Verify credentials: `aws sts get-caller-identity --profile my-profile`
|
|
547
|
+
|
|
548
|
+
### Plugin Not Loading
|
|
549
|
+
|
|
550
|
+
**Issue:** Plugins show as available but don't load when used
|
|
551
|
+
|
|
552
|
+
**Cause:** Import issues in installed package (fallback to original implementations works)
|
|
553
|
+
|
|
554
|
+
**Workaround:** The tool automatically falls back to the original implementations, which work perfectly. This doesn't affect functionality.
|
|
555
|
+
|
|
556
|
+
### Permission Denied Errors
|
|
557
|
+
|
|
558
|
+
**Error:** "Access Denied" when collecting AWS data
|
|
559
|
+
|
|
560
|
+
**Cause:** IAM user/role lacks required permissions.
|
|
561
|
+
|
|
562
|
+
**Solution:** Ensure your IAM user/role has these permissions:
|
|
563
|
+
- Organizations: `organizations:Describe*`, `organizations:List*`
|
|
564
|
+
- Identity Center: `sso:Describe*`, `sso:List*`, `identitystore:Describe*`, `identitystore:List*`
|
|
565
|
+
- EC2: `ec2:Describe*`
|
|
566
|
+
|
|
567
|
+
### Performance Issues with Large Organizations
|
|
568
|
+
|
|
569
|
+
**Issue:** Slow diagram generation for organizations with many accounts
|
|
570
|
+
|
|
571
|
+
**Solution:** Enable concurrent processing:
|
|
572
|
+
```commandline
|
|
573
|
+
reverse_diagrams -o -i --concurrent -p my-profile -r us-east-1
|
|
574
|
+
```
|
|
575
|
+
|
|
576
|
+
This uses multi-threading to speed up AWS API calls significantly.
|
|
577
|
+
|
|
578
|
+
## Extras
|
|
579
|
+
|
|
580
|
+
### Configuration
|
|
581
|
+
|
|
582
|
+
The tool supports configuration through environment variables for advanced use cases:
|
|
583
|
+
|
|
584
|
+
**AWS Configuration:**
|
|
585
|
+
```bash
|
|
586
|
+
export AWS_PROFILE=my-profile
|
|
587
|
+
export AWS_DEFAULT_REGION=us-east-1
|
|
588
|
+
export AWS_ACCESS_KEY_ID=your_key
|
|
589
|
+
export AWS_SECRET_ACCESS_KEY=your_secret
|
|
590
|
+
```
|
|
591
|
+
|
|
592
|
+
**Tool Configuration:**
|
|
593
|
+
```bash
|
|
594
|
+
# Enable debug logging
|
|
595
|
+
export REVERSE_DIAGRAMS_DEBUG=true
|
|
596
|
+
|
|
597
|
+
# Set custom output directory
|
|
598
|
+
export REVERSE_DIAGRAMS_OUTPUT_DIR=my-diagrams
|
|
599
|
+
|
|
600
|
+
# Configure concurrent processing
|
|
601
|
+
export REVERSE_DIAGRAMS_CONCURRENT=true
|
|
602
|
+
|
|
603
|
+
# Set pagination limits
|
|
604
|
+
export REVERSE_DIAGRAMS_MAX_ITEMS=1000
|
|
605
|
+
```
|
|
606
|
+
|
|
607
|
+
**Logging:**
|
|
608
|
+
The tool uses Python's logging module. Set the log level:
|
|
609
|
+
```bash
|
|
610
|
+
export REVERSE_DIAGRAMS_LOG_LEVEL=DEBUG # DEBUG, INFO, WARNING, ERROR
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
### Enable autocomplete
|
|
614
|
+
Argcomplete provides easy, extensible command line tab completion of arguments for your Python application.
|
|
615
|
+
|
|
616
|
+
It makes two assumptions:
|
|
617
|
+
|
|
618
|
+
* You’re using bash or zsh as your shell
|
|
619
|
+
|
|
620
|
+
* You’re using argparse to manage your command line arguments/options
|
|
621
|
+
|
|
622
|
+
Argcomplete is particularly useful if your program has lots of options or subparsers, and if your program can dynamically suggest completions for your argument/option values (for example, if the user is browsing resources over the network).
|
|
623
|
+
Run:
|
|
624
|
+
```bash
|
|
625
|
+
activate-global-python-argcomplete
|
|
626
|
+
```
|
|
627
|
+
and to make sure that bash knows about this script, you use
|
|
628
|
+
```bash
|
|
629
|
+
|
|
630
|
+
echo 'eval "$(register-python-argcomplete reverse_diagrams)"' >> ~/.bashrc
|
|
631
|
+
source ~/.bashrc
|
|
632
|
+
|
|
633
|
+
```
|
|
634
|
+
|
|
635
|
+
## Contributing
|
|
636
|
+
|
|
637
|
+
Contributions are welcome! Here are some ways you can contribute:
|
|
638
|
+
|
|
639
|
+
### Report Issues
|
|
640
|
+
- Bug reports
|
|
641
|
+
- Feature requests
|
|
642
|
+
- Documentation improvements
|
|
643
|
+
|
|
644
|
+
### Create Plugins
|
|
645
|
+
Extend the tool with new AWS services by creating plugins. See [Creating Custom Plugins](#creating-custom-plugins) for details.
|
|
646
|
+
|
|
647
|
+
### Improve Core Features
|
|
648
|
+
- Performance optimizations
|
|
649
|
+
- Error handling improvements
|
|
650
|
+
- Test coverage
|
|
651
|
+
- Documentation
|
|
652
|
+
|
|
653
|
+
### Development Setup
|
|
654
|
+
```bash
|
|
655
|
+
# Clone the repository
|
|
656
|
+
git clone https://github.com/yourusername/reverse-diagrams.git
|
|
657
|
+
cd reverse-diagrams
|
|
658
|
+
|
|
659
|
+
# Install in development mode
|
|
660
|
+
pip install -e .
|
|
661
|
+
|
|
662
|
+
# Run tests
|
|
663
|
+
pytest
|
|
664
|
+
|
|
665
|
+
# Run linting
|
|
666
|
+
black src/ tests/
|
|
667
|
+
flake8 src/ tests/
|
|
668
|
+
mypy src/
|
|
669
|
+
```
|
|
670
|
+
|
|
671
|
+
## License
|
|
672
|
+
|
|
673
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
674
|
+
|
|
675
|
+
## Support
|
|
676
|
+
|
|
677
|
+
- **Documentation**: See this README and the [docs/](docs/) directory
|
|
678
|
+
- **Issues**: Report bugs and request features via GitHub Issues
|
|
679
|
+
- **Discussions**: Join the conversation in GitHub Discussions
|
|
680
|
+
|
|
681
|
+
## Roadmap
|
|
682
|
+
|
|
683
|
+
### Current Version (v1.3.5)
|
|
684
|
+
- ✅ Plugin architecture
|
|
685
|
+
- ✅ Enhanced error handling
|
|
686
|
+
- ✅ Performance improvements
|
|
687
|
+
- ✅ Progress tracking
|
|
688
|
+
|
|
689
|
+
### Upcoming Features
|
|
690
|
+
- 🎯 Tag-based filtering (specification complete)
|
|
691
|
+
- 🔄 Additional AWS service plugins (RDS, Lambda, VPC, S3)
|
|
692
|
+
- 📊 Enhanced diagram customization
|
|
693
|
+
- 🔍 Resource search and filtering
|
|
694
|
+
- 📈 Historical tracking and diff visualization
|
|
695
|
+
- 🌐 Multi-region support
|
|
696
|
+
- 🔐 Enhanced security analysis
|
|
697
|
+
|
|
698
|
+
## Acknowledgments
|
|
699
|
+
|
|
700
|
+
- Built with [diagrams](https://diagrams.mingrammer.com/) library
|
|
701
|
+
- Uses [boto3](https://boto3.amazonaws.com/v1/documentation/api/latest/index.html) for AWS API interactions
|
|
702
|
+
- Console output powered by [rich](https://rich.readthedocs.io/)
|
|
703
|
+
|
|
704
|
+
---
|
|
705
|
+
|
|
706
|
+
**Made with ❤️ for AWS infrastructure documentation**
|