aws-inventory

Here I am trying out a tool called aws-inventory that attempts to discover created resources within an AWS account. See the aws-inventory homepage for more information.

First use the distributions package manager to install Tkinter:

andy@ubuntu18:~$ sudo apt install python-tk

I am installing aws-inventory into a virtual python environment as described in a previous article.

Create a new Python virtual environment:

andy@ubuntu18:~$ mkproject aws-inventory
Running virtualenv with interpreter /usr/bin/python2
New python executable in /home/andy/.virtualenvs/aws-inventory/bin/python2
Also creating executable in /home/andy/.virtualenvs/aws-inventory/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.
Creating /home/andy/Devel/aws-inventory
Setting project for aws-inventory to /home/andy/Devel/aws-inventory

Clone the repository:

(aws-inventory) andy@ubuntu18:~/Devel/aws-inventory$ git clone https://github.com/nccgroup/aws-inventory.git

Install the required packages:

(aws-inventory) andy@ubuntu18:~/Devel/aws-inventory$ pip install -r aws-inventory/requirements.txt

Run:

(aws-inventory) andy@ubuntu18:~/Devel/aws-inventory$ cd aws-inventory/
(aws-inventory) andy@ubuntu18:~/Devel/aws-inventory/aws-inventory$ python2.7 aws_inventory.py

You should see the below. Click start:

Wait a while….

Quit when complete.

This will generate some HTML and a JSON file that needs to be opened using a web browser. As such you will need to install Firefox (or Chrome):

andy@ubuntu18:~$ sudo apt install firefox

You may also need to create the .Xauthority file to avoid a warning when logging in:

andy@ubuntu18:~$ touch /home/andy/.Xauthority

Now if you type firefox, you should see the remotely installed Firefox instance pop-up:

If this does not work, make sure X11 forwarding is enabled at both the server and client end. On the server, make sure X11 forwarding is enabled:

andy@ubuntu18:~$ grep X11Forwarding /etc/ssh/sshd_config 
X11Forwarding yes
andy@ubuntu18:~$ sudo sshd -t
andy@ubuntu18:~$ sudo systemctl restart sshd.service

Also make sure X11 forwarding is enabled when you SSH to the server by using the -X option.

[andy@home-pc ~]$ ssh -p22 -l andy 192.168.20.124 -X

You can also do the same this by editing the SSH configuration in ~/.ssh/config:

Host aws-inventory
    Hostname 192.168.20.124
    User andy
    Port 22
    ForwardX11 yes

Now if you open up the index.html file with Firefox:

(aws-inventory) andy@bs:~/Devel/aws-inventory/aws-inventory$ firefox gui/dist/index.html

You should see the below:

Click browse and open the ~/Devel/aws-inventory/aws-inventory/gui/aws_inventory_data-default.json file:

You should see:

Lastly click on the inventory tab and browse the resources that were discovered:

Be the first to comment

Leave a Reply