Netflix-Skunkworks / aardvark

Aardvark is a multi-account AWS IAM Access Advisor API
Apache License 2.0
472 stars 77 forks source link

ProgrammingError: (psycopg2.ProgrammingError) relation "aws_iam_object" does not exist #66

Closed reachyogi101 closed 5 years ago

reachyogi101 commented 5 years ago

Steps to Reproduce: export AARDVARK_ROLE="aardvark" export AARDVARK_DB_URI= "postgresql://{{ aardvark_db_username }}:{{ aardvark_db_password }}@{{ aardvark_rds_dnsrecord }}:5432/aardvark" export AARDVARK_ACCOUNTS="XXXX,XXXXX"

docker run -v aardvark-data:/usr/share/aardvark-data -e AARDVARK_ACCOUNTS --rm aardvark-collector

Actual Error Message: Exception in thread Thread-1: Traceback (most recent call last): File "/usr/local/lib/python2.7/threading.py", line 801, in bootstrap_inner self.run() File "/usr/local/lib/python2.7/site-packages/aardvark/manage.py", line 79, in run persist_aa_data(self.app, aa_data) File "/usr/local/lib/python2.7/site-packages/aardvark/manage.py", line 103, in persist_aa_data item = AWSIAMObject.get_or_create(arn) File "/usr/local/lib/python2.7/site-packages/aardvark/model.py", line 26, in get_or_create item = AWSIAMObject.query.filter(AWSIAMObject.arn == arn).scalar() File "/usr/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 3322, in scalar ret = self.one() File "/usr/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 3292, in one ret = self.one_or_none() File "/usr/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 3261, in one_or_none ret = list(self) File "/usr/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 3334, in iter__ return self._execute_and_instances(context) File "/usr/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 3359, in _execute_and_instances result = conn.execute(querycontext.statement, self._params) File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 988, in execute return meth(self, multiparams, params) File "/usr/local/lib/python2.7/site-packages/sqlalchemy/sql/elements.py", line 287, in _execute_on_connection return connection._execute_clauseelement(self, multiparams, params) File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1107, in _execute_clauseelement distilled_params, File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1253, in _execute_context e, statement, parameters, cursor, context File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1473, in _handle_dbapi_exception util.raise_from_cause(sqlalchemy_exception, exc_info) File "/usr/local/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 398, in raise_from_cause reraise(type(exception), exception, tb=exc_tb, cause=cause) File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1249, in _execute_context cursor, statement, parameters, context File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 552, in do_execute cursor.execute(statement, parameters) ProgrammingError: (psycopg2.ProgrammingError) relation "aws_iam_object" does not exist LINE 2: FROM aws_iam_object ^

[SQL: SELECT aws_iam_object.id AS aws_iam_object_id, aws_iam_object.arn AS aws_iam_object_arn, aws_iam_object."lastUpdated" AS "aws_iam_object_lastUpdated" FROM aws_iam_object WHERE aws_iam_object.arn = %(arn_1)s] [parameters: {'arn_1': 'arn:aws:iam::*:policy/service-r***/'}] (Background on this error at: http://sqlalche.me/e/f405)

mcpeak commented 5 years ago

Hi @reachyogi101 did you run the aardvark create_db command from the README?

reachyogi101 commented 5 years ago

Thanks @mcpeak . There was a create_db step missing in the docker file. Will add that and submit a pull request so others don't get this issue