GithubHelp home page GithubHelp logo

nccgroup / aws-inventory Goto Github PK

View Code? Open in Web Editor NEW
703.0 21.0 131.0 3.56 MB

Discover resources created in an AWS account.

License: Apache License 2.0

Python 59.68% HTML 15.15% JavaScript 25.07% CSS 0.10%
aws python react

aws-inventory's Introduction

Introduction

This is a tool that tries to discover all AWS resources created in an account. AWS has many products (a.k.a. services) with new ones constantly being added and existing ones expanded with new features. The ecosystem allows users to piece together many different services to form a customized cloud experience. The ability to instantly spin up services at scale comes with a manageability cost. It can quickly become difficult to audit an AWS account for the resources being used. It is not only important for billing purposes, but also for security. Dormant resources and unknown resources are more prone to security configuration weaknesses. Additionally, resources with unexpected dependencies pose availability, access control, and authorization issues.

It uses botocore to discover AWS services and what regions they run in. It is also used in invoking the service APIs. The APIs that are invoked are those which should list or describe resources. The results can be printed to stdout in JSON format. They can also be written across several files:

  • Raw responses from API endpoints can be written to a file specified on the commandline. The file format is Python pickle.
  • Exceptions raised during tool execution can be written to a file specified on the commandline. The file format is Python pickle.
  • gui/aws_inventory_data-<environment_name>.json - JSON format. Parsed responses structured for input to the GUI.

Installation

First, install Python2.7.

There is a small GUI for displaying progress which uses the standard Python Tkinter module. However, the underlying native library code for Tcl/Tk may need extra steps to install. Then,

pip install -r requirements.txt

Windows

Use the Python installer to install Tkinter/Tcl/Tk.

Linux

Use your OS package manager:

Ubuntu / Debian

sudo apt-get install python-tk

Usage

You can run the script without any parameters. It will search for your AWS creds in your shell environment, instance metadata, config file, then credentials file. You can also provide a CSV file, containing your creds, on the commandline. You will want a user that has permissions like the AWS managed policy ViewOnlyAccess. If you are feeling lucky, you could just pipe the output of the tool to a JSON parser like jq.

The tool could take a long time (dozens of minutes) to complete if no restrictions are placed on which operations to invoke for each service across each region. Filtering by service and region can be done on the commandline while filtering by service operation can be done via configuration file. A pre-configured file was created and checked into the repository. It will be used by default.

Aside from the commandline output, you can view the results locally in a React single-page app. No web server needed. Just open the HTML file in a browser and select the generated JSON file when prompted.

The app uses jsTree to display the data in a hierarchical, tree-like structure. There is also a search feature.

NOTE: When invoking APIs, those that raise an exception are not used again regardless of region. Known causes of exceptions are:

  • required API parameter not specified in service model (or the tool is not properly reading model?)
  • insufficient authorization for the selected credentials
  • network error

Examples

  • Run with defaults.

$ python aws_inventory.py

  • List AWS services known to botocore. This is all done locally by reading service model files.
$ python aws_inventory.py --list-svcs
acm
apigateway
application-autoscaling
appstream
autoscaling
batch
budgets
clouddirectory
cloudformation
cloudfront
.
.
.
  • List service operations known to botocore. This is all done locally by reading service model files.
$ python aws_inventory.py --list-operations
[shield]
DescribeSubscription
ListAttacks
ListProtections

[datapipeline]
ListPipelines

[firehose]
ListDeliveryStreams
.
.
.
[glacier]
# NONE

[stepfunctions]
ListActivities
ListStateMachines

Total operations to invoke: 4045
  • Print what APIs would be called for a service. This is all done locally.

$ python aws_inventory.py --debug --dry-run

Screenshots

invoking apis on commandline

data in browser

aws-inventory's People

Contributors

bitsandsalsa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aws-inventory's Issues

TKinter TCL Error no display name and no $DISPLAY environment variable

