private function createPresignedUrl(AwsClientInterface $client, CommandInterface $cmd) { $newCmd = $client->getCommand('CopySnapshot', $cmd->toArray()); $newCmd->getEmitter()->detach($this); // Serialize a request for the CopySnapshot operation. $request = $client->initTransaction($newCmd)->request; // Create the new endpoint for the target endpoint. $endpoint = EndpointProvider::resolve($this->endpointProvider, ['region' => $cmd['SourceRegion'], 'service' => 'ec2'])['endpoint']; // Set the request to hit the target endpoint. $request->setHost(Url::fromString($endpoint)->getHost()); // Create a presigned URL for our generated request. $signer = new SignatureV4('ec2', $cmd['SourceRegion']); return $signer->createPresignedUrl(SignatureV4::convertPostToGet($request), $client->getCredentials(), '+1 hour'); }