Find a matrix of the form $\mathbf{M} = \begin{pmatrix} a & b \\ 0 & d \end{pmatrix}$ such that
\[\mathbf{M}^3 = \begin{pmatrix} 8 & -57 \\ 0 & 27 \end{pmatrix}.\]
We have that
\begin{align*}
\mathbf{M}^3 &= \begin{pmatrix} a & b \\ 0 & d \end{pmatrix}^3 \\
&= \begin{pmatrix} a^2 & ab + bd \\ 0 & d^2 \end{pmatrix} \begin{pmatrix} a & b \\ 0 & d \end{pmatrix} \\
&= \begin{pmatrix} a^3 & a^2 b + abd + bd^2 \\ 0 & d^3 \end{pmatrix}.
\end{align*}Thus, $a^3 = 8,$ $b(a^2 + ad + d^2) = -57,$ and $d^3 = 27.$  Hence, $a = 2$ and $d = 3,$ so
\[b(2^2 + 2 \cdot 3 + 3^2) = -57.\]Then $b = -3,$ so $\mathbf{M} = \boxed{\begin{pmatrix} 2 & -3 \\ 0 & 3 \end{pmatrix}}.$