Traceback (most recent call last):
File "aws_inventory.py", line 334, in
main(parse_args())
File "aws_inventory.py", line 331, in main
aws_inventory.invoker.ApiInvoker(args, service_descriptors, ops_count).start()
File "/home/john_white/aws-inventory/aws_inventory/invoker.py", line 44, in start
self._probe_services)
File "/home/john_white/aws-inventory/aws_inventory/progress.py", line 16, in init
ttk.Frame.init(self, relief='ridge', borderwidth=2)
File "/usr/lib/python2.7/lib-tk/ttk.py", line 738, in init
Widget.init(self, master, "ttk::frame", kw)
File "/usr/lib/python2.7/lib-tk/ttk.py", line 551, in init
master = setup_master(master)
File "/usr/lib/python2.7/lib-tk/ttk.py", line 354, in setup_master
master = Tkinter._default_root or Tkinter.Tk()
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1818, in init
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable

route53 list_resource_record_sets not called

Hi - I noticed that the gui file exports include route53 hosted zones but do not include results of calls to list_resource_record_sets for reach hosted zone. I am guessing because of the way that aws-inventory enumerates APIs that it hasn't figured out that this API can be called if the right parameters are provided. I am sure there are other APIs that are not getting called because of similar issues. Is there a solution to this that I've missed, or suggestions on how to get the resource records included?

Setup Script

Need to add full installation support. Looks like we're missing:

  • setup.py
  • manifest

Nice work!

I didn't see any contact info for on here or your github page, but I just wanted to say I really like the idea of just iterating all of the list and describe calls. Well done.

does not inventory gov cloud regions

I tried to inventory AWS Gov Cloud regions using this tool, however, the tool was not recognizing US GovCloud regions of (us-gov-east-1 and us-gov-west-1).

The problem stems from get_available_regions() call on the session object. By default, it only returns AWS public regions. In order for it to return GovCloud regions (or for that matter China regions), a second argument named partition_name has to be passed in for boto3 to return GovCloud regions list.

I made the brute force change below to get this tool to work with GovCloud accounts.

Modified File: aws-inventory.py

Changed the following line from:
available_regions = frozenset(boto_session.get_available_regions(svc_name))
to:
available_regions = frozenset(boto_session.get_available_regions(svc_name, 'aws-us-gov'))

Similar type of change will be needed to inventory accounts that have resources in AWS China regions.

Thanks.
Khalid

Hosted the report in ec2 Asking for Select data file input

Hi @ncc-erik-steringer

Thank you for making it compatible with python3 much appreciate it !!

Actually, after running the report in ec2 ubuntu instance I've hosted the report as the webserver. But the the the index.html file under the
/gui/dist/ is asking for the .json file as input (aws_inventory_data-default.json) from the local system. So is there any way we can directly open the report in browser without any data file input?

Thank you !!

botocore.exceptions.ClientError: An error occurred (AccessDenied) when calling the AssumeRole operation

Describe the bug
A clear and concise description of what the bug is.
botocore.exceptions.ClientError: An error occurred (AccessDenied) when calling the AssumeRole operation: User: arn:aws:iam::123456789012:user/aws-user is not authorized to perform: sts:AssumeRole on resource: arn:aws:iam::210987654321:role/cross-account-assume-role

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'python aws_inventory.py --profile profile1'

Expected behavior
Should run all the way and output a file.

Screenshots / Stack Traces

Desktop (please complete the following information):

  • OS: MacOS
  • Python Version python 2.7.16

After run the program doesn't exit, "finished" button ghosted

Just finished my first run, 6273 of 6273 checks completed but the program doesn't exit and the "Finished" button on the tk app is ghosted out so can't be clicked.

Terminal output ended at WARNING:aws_inventory.invoker:No work to be done. with no further output.

Ctrl c'd and it exited without writing any files

EDIT: it did write the json output

Unknown encoding: raw-unicode-escape

I get this error when it tries to save the results:

    self.write(UNICODE + obj.encode('raw-unicode-escape') + '\n')
LookupError: unknown encoding: raw-unicode-escape

