# Connect to EC2 cluster from other security groups

**URL:** <https://discuss.elastic.co/t/connect-to-ec2-cluster-from-other-security-groups/6654>\
**Category:** Elasticsearch\
**Created:** [February 9, 2012, 8:37am UTC](https://discuss.elastic.co/t/connect-to-ec2-cluster-from-other-security-groups/6654 "2012-02-09T08:37:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![vreal](https://avatars.discourse-cdn.com/v4/letter/v/5f9b8f/32.png) [@vreal](https://discuss.elastic.co/u/vreal)\
**Post date:** [February 9, 2012, 8:37am UTC](https://discuss.elastic.co/t/connect-to-ec2-cluster-from-other-security-groups/6654/1 "2012-02-09T08:37:09Z")

</div>

I've created a cluster with 2 EC2 instances on amazon and set the security group as search-cluster and they are works fine. Then I start another instance which is in security group web-server. Both security groups have port 9200 and 9300 opened.

In this web server i have a web app which contains such code:

Builder settings = ImmutableSettings.settingsBuilder();  
settings.put("discovery.type", "ec2");  
settings.put("cloud.aws.access\_key", "my access key");  
settings.put("cloud.aws.secret\_key", "my security key");  
settings.put("discovery.ec2.groups", "search-cluster");  
Node node = nodeBuilder().settings(settings).clusterName("my cluster name").client(true).node();  
client = node.client();

Then I got such error when I index a record into the elasticsearch:  
org.elasticsearch.discovery.MasterNotDiscoveredException:  
org.elasticsearch.action.support.master.TransportMasterNodeOperationAction$3.onTimeout(TransportMasterNodeOperationAction.java:162)  
org.elasticsearch.cluster.service.InternalClusterService$NotifyTimeout.run(InternalClusterService.java:332)  
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)  
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)  
java.lang.Thread.run(Thread.java:636)

Can anyone tell me what can I do to deal with the problem? Thanks  
The elasticsearch is version 0.18.7 and java 1.6

Bruce Zhou

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [February 12, 2012, 10:59am UTC](https://discuss.elastic.co/t/connect-to-ec2-cluster-from-other-security-groups/6654/2 "2012-02-12T10:59:24Z")

</div>

Can you set the discovery (or if you are running embedded, org.elasticsearch.discovery) logging to the highest possible (TRACE) and see what nodes the ec2 discovery uses, and which it can connect to...

On Thursday, February 9, 2012 at 10:37 AM, Ye Zhou wrote:

> I've created a cluster with 2 EC2 instances on amazon and set the security group as search-cluster and they are works fine. Then I start another instance which is in security group web-server. Both security groups have port 9200 and 9300 opened.
> 
> In this web server i have a web app which contains such code:
> 
> Builder settings = ImmutableSettings.settingsBuilder();  
> settings.put("discovery.type", "ec2");  
> settings.put("cloud.aws.access\_key", "my access key");  
> settings.put("cloud.aws.secret\_key", "my security key");  
> settings.put("discovery.ec2.groups", "search-cluster");  
> Node node = nodeBuilder().settings(settings).clusterName("my cluster name").client(true).node();  
> client = node.client();
> 
> Then I got such error when I index a record into the elasticsearch:  
> org.elasticsearch.discovery.MasterNotDiscoveredException:  
> org.elasticsearch.action.support.master.TransportMasterNodeOperationAction$3.onTimeout(TransportMasterNodeOperationAction.java:162)  
> org.elasticsearch.cluster.service.InternalClusterService$NotifyTimeout.run(InternalClusterService.java:332)  
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)  
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)  
> java.lang.Thread.run(Thread.java:636)
> 
> Can anyone tell me what can I do to deal with the problem? Thanks  
> The elasticsearch is version 0.18.7 and java 1.6
> 
> Bruce Zhou

---

<div class="post-metadata">

**Author:** ![vreal](https://avatars.discourse-cdn.com/v4/letter/v/5f9b8f/32.png) [@vreal](https://discuss.elastic.co/u/vreal)\
**Post date:** [February 12, 2012, 1:28pm UTC](https://discuss.elastic.co/t/connect-to-ec2-cluster-from-other-security-groups/6654/3 "2012-02-12T13:28:22Z")

</div>

Thanks, I've got it solved. The region should be set because my instance is running in us-west.

On 2012/02/12, at 18:59 , Shay Banon wrote:

> Can you set the discovery (or if you are running embedded, org.elasticsearch.discovery) logging to the highest possible (TRACE) and see what nodes the ec2 discovery uses, and which it can connect to...  
> On Thursday, February 9, 2012 at 10:37 AM, Ye Zhou wrote:
> 
> > I've created a cluster with 2 EC2 instances on amazon and set the security group as search-cluster and they are works fine. Then I start another instance which is in security group web-server. Both security groups have port 9200 and 9300 opened.
> > 
> > In this web server i have a web app which contains such code:
> > 
> > Builder settings = ImmutableSettings.settingsBuilder();  
> > settings.put("discovery.type", "ec2");  
> > settings.put("cloud.aws.access\_key", "my access key");  
> > settings.put("cloud.aws.secret\_key", "my security key");  
> > settings.put("discovery.ec2.groups", "search-cluster");  
> > Node node = nodeBuilder().settings(settings).clusterName("my cluster name").client(true).node();  
> > client = node.client();
> > 
> > Then I got such error when I index a record into the elasticsearch:  
> > org.elasticsearch.discovery.MasterNotDiscoveredException:  
> > org.elasticsearch.action.support.master.TransportMasterNodeOperationAction$3.onTimeout(TransportMasterNodeOperationAction.java:162)  
> > org.elasticsearch.cluster.service.InternalClusterService$NotifyTimeout.run(InternalClusterService.java:332)  
> > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)  
> > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)  
> > java.lang.Thread.run(Thread.java:636)
> > 
> > Can anyone tell me what can I do to deal with the problem? Thanks  
> > The elasticsearch is version 0.18.7 and java 1.6
> > 
> > Bruce Zhou

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 3:39am UTC](https://discuss.elastic.co/t/connect-to-ec2-cluster-from-other-security-groups/6654/4 "2017-07-06T03:39:47Z")

</div>


