# Connecting a ec2 java application to an ec2 cluster

**URL:** <https://discuss.elastic.co/t/connecting-a-ec2-java-application-to-an-ec2-cluster/4874>\
**Category:** Elasticsearch\
**Created:** [July 15, 2011, 7:00pm UTC](https://discuss.elastic.co/t/connecting-a-ec2-java-application-to-an-ec2-cluster/4874 "2011-07-15T19:00:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![danpolites](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/danpolites/32/2136_2.png) [@danpolites](https://discuss.elastic.co/u/danpolites)\
**Post date:** [July 15, 2011, 7:00pm UTC](https://discuss.elastic.co/t/connecting-a-ec2-java-application-to-an-ec2-cluster/4874/1 "2011-07-15T19:00:15Z")

</div>

I have an ec2 cluster of elastic search nodes out and running on amazon that are setup with the cloud-aws plugin. The nodes are finding each other with no problem. My issue is that when I deploy my grails application to the ec2 network, it gets a MasterNotDiscoveredException. When I configure the application to use discovery type ec2, it throws an invalid settings exception. This is probably because the cloud plugin is not installed in the grails application. How can I get the grails application to discover the master node? My configuration for the elastic search nodes:

cluster:  
name: es\_qa

network:  
host: _local_

cloud:  
aws:  
access\_key: myaccesskey  
secret\_key: mysecretkey

discovery:  
type: ec2

My configuration for the node client in the grails application:

mode is node  
node client is true

settings:

"cluster.name": "es\_qa"

---

<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:** [July 15, 2011, 10:05pm UTC](https://discuss.elastic.co/t/connecting-a-ec2-java-application-to-an-ec2-cluster/4874/2 "2011-07-15T22:05:02Z")

</div>

Do you have the cloud-aws plugin jar file in the classpath? Including the aws dependency?

On Friday, July 15, 2011 at 10:00 PM, hoffmandirt wrote:

> I have an ec2 cluster of Elasticsearch nodes out and running on amazon that  
> are setup with the cloud-aws plugin. The nodes are finding each other with  
> no problem. My issue is that when I deploy my grails application to the ec2  
> network, it gets a MasterNotDiscoveredException. When I configure the  
> application to use discovery type ec2, it throws an invalid settings  
> exception. This is probably because the cloud plugin is not installed in the  
> grails application. How can I get the grails application to discover the  
> master node? My configuration for the Elasticsearch nodes:
> 
> cluster:  
> name: es\_qa
> 
> network:  
> host: _local_
> 
> cloud:  
> aws:  
> access\_key: myaccesskey  
> secret\_key: mysecretkey
> 
> discovery:  
> type: ec2
> 
> My configuration for the node client in the grails application:
> 
> mode is node  
> node client is true
> 
> settings:
> 
> "cluster.name ([http://cluster.name](http://cluster.name))": "es\_qa"
> 
> --  
> View this message in context: [http://elasticsearch-users.115913.n3.nabble.com/Connecting-a-ec2-java-application-to-an-ec2-cluster-tp3172978p3172978.html](http://elasticsearch-users.115913.n3.nabble.com/Connecting-a-ec2-java-application-to-an-ec2-cluster-tp3172978p3172978.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com) ([http://Nabble.com](http://Nabble.com)).

---

<div class="post-metadata">

**Author:** ![danpolites](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/danpolites/32/2136_2.png) [@danpolites](https://discuss.elastic.co/u/danpolites)\
**Post date:** [July 18, 2011, 12:01pm UTC](https://discuss.elastic.co/t/connecting-a-ec2-java-application-to-an-ec2-cluster/4874/3 "2011-07-18T12:01:42Z")

</div>

Do you have the cloud-aws plugin jar file in the classpath? Including the aws dependency?

Thanks! That was the issue. I didn't realize that there was an elasticsearch dependency for the cloud-aws plugin. Just in case anyone else stumbles upon this, add this line to your grails BuildConfig.groovy file in the dependencies section:

runtime 'org.elasticsearch:elasticsearch-cloud-aws:0.16.4'

---

<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, 4:00am UTC](https://discuss.elastic.co/t/connecting-a-ec2-java-application-to-an-ec2-cluster/4874/4 "2017-07-06T04:00:17Z")

</div>


