pgp decryption and lambda

0

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

jsonp80
질문됨 일 년 전293회 조회
1개 답변
0

My initial thought is that the construction of the Lambda Layer isn't correct. Have a look at the documentation - and the thing there that has tripped me up in the past is that you must create a directory called python and all the libraries must be installed in that directory. When you create the ZIP file you have to include that directory in the path.

profile pictureAWS
전문가
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인