credentials = $credentials; $this->client = $client ?: InstanceMetadataClient::factory(); } /** * Attempt to get new credentials from the instance profile * * @throws InstanceProfileCredentialsException On error */ protected function refresh() { $credentials = $this->client->getInstanceProfileCredentials(); $this->credentials->setAccessKeyId($credentials->getAccessKeyId()) ->setSecretKey($credentials->getSecretKey()) ->setSecurityToken($credentials->getSecurityToken()) ->setExpiration($credentials->getExpiration()); } }