Post Message From AWS Lambda Service to GCP Pub/Sub

I am posting message to GCP Pub/Sub from AWS Lambda. I am using the Client Libraries to do this work as mentioned in the google documentation.

https://cloud.google.com/pubsub/docs/publisher

When Google.Cloud.PubSub.V1 is added via Nuget, it internally adds the below libraries to the solution libgrpc_csharp_ext.x64.so - Approximately 80MB

libgrpc_csharp_ext.x86.so - Approximately 67MB

While publishing the AWS Lambda application from Visual Studio 2019, error is thrown because of the upload limit (50MB) . Published folder size is more than 50MB even after the folder is zipped.

As a Workaround, I manually deleted the libgrpc_csharp_ext.x86.so file from the publish folder and removed that reference also from .deps.json file and upload the zip file to Lambda.

Is there any easier way of achieving this task? I am not sure if I missed any option.

Upvotes: 0

Views: 2197

Answers (2)

Chris Maggiulli
Chris Maggiulli

Reputation: 3814

S3 Bypass

First create the function with any random zip file under 50MB. For my command I'm assuming your function name is limits-test and your functions deployment package is called function.zip.

Then create an s3 bucket

aws s3 mb s3://limits-test--region us-east-1

Upload your function's deployment package

aws s3 cp ./function.zip s3://limits-bucket/ --recursive --exclude "*" --include "*.zip"

Then update your function to point to s3

aws lambda update-function-code --function-name limits-test --region us-east-1 --s3-bucket limits-bucket --s3-key function.zip

This will bypass the 50MB limit. The limit is now 250MB I believe

Upvotes: 0

guillaume blaquiere
guillaume blaquiere

Reputation: 75745

You can use API call if the libraries can't be installed. You still need to have OAuth2 library to generate an access to put in the header of the request. But the Google OAuth2 lib should be smaller than the big one that you try to install.

Upvotes: 1

Related Questions