Looks like it comes from this line:

 pickle.dump(self._response_store, fp)

error: can't start new thread

This is under Windows. Runs for a bit and then errors. I've adjusted the number of threads (even down to 1) and still run into it. I'll dig into it a little more and update this issue if I find anything else.

Where is the output file?

The scan completed. How do I view the output? I opened the index.html file and tried loading the manifest.json and asset-manifest.json but there is nothing there.

The scan showed over 8000 assets being scanned.

Any tips?

Problem installing tkinter on RHEL

yum clean all

uname -a

Linux myvm 3.10.0-862.11.6.el7.x86_64 #1 SMP Fri Aug 10 16:55:11 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

python -V

Python 2.7.5

yum install tkinter

Loaded plugins: langpacks, product-id, rhnplugin, search-disabled-repos, subscription-manager
This system is receiving updates from RHN Classic or Red Hat Satellite.
Resolving Dependencies
--> Running transaction check
---> Package tkinter.x86_64 0:2.7.5-68.el7 will be installed
--> Processing Dependency: python = 2.7.5-68.el7 for package: tkinter-2.7.5-68.el7.x86_64
--> Processing Dependency: libtk8.5.so()(64bit) for package: tkinter-2.7.5-68.el7.x86_64
--> Processing Dependency: libTix.so()(64bit) for package: tkinter-2.7.5-68.el7.x86_64
--> Processing Dependency: libX11.so.6()(64bit) for package: tkinter-2.7.5-68.el7.x86_64
--> Running transaction check
---> Package libX11.x86_64 0:1.6.5-1.el7 will be installed
--> Processing Dependency: libX11-common >= 1.6.5-1.el7 for package: libX11-1.6.5-1.el7.x86_64
--> Processing Dependency: libxcb.so.1()(64bit) for package: libX11-1.6.5-1.el7.x86_64
---> Package tix.x86_64 1:8.4.3-12.el7 will be installed
---> Package tk.x86_64 1:8.5.13-6.el7 will be installed
--> Processing Dependency: libXft.so.2()(64bit) for package: 1:tk-8.5.13-6.el7.x86_64
---> Package tkinter.x86_64 0:2.7.5-68.el7 will be installed
--> Processing Dependency: python = 2.7.5-68.el7 for package: tkinter-2.7.5-68.el7.x86_64
--> Running transaction check
---> Package libX11-common.noarch 0:1.6.5-1.el7 will be installed
---> Package libXft.x86_64 0:2.3.2-2.el7 will be installed
--> Processing Dependency: libXrender.so.1()(64bit) for package: libXft-2.3.2-2.el7.x86_64
---> Package libxcb.x86_64 0:1.12-1.el7 will be installed
--> Processing Dependency: libXau.so.6()(64bit) for package: libxcb-1.12-1.el7.x86_64
---> Package tkinter.x86_64 0:2.7.5-68.el7 will be installed
--> Processing Dependency: python = 2.7.5-68.el7 for package: tkinter-2.7.5-68.el7.x86_64
--> Running transaction check
---> Package libXau.x86_64 0:1.0.8-2.1.el7 will be installed
---> Package libXrender.x86_64 0:0.9.10-1.el7 will be installed
---> Package tkinter.x86_64 0:2.7.5-68.el7 will be installed
--> Processing Dependency: python = 2.7.5-68.el7 for package: tkinter-2.7.5-68.el7.x86_64
--> Finished Dependency Resolution
Error: Package: tkinter-2.7.5-68.el7.x86_64 (prod-rhel-x86_64-server-optional-7)
Requires: python = 2.7.5-68.el7
Installed: python-2.7.5-69.el7_5.x86_64 (@prod-rhel-x86_64-server-7)

