title: Not able to connect to Kafka on AWS EC2
body: <p>I created an Ubuntu VM on AWS EC2 and in this same VM I'm running one instance of Zookeeper and one instance of Kafka. The Zookeeper and Kafka are running just fine, I was even able to create a topic, however, when I tried to connect from my local machine (macOS) from the terminal I get this message:</p>
  
  <pre><code>Producer clientId=console-producer] Connection to node -1 (ec2-x-x-x-x.ap-southeast-2.compute.amazonaws.com/x.x.x.x:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
  </code></pre>
  
  <p>Inside <em>/config/server.properties</em> I changed the properties <strong>listeners</strong> and <strong>advertised.listeners</strong> (see image below) as I read in many topics related to my issue, but still no way of being able to connect Kafka on EC2 from my local machine:</p>
  
  <p><a href="https://i.stack.imgur.com/tIACD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tIACD.png" alt="enter image description here"></a></p>
  
  <p>I really don't know what I'm missing here... </p>
  
  <p>Kafka version: kafka_2.12-2.2.1<br></p>
  
  <pre><code>listeners=PLAINTEXT://PRIVATE_IP_ADDRESS:9092
  advertised.listeners=PLAINTEXT://PUBLIC_IP_ADDRESS:9092
  </code></pre>