In this post , we will see How To Fix - Deploying Kafka on AWS Error . While deploying Kafka on AWS , we sometimes see error as below -
kafka.common.KafkaException: Socket server failed to bind to hostname:9092: Cannot assign requested address.
This mostly relates due to the Missing IP Address or IP Address conflict in the configuration. There are two main properties , you need to verify and check if they have been properly defined and used. Both these properties are part of server.properties config file. The properties are - Listeners & Advertised Listeners. Cross-check your server.properties files - I have given a sample as to how these should look like.
\# In Server.properties file , make changes
listeners=PLAINTEXT://<aws-Public-elastic-ip-address>:9092
advertised.listeners=PLAINTEXT://<aws-Public-elastic-ip-address>:9092