python = 2.7.5-69.el7_5
Available: python-2.7.5-16.el7.x86_64 (prod-rhel-x86_64-server-7)
python = 2.7.5-16.el7
Available: python-2.7.5-18.el7_1.1.x86_64 (prod-rhel-x86_64-server-7)
python = 2.7.5-18.el7_1.1
Available: python-2.7.5-34.el7.x86_64 (prod-rhel-x86_64-server-7)
python = 2.7.5-34.el7
Available: python-2.7.5-38.el7_2.x86_64 (prod-rhel-x86_64-server-7)
python = 2.7.5-38.el7_2
Available: python-2.7.5-39.el7_2.x86_64 (prod-rhel-x86_64-server-7)
python = 2.7.5-39.el7_2
Available: python-2.7.5-48.el7.x86_64 (prod-rhel-x86_64-server-7)
python = 2.7.5-48.el7
Available: python-2.7.5-58.el7.x86_64 (prod-rhel-x86_64-server-7)
python = 2.7.5-58.el7
Available: python-2.7.5-68.el7.x86_64 (prod-rhel-x86_64-server-7)
python = 2.7.5-68.el7
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest

Why can't we run without aws_inventory.py UI??? :(

Issue with Dependency

I have installed the requests dependency via pip but the program is not locating it.

After running: python aws_inventory.py

this error is received

Traceback (most recent call last):
File "aws_inventory.py", line 11, in
import aws_inventory.invoker
File "/Users/edwarddevitt/Desktop/aws-inventory-master/aws_inventory/invoker.py", line 8, in
from opinel.utils.credentials import read_creds
File "/Library/Python/2.7/site-packages/opinel/utils/credentials.py", line 11, in
import requests # TODO: get rid of that and make sure urllib2 validates certs ?
ImportError: No module named requests

The strange part is that I have already installed requests.

Errors when running with the defaults

I am using ec2 Linux server having Python 2.7.14 a version for this
Traceback (most recent call last):
File "aws_inventory.py", line 320, in
main(parse_args())
File "aws_inventory.py", line 317, in main
aws_inventory.invoker.ApiInvoker(args, service_descriptors, ops_count).start()
File "/home/ec2-user/aws-inventory/aws_inventory/invoker.py", line 44, in start
self._probe_services)
File "/home/ec2-user/aws-inventory/aws_inventory/progress.py", line 16, in init
ttk.Frame.init(self, relief='ridge', borderwidth=2)
File "/usr/lib64/python2.7/lib-tk/ttk.py", line 738, in init
Widget.init(self, master, "ttk::frame", kw)
File "/usr/lib64/python2.7/lib-tk/ttk.py", line 551, in init
master = setup_master(master)
File "/usr/lib64/python2.7/lib-tk/ttk.py", line 354, in setup_master
master = Tkinter._default_root or Tkinter.Tk()
File "/usr/lib64/python2.7/lib-tk/Tkinter.py", line 1819, in init
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable

ResourceNotFoundException: An error occurred (ResourceNotFoundException) when calling the DescribeEmergencyContactSettings operation: The subscription does not exist.

I am getting the error when i trying to call the API,
ERROR:aws_inventory.invoker:Unknown error while invoking API for service "shield" in region "us-east-1".
Traceback (most recent call last):
File "d:\aws-inventory-master\aws_inventory\invoker.py", line 165, in svc_worker
response = getattr(params['client'], py_op)()
File "C:\Python27\lib\site-packages\botocore\client.py", line 314, in _api_call
return self._make_api_call(operation_name, kwargs)
File "C:\Python27\lib\site-packages\botocore\client.py", line 612, in _make_api_call
raise error_class(parsed_response, operation_name)
ResourceNotFoundException: An error occurred (ResourceNotFoundException) when calling the DescribeDRTAccess operation: The subscription does not exist.

Issues in installation

I am using ec2 linux server. I am facing following issues when iam installing.I believe those are dependency issues. Kindly sort it out

boto3 1.8.2 has requirement botocore<1.12.0,>=1.11.2, but you'll have botocore 1.8.12 which is incompatible.
awscli 1.14.8 has requirement PyYAML<=3.12,>=3.10, but you'll have pyyaml 3.13 which is incompatible.

output file with no desktop

Running EC2 instance of ubuntu 18.04, no desktop.

