Write to kafka topic in a secure way

I'm using filebeat to write logs to Kafka topic. My Kafka server is running on a different ec2 server. I want to create a secure connection between the server from which I'm sending logs and the Kafka server.
Is there a way to achieve this?

Hi,

In filebeat configuration file , Kafka output section, you can enable ssl settings for https for example.