What is the metric of a constant electromagnetic (pure electric or pure magnetic) field? For example, imagine a magnetic field $B_x$ directing in $\hat{x}$ direction filling all the space. What is its associated metric field? 
I can construct the electromagnetic stress-energy tensor for this situation:
$T^{\mu\nu}=\frac{B_x^2}{2\mu_0}\begin{pmatrix}
 1  &  & &\\ 
 &  -1  & & \\ 
 &  &  1 &\\ 
 &  &  & 1
\end{pmatrix}$,
(the blank elements are zeros) and I could find the metric from it using Einstein's equation with the help of a  CAS, but this solving procedure seems complex for me. 
Here in the community there are many questions about electromagnetic stress-energy tensor. But, up to my knowledge, none of them shows explicitly the metric of a constant electromagnetic field. Does anyone know a book or article that shows this?
 A: The way you pose the question it seems you have in mind a solution with full translational symmetry in space, and rotational symmetry about the magnetic field direction at each point. I don't know if such a solution exists; if it does must be time-dependent: if the spacetime is static, then the extrinsic curvature of the spatial sections vanishes. The $tx$ component of the Einstein equation then implies that the $tx$ component of the stress energy tensor must vanish. But for a magnetic field in the $x$ direction, that component is $-B^2/2\ne0$. 
A time-independent, stable solution exists that has translational symmetry in the direction of the magnetic field, and rotational symmetry about one axis. This is "Melvin's magnetic universe". The magnetic field energy is gravitationally bound, but does not collapse because of the magnetic pressure. The spatial geometry of this solution is strange. If I recall correctly, the circumference of a circle in a plane orthogonal to the symmetry axis goes to zero as the cylindrical radius goes to infinity.
A: The stress-energy tensor associated to a vanishing electric field $\vec E=0$ with a magnetic field of the form $\vec B = B_0 \hat x$ is given by,
$$T^{\mu\nu} = \frac{B_0^2}{2\mu_0} \eta^{\mu\nu}.$$
By happenstance, I can recall a solution which exhibits a similar stress-energy tensor. If we consider a simple Randall-Sundrum brane, with the metric of the form,
$$ds^2 = dw^2 + e^{2A(w)}\left( dt^2 - dx^2 - dy^2 - dz^2\right)$$
which has an Einstein tensor (proportional to the stress-energy),
$$G_{\mu\nu} = -e^{2A}\eta_{\mu\nu}(3A''+6A'^2).$$
Thus, with the help of this additional dimension, we can have a brane whose stress-energy is precisely of the same form as for the constant magnetic field you presented. However, we must solve the differential equation,
$$3A''+6A'^2 = e^{2A}.$$
By making a substitution, $A(w) = \ln f(w)$ we arrive at the form,
$$f''(w)+\frac{f'(w)^2}{f(w)}=\frac13f(w)^3.$$
Mathematica is able to solve this, but it involves a messy inverse function involving trigonometric functions and elliptic functions. As such, I don't believe the solution, at least in these coordinates is pretty, but it certainly can be cast in the form presented, and exists.