Even though I installed the python-tk (sudo apt-get install python-tk), I get the following stacktrace which has been mentioned in other issue reports:

Traceback (most recent call last):
File "aws_inventory.py", line 320, in
main(parse_args())
File "aws_inventory.py", line 317, in main
aws_inventory.invoker.ApiInvoker(args, service_descriptors, ops_count).start()
File "/home/ubuntu/aws-inventory/aws_inventory/invoker.py", line 44, in start
self._probe_services)
File "/home/ubuntu/aws-inventory/aws_inventory/progress.py", line 16, in init
ttk.Frame.init(self, relief='ridge', borderwidth=2)
File "/usr/lib/python2.7/lib-tk/ttk.py", line 738, in init
Widget.init(self, master, "ttk::frame", kw)
File "/usr/lib/python2.7/lib-tk/ttk.py", line 551, in init
master = setup_master(master)
File "/usr/lib/python2.7/lib-tk/ttk.py", line 354, in setup_master
master = Tkinter._default_root or Tkinter.Tk()
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1822, in init
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable

running the python -m command also showed the same output

sudo python -m Tkinter
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"main", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 3864, in
_test()
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 3839, in _test
root = Tk()
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1822, in init
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable

What I am looking for is the output file of the scan. I can offload the ~/aws-inventory/gui directory to my Win desktop, get the gui working, but looking for the data file to upload.
not sure if the scan produced an output file due to the error above, but if it has, please provide output location.

Thanks.

Profile was not running And the issue was this can u help me out?

Traceback (most recent call last):
File "aws_inventory.py", line 11, in
import aws_inventory.invoker
File "/home/ec2-user/saipoc/aws-inventory/aws_inventory/invoker.py", line 11, in
import progress
File "/home/ec2-user/saipoc/aws-inventory/aws_inventory/progress.py", line 5, in
import Tkinter as tk
ImportError: No module named Tkinter

Connection timeout & no data-file

Hi,

running inventory seems successful on UI, but it creates no data-file:

ConnectTimeoutError: Connect timeout on endpoint URL: "https://ec2.eu-central-1.amazonaws.com/"
ERROR:aws_inventory.invoker:Unknown error while invoking API for service "ec2" in region "eu-central-1".
Traceback (most recent call last):
  File "D:\applications\aws-inventory-master\aws_inventory\invoker.py", line 163, in svc_worker
    response = getattr(params['client'], py_op)()
  File "C:\Users\michael.fritsch\.windows-build-tools\python27\lib\site-packages\botocore\client.py", line 357, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "C:\Users\michael.fritsch\.windows-build-tools\python27\lib\site-packages\botocore\client.py", line 648, in _make_api_call
    operation_model, request_dict, request_context)
  File "C:\Users\michael.fritsch\.windows-build-tools\python27\lib\site-packages\botocore\client.py", line 667, in _make_request
    return self._endpoint.make_request(operation_model, request_dict)
  File "C:\Users\michael.fritsch\.windows-build-tools\python27\lib\site-packages\botocore\endpoint.py", line 102, in make_request
    return self._send_request(request_dict, operation_model)
  File "C:\Users\michael.fritsch\.windows-build-tools\python27\lib\site-packages\botocore\endpoint.py", line 137, in _send_request
    success_response, exception):
  File "C:\Users\michael.fritsch\.windows-build-tools\python27\lib\site-packages\botocore\endpoint.py", line 231, in _needs_retry
    caught_exception=caught_exception, request_dict=request_dict)
  File "C:\Users\michael.fritsch\.windows-build-tools\python27\lib\site-packages\botocore\hooks.py", line 356, in emit
    return self._emitter.emit(aliased_event_name, **kwargs)
  File "C:\Users\michael.fritsch\.windows-build-tools\python27\lib\site-packages\botocore\hooks.py", line 228, in emit
    return self._emit(event_name, kwargs)
  File "C:\Users\michael.fritsch\.windows-build-tools\python27\lib\site-packages\botocore\hooks.py", line 211, in _emit
    response = handler(**kwargs)
  File "C:\Users\michael.fritsch\.windows-build-tools\python27\lib\site-packages\botocore\retryhandler.py", line 183, in __call__
    if self._checker(attempts, response, caught_exception):
  File "C:\Users\michael.fritsch\.windows-build-tools\python27\lib\site-packages\botocore\retryhandler.py", line 251, in __call__
    caught_exception)
  File "C:\Users\michael.fritsch\.windows-build-tools\python27\lib\site-packages\botocore\retryhandler.py", line 277, in _should_retry
    return self._checker(attempt_number, response, caught_exception)
  File "C:\Users\michael.fritsch\.windows-build-tools\python27\lib\site-packages\botocore\retryhandler.py", line 317, in __call__
    caught_exception)
  File "C:\Users\michael.fritsch\.windows-build-tools\python27\lib\site-packages\botocore\retryhandler.py", line 223, in __call__
    attempt_number, caught_exception)
  File "C:\Users\michael.fritsch\.windows-build-tools\python27\lib\site-packages\botocore\retryhandler.py", line 359, in _check_caught_exception
    raise caught_exception
