Skip to content

Instantly share code, notes, and snippets.

@JasonReading
Last active February 8, 2022 03:11
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save JasonReading/6227a44b7afd1498b0b517d7b6c19fea to your computer and use it in GitHub Desktop.
Save JasonReading/6227a44b7afd1498b0b517d7b6c19fea to your computer and use it in GitHub Desktop.
Firehose example
<?php
use Aws\Firehose\FirehoseClient;
// Install deps with `composer install`
require 'vendor/autoload.php';
$firehose = new FirehoseClient([
'version' => 'latest',
'region' => 'eu-west-1',
'credentials' => [ // OR set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY env vars
'key' => 'abc',
'secret' => '123'
],
]);
$firehose->putRecord([
'DeliveryStreamName' => 'streamName',
'record' => [
'Data' => "Streaming data to Amazon S3 via Amazon Kinesis Firehose is easy.\n"
]
]);
// OR
$firehose->putRecordBatch([
'DeliveryStreamName' => 'streamName',
'records' => [
[
'Data' => "Streaming data to Amazon S3 via Amazon Kinesis Firehose is easy.\n"
],
// ['Data' => "..."], ...
]
]);
{
"require": {
"aws/aws-sdk-php": "^3.22"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment