vladholubiev / serverless-libreoffice

Run LibreOffice in AWS Lambda to create PDFs & convert documents
https://vladholubiev.com/serverless-libreoffice
513 stars 75 forks source link

it would be nice to split the .zip file from the code #7

Closed mastef closed 6 years ago

mastef commented 6 years ago

First of all - great job on this. I'm enjoying playing around with it.

There was one small hick-up when creating everything with terraform ( the aws_iam_role was created, but it didn't have the aws_iam_role_policy attached to it yet before the lambda was created - as it depends on the lambda function arn. And the lambda function could not be created, because the role did not have a aws_iam_role_policy assigned yet, and lacked the xray:PutTraceSegments and xray:PutTelemetryRecords permission yet ).

I'm not sure if this was an issue with a recent version, but I fixed it by changing the resource limitation in the aws_iam_policy_document to * instead of ${aws_cloudwatch_log_group.convert.arn}. Maybe that's how you started, and then you limited the resources later on?

Now to the issue : It would be nice to split the .zip file from the code - so when working on the lambda code, you don't have to keep uploading the 140-150mb image with it every time. Maybe storing it in s3, or in a different folder would suffice? ( https://stackoverflow.com/a/35188706 )

vladholubiev commented 6 years ago

Hey @mastef, thanks for the appreciation!

You're right, I had exactly such hiccup with IAM! Glad you figured it out, I'm taking a note to update it ✍🏻

Regarding splitting a .zip - it's inside 1 archive for the demo purposes. For the prod, you are on the right track - I'd recommend downloading LibreOffice artifact from S3 (+CloudFront) during the runtime. As a bonus, it's for some reason faster than waiting for AWS to unpack that huge Lambda .zip.

Hope it helps 🙌🏻

vladholubiev commented 6 years ago

Issue with cyclic IAM dependency fixed in https://github.com/vladgolubev/serverless-libreoffice/commit/32079c9855d4a6ea9065832b616e6c1f086b3c68

vladholubiev commented 6 years ago

@mastef check out a new step-by-step guide where I explain how to download .zip on runtime