PHP
AWS

PHPでAWS S3のPreSignedURLを発行する

aws-sdkを入れる

composer require aws/aws-sdk-php

そして下記のように実行する

require 'vendor/autoload.php';

$client = new Aws\S3\S3Client([
  'credentials' => [
    'key' => 'key',
    'secret' => 'hoge'
  ],
  'endpoint' => 'http://example.com', // S3ライクの場合は指定
  'version' => '2006-03-01',
  'region' => ''
]);

$cmd = $client->getCommand('GetObject', [
  'Bucket' => 'example',
  'Key' => 'file.txt'
]);

$request = $client->createPresignedRequest($cmd, '+2 hours');
$presignedUrl = (string) $request->getUri();

echo $presignedUrl;

参考