Fritz the Cat
Fritz the Cat

Reputation: 46

Elasticsearch AWS with Elastica

Is it possiple to Connect to an Amazon Elasticsearch with Elastica and the "AWS Account access policy"?

When i use "Allow open access to the domain" it works.

        $elasticaClient = new \Elastica\Client([
            'connections' => [
                    [
                            'transport' => 'Https',
                            'host' => 'search-xxxxxxxx-zzzzzzzz.us-west-2.es.amazonaws.com',
                            'port' => '',
                            'curl' => [
                                    CURLOPT_SSL_VERIFYPEER => false,
                            ],
                    ],
            ],
    ]);

But in dont know how to set the "Authorization header requires" when i use the "AWS Account access policy".

Upvotes: 0

Views: 1926

Answers (2)

totas
totas

Reputation: 10760

I am using the FriendsOfSymfony FOSElasticaBundle for Symfony. I solved that problem using AwsAuthV4 as transport like this:

fos_elastica:
    clients:
        default:
            host: "YOURHOST.eu-west-1.es.amazonaws.com"
            port: 9200
            transport: "AwsAuthV4"
            aws_access_key_id: "YOUR_AWS_KEY"
            aws_secret_access_key: "YOUR_AWS_SECRET"
            aws_region: "eu-west-1"

Upvotes: 2

ruflin
ruflin

Reputation: 206

This is not implemented yet as it needs more then just setting the headers. Best is to follow the issue here in the Elastica repository for progress: https://github.com/ruflin/Elastica/issues/948

Upvotes: 0

Related Questions