Php卡在AWS SDK IoT getThingShadow请求中

I wrote some code in PHP that gets the ThingShadow state of an IoT Device connected to the AWS IoT Service.

public function getState($name){
    require_once HOME . DS . 'includes' . DS . 'aws' . DS . 'aws-autoloader.php';
    $IoT = new Aws\IotDataPlane\IotDataPlaneClient([
        'version' => 'latest',
        'region'  => 'us-west-2'
    ]);

    $result = $IoT->getThingShadow([
        'thingName' => $name, // REQUIRED
    ]);

    echo $result["payload"]->getContents();
}

When I run it on my localhost server it works perfectly, but when I run it on my EC2 instance it doesn't work. I call this method and it gets stuck on what seems to be a loop.

I have checked the credentials and everything is fine.

For tests, I put a wrong thingName and i get the following error:

Fatal error: Uncaught exception 'Aws\IotDataPlane\Exception\IotDataPlaneException' with message 'Error executing "GetThingShadow" on "https://data.iot.us-west-2.amazonaws.com/things/WRONG_NAME/shadow"; AWS HTTP error: Client error: 404 ResourceNotFoundException (client): No shadow exists with name: 'WRONG_NAME' - {"message":"No shadow exists with name: 'WRONG_NAME'","traceId":"f3c5f1ba-e24a-448d-b4e2-d6265751df87"}' exception 'GuzzleHttp\Exception\ClientException' with message 'Client error: 404' in /var/www/html/includes/aws/GuzzleHttp/Middleware.php:69 Stack trace: #0 /var/www/html/includes/aws/GuzzleHttp/Promise/Promise.php(199): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Response)) #1 /var/www/html/includes/aws/GuzzleHttp/Promise/Promise.php(152): GuzzleHttp\Promise\Promise::callHandler(1, Object(GuzzleHttp\Psr7\Response), Array) #2 /var/www/html/includes/aws/GuzzleHttp/Promise/TaskQueue.php(60): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise\{closure}() #3 /var/www/html/includes/aws/GuzzleHtt in /var/www/html/includes/aws/Aws/WrappedHttpHandler.php on line 152

When I run the code with the actual name of an existing thing it doesn't respond. Looks like the code gets in a loop somewhere.

I'm usin the the AWS PHP SDK v3.