Search code examples
python-2.7aws-lambdacredstash

Credstash: 'module' object has no attribute 'get': AttributeError


I am trying to use credstash for accessing credentials stored in KMS, however, even before accessing them, the python 2.7 lambda runtime on aws is giving me an error:

'module' object has no attribute 'get': AttributeError
Traceback (most recent call last):
  File "/var/task/lambda_function.py", line 12, in lambda_handler
    print '%s' %(credstash.get('tv.forecaster.dev.cms.username'))
AttributeError: 'module' object has no attribute 'get'

As there is hardly any info out there, i am struggling with this problem in vain. If anyone can help me solve the problem, I will be highly grateful. Following is my requirements.txt:

credstash==1.13.1
cryptography==2.0.3

I am accessing my credentials like this:

import credstash

string cred = credstash.get('name_of_the_stored_cred_in_dynamodb')

is the way i am accessing the credential using credstash wrong?


Solution

  • I realized the error when i read the source code of credstash.py. Basically it is credstash.getSecret('name_of_cred') and not .get(). It worked magically thereafter. Also, I had to package it on a amazon linux container instead of mac