I have been trying to use packer to create an AMI from Lambda for a particular use case. I am using bash custom runtime environment. I pulled the packer package and unzipped it.
But when I try to run the executable, Lambda throws me out with exit status 1 and the error is not descriptive too. I tried to fix this in a few ways-
Add packer dir path to $PATH, but I am unable to source the .profile or .bashrc, it says they dont exist.
Tried adding a layer with packer executable to Lambda, still does not help.
Code -
echo "Installing Packer..."
curl -qL -o packer.zip https://releases.hashicorp.com/packer/1.1.1/packer_1.1.1_linux_amd64.zip
echo "Unzipping Packer"
unzip packer.zip
echo "Changing permissions on packer"
chmod 777 ./packer
echo "Running Packer Validate"
./packer validate ${LAMBDA_TASK_ROOT}/packer.json
Lambda Console log -
% Total % Received % Xferd Average Speed Time Time
Time Current Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 15.8M 100 15.8M 0 0 48.3M 0 --:--:-- --:--:-- --:--:-- 49.2M
END RequestId: 14cb72cf-c7ff-4a4d-a1c1-99d145395aef
REPORT RequestId: 14cb72cf-c7ff-4a4d-a1c1-99d145395aef Init
Duration: 61.04 ms Duration: 5623.92 ms Billed Duration: 5700 ms Memory Size: 1408 MB Max Memory Used: 274 MB
RequestId: 14cb72cf-c7ff-4a4d-a1c1-99d145395aef Error: Runtime
exited with error: exit status 1
Runtime.ExitError
On a side note, is there anything that can be done to have lambda logs be more descriptive? It does not even print out echo statements if the execution fails?
Has anyone been in this situation before? Any leads would help.
Thanks in advance for the help :)