FOSElasticaBundle icon indicating copy to clipboard operation
FOSElasticaBundle copied to clipboard

configuration with AWS Elasticsearch.

Open MaxPowerReforged opened this issue 4 years ago • 8 comments

I am trying to connect to an AWS Elasticsearch domain using FOSElasticaBundle (version v6.0.0-beta4). After reading the documentation and the related questions here, I could find some examples and configuration that I implemented, however, I am getting an error related to the elastica configuration. My config:


fos_elastica:
    clients:
        default:
            url: 'aws-elasticsearch-domain-url'
            aws_access_key_id: 'access-key'
            aws_secret_access_key: 'secret-key'
            aws_region: "aws-region"
            transport: "AwsAuthV4"
    indexes:
        (indexes configuration...)

When populating the indexes, I am getting this error related to the AwsAuthV4 transport parameter:

In AwsAuthV4.php line 43:
                                                                         
  Attempted to load class "SignatureV4" from namespace "Aws\Signature".  
  Did you forget a "use" statement for another namespace?

I am unsure whether this is not supported, not properly configured, or something else.

MaxPowerReforged avatar Jul 21 '21 06:07 MaxPowerReforged

You can use AWS' instances without authentication like so :

fos_elastica:
    clients:
        default:
            host: 'host'
            port: 443
            transport: Https

philmoreau avatar Dec 22 '21 14:12 philmoreau

Hi @MaxPowerReforged,

Just wondering if you had managed to find a resolution to this? Looking at using this bundle with opensearch myself.

cjgordon avatar Jan 06 '22 06:01 cjgordon

Hi @MaxPowerReforged,

Just wondering if you had managed to find a resolution to this? Looking at using this bundle with opensearch myself.

Actually not, we ended up using a custom search without Elasticsearch, although I would love to have a solution and switch back. Sorry not to be more useful :)

Maybe it is worth trying the above solution

MaxPowerReforged avatar Jan 07 '22 13:01 MaxPowerReforged

We've been using it for a long time. Simply secure the access using security groups.

philmoreau avatar Jan 07 '22 16:01 philmoreau

Will give it a go and see what happens.

cjgordon avatar Jan 11 '22 05:01 cjgordon

I believe You should install aws/aws-sdk-php through composer and Aws\Signature\SignatureV4 will autoload

nfkamdhhc avatar Jan 15 '22 14:01 nfkamdhhc

Hello, we're trying to use the same and i'm kinda stuck with a weird issue.

When i'm runing bin/console fos:elastica:populate everything works and i'm able to connect and populate the indexes, but when i try and access something from the API, it returns error 500 (request.CRITICAL: Uncaught PHP Exception Elastica\Exception\Connection\HttpException: "Couldn't connect to host, Elasticsearch down?").

Elasticsearch 7.10 running in the same VPC as the EC2, and im able to make a CURL request from the EC2 instance.

Flegma avatar Mar 21 '22 19:03 Flegma

Got it figured out, it was a problem with the API itself, not the EC2/VPC/OpenSearch configuration.

Flegma avatar Mar 22 '22 13:03 Flegma