janiko71 / aws-inventory

Python script for AWS resources inventory (cheaper than AWS Config)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why config.global_inventory is empty?

januradha opened this issue · comments

global_inventory = {}

since config.global_inventory list is empty so getting below error

Error :
Traceback (most recent call last):
File "/var/task/call_aws_inventory.py", line 5, in get_aws_inventory
inventory.call_inventory()
File "/var/task/inventory.py", line 123, in call_inventory
inventory[svc] = config.global_inventory[svc]
KeyError: 's3'

Hi, thank you for your feedback. It seems that you don't use the script directly but from your own program. Could you tell me:

  1. Is the output file OK? In the folder 'output' you should find a AWS_xxxxx.json file with the inventory.
  2. How to you call the inventory in your python? My script is not a module, the variables I use in it may be out of the scope of your programm, see https://docs.python.org/3/reference/executionmodel.html.

It's fixed.Anyway Thanks for Reply also.