I try to use pgp encyption/decryption using lambda and found https://www.youtube.com/watch?v=N3R1SScBS9E&ab_channel=AmazonWebServices
github:
https://github.com/aws-samples/pgp-decryption-for-transfer-family?sc_channel=EL&sc_campaign=Demo_2022_vid&sc_medium=YouTube&sc_content=N3R1SScBS9E&sc_detail=MIGRATION_TRANSFER&sc_country=US
basically i run setupenviroment.sh that create a lambda layer. I then create a very basic lambda funciton
import gnupg
import json
def lambda_handler(event, context):
gpg = gnupg.GPG(gnupghome='/tmp', gpgbinary='/opt/python/gpg', options=['--trust-model', 'always'])
but i am keep getting error
START RequestId: 72c1cffb-12ea-47f6-9d7f-dad91503e8b2 Version: $LATEST
[ERROR] 2023-01-04T16:13:00.757Z 72c1cffb-12ea-47f6-9d7f-dad91503e8b2 Unable to run gpg (/opt/python/gpg) - it may not be available.
Traceback (most recent call last):
File "/opt/python/lib/python3.8/site-packages/gnupg.py", line 941, in init
p = self._open_subprocess(['--version'])
File "/opt/python/lib/python3.8/site-packages/gnupg.py", line 1007, in _open_subprocess
result = Popen(cmd, shell=False, stdin=PIPE, stdout=PIPE, stderr=PIPE, startupinfo=si, env=self.env)
File "/var/lang/lib/python3.8/subprocess.py", line 858, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "/var/lang/lib/python3.8/subprocess.py", line 1704, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/opt/python/gpg'[ERROR] OSError: Unable to run gpg (/opt/python/gpg) - it may not be available.
Traceback (most recent call last):
File "/var/task/lambda_function.py", line 5, in lambda_handler
gpg = gnupg.GPG(gnupghome='/tmp', gpgbinary='/opt/python/gpg', options=['--trust-model', 'always'])
File "/opt/python/lib/python3.8/site-packages/gnupg.py", line 945, in init
raise OSError(msg)END RequestId: 72c1cffb-12ea-47f6-9d7f-dad91503e8b2