title: How can I access my AWS MSK managed kafka queue from my local machine and EC2 instances in other regions
body: <p>I'm setting up a managed kafka queue on AWS MSK. I can't seem to get the security to work when connecting from a local machine and I can't work out if I can use security groups from one region to another.</p>
  
  <p>I've gone through the information on  setting up the security groups on the main documentation <a href="https://docs.aws.amazon.com/msk/latest/developerguide/create-vpc.html" rel="noreferrer">here</a>. I still can't seem to connect to the broker though. I'm currently using kafka scripts from my local machine in the following way:</p>
  
  <pre><code>bin/kafka-console-producer.sh --broker-list "my-broker-ip:9092" --topic "some-topic"
  </code></pre>
  
  <p>but keep getting the result </p>
  
  <pre><code>[2019-01-28 12:06:13,278] WARN [Producer clientId=console-producer] Connection to node -1 could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
  </code></pre>
  
  <p>I've associated my local IP with all the ports on the security group that I set up with my VPC and associated with the kafka queue but it doesn't seem to have helped. I also don't see how I can associate my boxes with the kafka queue as they are in different regions. Is this possible?</p>
  
  <p>I'm currently using kafka scripts from my local machine in the following way:</p>
  
  <p>bin/kafka-console-producer.sh --broker-list "my-broker-ip:9092" --topic "some-topic"</p>
  
  <p>but keep getting the result </p>
  
  <p>[2019-01-28 12:06:13,278] WARN [Producer clientId=console-producer] Connection to node -1 could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)</p>
  
  <p>I've associated my local IP with all the ports on the security group that I set up with my VPC and associated with the kafka queue but it doesn't seem to have helped. I also don't see how I can associate my boxes with the kafka queue as they are in different regions. Is this possible?</p>
  
  <p>I'm expecting to be able to connect my local producer code the kafka queue and observe the output rather than have it constantly reject the connection.</p>