ConnectTimeoutError: Connect timeout on endpoint URL: "https://ec2.eu-central-1.amazonaws.com/"
DEBUG:aws_inventory.store:Building the GUI data model.
Exception in thread Thread-1:
Traceback (most recent call last):
  File "C:\Users\michael.fritsch\.windows-build-tools\python27\lib\threading.py", line 801, in __bootstrap_inner
    self.run()
  File "C:\Users\michael.fritsch\.windows-build-tools\python27\lib\threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "D:\applications\aws-inventory-master\aws_inventory\invoker.py", line 99, in _probe_services
    self.write_results()
  File "D:\applications\aws-inventory-master\aws_inventory\invoker.py", line 130, in write_results
    self.store.generate_data_file(out_fp)
  File "D:\applications\aws-inventory-master\aws_inventory\store.py", line 148, in generate_data_file
    for service in data[0]['children']:
KeyError: 'children'

Is there any solution?

regards,
Michael

Easy to use, but..

I wanted to thank you that this tool provided what I need and very easy to use, but is there any way I can also get the "Last Modified Date" on the resources detail I got back in the JSON?

Gui remains running, the "Finished" button remains grayed out

Hi,
I am running aws-inventory on my ec2 machine
I created an auditor user with read right on all resources
I run the tool using ssh X11 forwarding and got the gui working fine
When I start the test, the Gui remains running, the "Finished" button remains grayed out and no output file is generated even if I use the option to set output file name and location
Help please, the tool seems interesting and I would like to state whether it can be useful in day-to-day operations
Regards
Enji

Filtering with jq

Hi,

So I am trying to filter the data using jq. What I am after is the instance ids of the ec2 instances. I got to the part where I can see all the outputs of the text key, but then I am not able to drill down further. This is not really a tool specific help, but I am quite sure that some jq filtering examples in the readme.md file may prove beneficial.
If I run jq '.responses[].children[].children[].children[].text' on the aws-inventory/gui/<whatever_data.json> file, I get this:

"DescribeCustomerGateways (1)"
"DescribeIdFormat (1)"
"DescribeNetworkAcls (1)"
"DescribePrefixLists (1)"
"DescribeSpotInstanceRequests"
"DescribeVpcClassicLink (1)"
<SNIPPED>

Now, I want to drill further down and and see things inside of "DescribeInstances (1)". How is that possible?

P.S. I ran the script with --service ec2 only.

issues when running defaults and locally

I am using ubuntu 18 server not a desktop and also performed these 2 commands

pip install botocore 1.11.3
pip install awscli
pip install opinel
but still getting errors. If these commands are wrong then can u please specify the versions for each ?

