# Client in docker deployed on AWS Lambda

**URL:** <https://forum.confluent.io/t/client-in-docker-deployed-on-aws-lambda/8222>\
**Category:** Containers\
**Created:** [2 July 2023 17:45 UTC](https://forum.confluent.io/t/client-in-docker-deployed-on-aws-lambda/8222 "2023-07-02T17:45:09Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![georgelza](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/georgelza/32/3026_2.png) [@georgelza](https://forum.confluent.io/u/georgelza)\
**Post date:** [2 July 2023 17:45 UTC](https://forum.confluent.io/t/client-in-docker-deployed-on-aws-lambda/8222/1 "2023-07-02T17:45:09Z")

</div>

Hi all

Busy trying to put together a Lambda deployed client.  
there is a couple of ways to do it… but as soon as you introduce external C libraries (as used by confluent\_kakfa when client is Golang based) then the options get less quickly.

The current attempt is following a instruction that copies the golang binary into a AWS provided imaged (specific for lambda), but it now seem to be missing the gcc version and lib low level libraries.

Has anyone deployed their kafka client onto AWS Lambda,  
\<to make it fun for myself, I’m working on a M1 MAC so to make it simpler I’m using a AWS EC2 instance based on the AmazonLinux OS, the same ami that is used for Lambda

Need some assistance please.

G

---

<div class="post-metadata">

**Author:** ![OneCricketeer](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/onecricketeer/32/1551_2.png) [@OneCricketeer](https://forum.confluent.io/u/OneCricketeer)\
**Post date:** [22 August 2023 11:49 UTC](https://forum.confluent.io/t/client-in-docker-deployed-on-aws-lambda/8222/2 "2023-08-22T11:49:25Z")

</div>

> when client is Golang based

Have you tried using sarama or franz-go instead of a librdkafka based one?

I’ve been able to use kafka-python and Java producers in a lambda

---

<div class="post-metadata">

**Author:** ![georgelza](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/georgelza/32/3026_2.png) [@georgelza](https://forum.confluent.io/u/georgelza)\
**Post date:** [24 August 2023 16:58 UTC](https://forum.confluent.io/t/client-in-docker-deployed-on-aws-lambda/8222/3 "2023-08-24T16:58:43Z")

</div>

mind sharing your code.  
please include the Dockerfile  
The Lambda deployment seems to add very specific bits…  
Happy to share my code… [GitHub - georgelza/GoLambdaLoader](https://github.com/georgelza/GoLambdaLoader)

I’m building my docker image on a EC2 instance build using an Amazon Linux AMI, where I installed docker.:

I do a  
make dbuild  
make push

when I try and run a test… I get the below in the logs.

> /main: /lib64/libc.so.6: version `GLIBC\_2.32’ not found (required by /main)

Please help,

G

---

<div class="post-metadata">

**Author:** ![OneCricketeer](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/onecricketeer/32/1551_2.png) [@OneCricketeer](https://forum.confluent.io/u/OneCricketeer)\
**Post date:** [25 August 2023 04:16 UTC](https://forum.confluent.io/t/client-in-docker-deployed-on-aws-lambda/8222/4 "2023-08-25T04:16:34Z")

</div>

Why did you comment out the CGO\_ENABLED=0 line of your Dockerfile?

> <https://stackoverflow.com/questions/65120136/lib64-libc-so-6-version-glibc-2-32-not-found/73927390#73927390>

---

<div class="post-metadata">

**Author:** ![georgelza](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/georgelza/32/3026_2.png) [@georgelza](https://forum.confluent.io/u/georgelza)\
**Post date:** [25 August 2023 05:29 UTC](https://forum.confluent.io/t/client-in-docker-deployed-on-aws-lambda/8222/5 "2023-08-25T05:29:34Z")

</div>

note, see Dockerfile in repo, with it added back in I err out. it now seems to not pull in the dependencies.

NOTE: If I change the Dockerfile to build from fedora, where I then install Golang and do a yum install of gcc then it works… but as we know, for Lambda I need this image as it has the other additional AWS hooks to be used at the time of a S3 event call.

G

> Step 7/12 : ENV CGO\_ENABLED=0  
> —\> Running in ffe4438e5317  
> Removing intermediate container ffe4438e5317  
> —\> 784adc163d99  
> Step 8/12 : RUN go build -trimpath -ldflags=“-s -w” -o main main.go  
> —\> Running in da72994df359
> 
> # command-line-arguments
> 
> ./main.go:58:18: undefined: kafka.Producer  
> ./main.go:171:14: undefined: kafka.ConfigMap  
> ./main.go:183:25: undefined: kafka.NewProducer  
> ./main.go:273:23: undefined: kafka.Message  
> ./main.go:274:28: undefined: kafka.TopicPartition  
> ./main.go:274:86: undefined: kafka.PartitionAny  
> The command ‘/bin/sh -c go build -trimpath -ldflags=“-s -w” -o main main.go’ returned a non-zero code: 1  
> make: \*\*\* [Makefile:20: dbuild] Error 1

---

<div class="post-metadata">

**Author:** ![georgelza](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/georgelza/32/3026_2.png) [@georgelza](https://forum.confluent.io/u/georgelza)\
**Post date:** [25 August 2023 05:35 UTC](https://forum.confluent.io/t/client-in-docker-deployed-on-aws-lambda/8222/6 "2023-08-25T05:35:53Z")

</div>

… it would be bl00dy nice if someone build a docker image that originates out of the amazonlinux 2 root with the required bits added that we can use on Lambda for Confluent Kakfa usage.

above my skill set.

G

---

<div class="post-metadata">

**Author:** ![georgelza](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/georgelza/32/3026_2.png) [@georgelza](https://forum.confluent.io/u/georgelza)\
**Post date:** [25 August 2023 09:10 UTC](https://forum.confluent.io/t/client-in-docker-deployed-on-aws-lambda/8222/7 "2023-08-25T09:10:59Z")

</div>

Got it working using the Fedora base docker image.  
with the building being done on the EC2,  
interesting, it’s working at 5120recs/sec, where as the python version is doing north of 7000.  
unexpected…  
Solution: [GitHub - georgelza/GoLambdaLoader](https://github.com/georgelza/GoLambdaLoader)  
G

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/confluentcommunity/original/1X/c49438c90c9df282e9996fdf6971be890c71b65a.svg) [@system](https://forum.confluent.io/u/system)\
**Post date:** [1 September 2023 09:11 UTC](https://forum.confluent.io/t/client-in-docker-deployed-on-aws-lambda/8222/8 "2023-09-01T09:11:48Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
