Skip to content Skip to sidebar Skip to footer

Lamnda Python 3.8 Gpg Decryption Can Not Find Gpg Binary

I'm trying to use a lambda function to decrypt files coming to S3, I download the files without issues, but when I try to decrypt them the gpg can not be found. I;ve tried using bo

Solution 1:

You have to bundle the gpg binary and its dependencies and deliver them in your package. In my package i bundle them into a folder named 'gpg', then when I use gpg in my Lambda function, I do this:

def lambda_handler(event, context):
    old = os.environ.get("LD_LIBRARY_PATH")
    if old:
        os.environ["LD_LIBRARY_PATH"] = "./gpg" + ":" + old
    else:
        os.environ["LD_LIBRARY_PATH"] = "./gpg"
    
    gpg = gnupg.GPG(gnupghome='/tmp', gpgbinary='./gpg/gpg2', verbose=False)

Post a Comment for "Lamnda Python 3.8 Gpg Decryption Can Not Find Gpg Binary"