Traceback (most recent call last):
File "aws_inventory.py", line 320, in
main(parse_args())
File "aws_inventory.py", line 317, in main
aws_inventory.invoker.ApiInvoker(args, service_descriptors, ops_count).start()
File "/home/ubuntu/aws-inventory/aws_inventory/invoker.py", line 44, in start
self._probe_services)
File "/home/ubuntu/aws-inventory/aws_inventory/progress.py", line 16, in init
ttk.Frame.init(self, relief='ridge', borderwidth=2)
File "/usr/lib/python2.7/lib-tk/ttk.py", line 738, in init
Widget.init(self, master, "ttk::frame", kw)
File "/usr/lib/python2.7/lib-tk/ttk.py", line 551, in init
master = setup_master(master)
File "/usr/lib/python2.7/lib-tk/ttk.py", line 354, in setup_master
master = Tkinter._default_root or Tkinter.Tk()
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1822, in init
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable

Does the tool run with python3?

Python2 is deprecated. Trying to run the tool with python3 but getting syntax errors i.e

ubuntu@ip-172-31-40-7:~/nccgroup/aws-inventory$ python3 aws_inventory.py
File "/home/ubuntu/nccgroup/aws-inventory/aws_inventory.py", line 246
print aws_inventory.version
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?

It seems that the python script cannot be executed on python3 after the syntax changes that have been introduced there.

I am using an Ubuntu 20.04 VM. By default, the available python (and pip coming with python) is version 3.x. Even if I manage to install python2.7, pip installs the requirements with the new python3.x versions so I cannot run the script with python2.7. It says that the modules in the requirements are not found when actually the requirements are installed. example:

ubuntu@ip-172-31-40-7:~/nccgroup/aws-inventory$ python2 aws_inventory.py
Traceback (most recent call last):
File "aws_inventory.py", line 6, in
import botocore
ImportError: No module named botocore

ubuntu@ip-172-31-40-7:~/nccgroup/aws-inventory$ pip install -r requirements.txt
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: botocore in /usr/local/lib/python3.10/dist-packages (from -r requirements.txt (line 1)) (1.25.13)
...

I also tried running the tool on an amzn2-linux machine where the environment is python2.7 and I managed the get it running. However, the tool freezes the VM completely at the beginning of the execution. It breaks the GUI and the VM becomes unresponsive. After reading the comments, I understand that this tool is running only on Ubuntu Desktop (GUI) environment with only python2.7. Am I correct? Thanks

ImportError: No module named config

Traceback (most recent call last):
File "aws_inventory.py", line 9, in
import aws_inventory.config
File "/Users/john_white/aws-inventory-master/aws_inventory.py", line 9, in
import aws_inventory.config
ImportError: No module named config

Multiple profiles

I work in an organisation with MANY (100+) accounts. aws-inventory is awesome but it's too tedious to collect data from so many accounts because it has to be invoked multiple times and requires user interaction to start.

I've posted a fork that has the following changes;

  1. Inventory Multiple Profiles - Supports a "--regex" option that causes the "--profile" parameter to be treated as a regular expression. All profiles that match the regex will be collected.
  2. Removed Tk - Removed dependencies on Tk. Replaced the progress functionality with a simpler text progress bar. This also means there's no prompt to "start", which makes multiple-profiles more efficient.
  3. Python 3

It's here https://github.com/t-rojan/aws-inventory

If there is any interest in the above let me know, I'll create a pull.

Getting error in ubuntu

I have installed in ubuntu server and added all the dependiences that was required but still iam facing the issue. Can u help me to sort it out????

Traceback (most recent call last):
File "aws_inventory.py", line 320, in
main(parse_args())
File "aws_inventory.py", line 317, in main
aws_inventory.invoker.ApiInvoker(args, service_descriptors, ops_count).start()
File "/home/ubuntu/saipoc/aws-inventory/aws_inventory/invoker.py", line 44, in start
self._probe_services)
File "/home/ubuntu/saipoc/aws-inventory/aws_inventory/progress.py", line 16, in init
ttk.Frame.init(self, relief='ridge', borderwidth=2)
File "/usr/lib/python2.7/lib-tk/ttk.py", line 738, in init
Widget.init(self, master, "ttk::frame", kw)
File "/usr/lib/python2.7/lib-tk/ttk.py", line 551, in init
master = setup_master(master)
File "/usr/lib/python2.7/lib-tk/ttk.py", line 354, in setup_master
master = Tkinter._default_root or Tkinter.Tk()
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1818, in init
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable

