/** * Set AWS access key, secret key and token * * @return void */ public static function setAuthToken() { $role_name = file_get_contents('http://169.254.169.254/latest/meta-data/iam/security-credentials/'); $auth = json_decode(file_get_contents('http://169.254.169.254/latest/meta-data/iam/security-credentials/' . $role_name), true); self::setAuth($auth['AccessKeyId'], $auth['SecretAccessKey']); self::$__token = $auth['Token']; }