renoki-co/aws-elastic-client

Just a simple Elasticsearch Client handler that signs the requests for AWS Elasticsearch service with the provided credentials.

1.2.0 2021-04-08 12:07 UTC

This package is auto-updated.

Last update: 2021-10-11 18:08:26 UTC


README

CI codecov StyleCI Latest Stable Version Total Downloads Monthly Downloads License

Just a simple Elasticsearch Client handler that signs the requests for AWS Elasticsearch service with the provided credentials.

🤝 Supporting

If you are using one or more Renoki Co. open-source packages in your production apps, in presentation demos, hobby projects, school projects or so, spread some kind words about our work or sponsor our work via Patreon. 📦

You will sometimes get exclusive content on tips about Laravel, AWS or Kubernetes on Patreon and some early-access to projects or packages.

68747470733a2f2f63352e70617472656f6e2e636f6d2f65787465726e616c2f6c6f676f2f6265636f6d655f615f706174726f6e5f627574746f6e2e706e67

🚀 Installation

You can install the package via composer:

composer require renoki-co/aws-elastic-client

🙌 Usage

To authenticate to AWS, you will need to set the handler that comes with this package:

use RenokiCo\AwsElasticHandler\AwsHandler;

$awsHandler = new AwsHandler([
    'enabled' => true,
    'aws_access_key_id' => '...',
    'aws_secret_access_key' => '...',
    'aws_region' => 'us-east-1',
    'aws_session_token' => '...', // optional
]);

$client = ClientBuilder::create()
    ->setHosts(...)
    ->setHandler($awsHandler)
    ->build();

If you are building th client statically using fromConfig(), pass the handler parameter:

use RenokiCo\AwsElasticHandler\AwsHandler;

$awsHandler = new AwsHandler([
    'enabled' => true,
    'aws_access_key_id' => '...',
    'aws_secret_access_key' => '...',
    'aws_region' => 'us-east-1',
    'aws_session_token' => '...', // optional
]);

$client = ClientBuilder::fromConfig([
    'hosts' => [
        //
    ],
    'handler' => $awsHandler,
]);

The package will make sure to sign each subsequent request that goes through with the IAM credentials you have provided.

🐛 Testing

vendor/bin/phpunit

🤝 Contributing

Please see CONTRIBUTING for details.

🔒 Security

If you discover any security related issues, please email alex@renoki.org instead of using the issue tracker.

🎉 Credits