Message length exceeded maximum allowed length.

Description:

Selecting the inventory file on the main page, once the file is loaded, I clicked on the "inventory" tab and a "loading" message is displayed. When I open the developer tools in the browser, the below error is displayed. The "loading" message runs forever...

content-script.js:17 Uncaught TypeError: Error in invocation of runtime.sendMessage(optional string extensionId, any message, optional object options, optional function responseCallback): Message length exceeded maximum allowed length.
    at content-script.js:17
(anonymous) @ content-script.js:17
postMessage (async)
l @ installHook.js:1
window.__REACT_DEVTOOLS_GLOBAL_HOOK__.e.version.t.onCommitFiberRoot @ installHook.js:1
(anonymous) @ main.a4beb15c.js:43472
(anonymous) @ main.a4beb15c.js:43472
$t @ main.a4beb15c.js:43472
fr @ main.a4beb15c.js:43472
dr @ main.a4beb15c.js:43472
lr @ main.a4beb15c.js:43472
sr @ main.a4beb15c.js:43472
or @ main.a4beb15c.js:43472
Zn @ main.a4beb15c.js:43472
enqueueSetState @ main.a4beb15c.js:43472
(anonymous) @ main.a4beb15c.js:43472
(anonymous) @ main.a4beb15c.js:43472
(anonymous) @ main.a4beb15c.js:43472
load (async)
(anonymous) @ main.a4beb15c.js:43472
o @ main.a4beb15c.js:43472
invokeGuardedCallback @ main.a4beb15c.js:43472
invokeGuardedCallbackAndCatchFirstError @ main.a4beb15c.js:43472
u @ main.a4beb15c.js:43472
p @ main.a4beb15c.js:43472
m @ main.a4beb15c.js:43472
f @ main.a4beb15c.js:43472
v @ main.a4beb15c.js:43472
y @ main.a4beb15c.js:43472
He @ main.a4beb15c.js:43472
gr @ main.a4beb15c.js:43472
J @ main.a4beb15c.js:43472
We @ main.a4beb15c.js:43472

The inventory JSON file is > 300 MB

Desktop (please complete the following information):

  • OS: Mac OS X
  • Python Version (python -V): 3.7
  • Commandline used to run tool: python aws_inventory.py
  • Version (aws_inventory.py -V): [e.g. 0.1.1]

Additional context
Add any other context about the problem here. Browser and version?

Error: Connection pool is full

My progress is stuck halfway (6847/12966), receiving following debug output:

WARNING:urllib3.connectionpool:Connection pool is full, discarding connection: ec2.us-east-1.amazonaws.com

UnicodeDecodeError: 'utf8' codec can't decode byte 0x82 in position 1: invalid start byte

When you run the script with the following parameters
python aws_inventory.py --profile my-profile-name --region my-region --debug -v

It breaks up at the end with the following error without writing json file:

DEBUG:aws_inventory.store:Building the response store.
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "/home/pedroj84/aws-inventory/aws_inventory/invoker.py", line 99, in _probe_services
self.write_results()
File "/home/pedroj84/aws-inventory/aws_inventory/invoker.py", line 124, in write_results
print self.store.get_response_store()
File "/home/pedroj84/aws-inventory/aws_inventory/store.py", line 83, in get_response_store
return json.dumps(self._response_store, cls=ResponseEncoder)
File "/usr/lib/python2.7/json/init.py", line 251, in dumps
sort_keys=sort_keys, **kw).encode(obj)
File "/usr/lib/python2.7/json/encoder.py", line 207, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib/python2.7/json/encoder.py", line 270, in iterencode
return _iterencode(o, 0)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x82 in position 1: invalid start byte

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.