Amazon EC2 - CURLE_COULDNT_CONNECT

123 views
Skip to first unread message

Cassiano Tartari

unread,
Oct 21, 2014, 12:03:30 PM10/21/14
to elastica-php-client
​Hello!

    I think this is kind of off topic but I'm trying to figure out the solution for hours without success maybe some of you could help me. My case, 2 ec2 instantes at Amazon, one with elasticsearch other runing php with symfony > foselasticasearch > elastica. I've configured php instance to connect in elasticsearch instance with its private IP​. But it is throwing a HttpException: "Couldn't connect to host, Elasticsearch down?", the weird thing is that if I run over ssh in php instance the command:

$ curl -XGET '<private ip>:9200'

It returns the json status 200 e other stuff, tested the same with php:

<?php

$ch = curl_init("
<private ip>:9200");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$data = curl_exec($ch);
print($data);

?>

​Any ideas?

Thanks!​

ruflin

unread,
Oct 21, 2014, 2:10:46 PM10/21/14
to elastica-...@googlegroups.com
Are you connecting through http or https?

Cassiano Tartari

unread,
Oct 21, 2014, 2:25:06 PM10/21/14
to elastica-php-client
In curl command line and php tests the ip is specified without any prefixes as like in foselasticaconfiguration. I just add the ip number 123.123.123.
​123​
​. My test over my application is running a http page in the browser.​

I don't know is this is related with some security role under AWS but there the php instance has all outbound traffic allowed and in the security group of elasticsearch instance has 9200, 9300, 443, 80 and All ICMP allowed as inbound traffic from php instance security group.


--
You received this message because you are subscribed to the Google Groups "Elastica - Elasticsearch PHP Client" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elastica-php-cl...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

ruflin

unread,
Oct 29, 2014, 4:33:25 AM10/29/14
to elastica-...@googlegroups.com
Interesting. To figure out if it is related to the Firewall you could start a test box where you open all the traffic for PHP and then you see if it works.

Jonay López Santana

unread,
Sep 9, 2015, 6:10:03 AM9/9/15
to Elastica - Elasticsearch PHP Client
Hi!,
Did you find the solution? I'm having the same problem.

Thanks in advance!

ruflin

unread,
Sep 10, 2015, 2:20:13 AM9/10/15
to Elastica - Elasticsearch PHP Client
@Jonay: Are you using http or https?
Reply all
Reply to author
Forward
0 new messages