Metric field equations We have an action of the form:
$$S=\int d^4x\sqrt{-g}\left(\frac{R}{2\kappa^2}+\frac14F_{\mu\nu}F^{\mu\nu}+\frac12m^2A_{\mu}A^{\mu}\right).$$
Here $R$ is the curvature scalar, $A_{\mu}$ is a vector field, $F^{\mu\nu}$ is the Faraday tensor and ($\kappa,m$) are constants.
Using the variational method I varied the metric in order to obtain the field equations and got this:
$$\frac{1}{4\kappa^2}g_{\mu\nu}R+\frac{1}{8}g_{\mu\nu}F_{\alpha\beta}F^{\alpha\beta}+\frac{1}{4}m^2g_{\mu\nu}A_{\sigma}A^{\sigma}=\frac{1}{2\kappa^2}R_{\mu\nu}$$
but I did this by only varying the terms $\sqrt{-g}$, $R_{\mu\nu}$ and $g^{\mu\nu}$. Do I have to write $F_{\alpha\beta}F^{\alpha\beta}=g^{\alpha\lambda}g^{\beta\rho}F_{\alpha\beta}F_{\lambda\rho}$ and apply the variation to those two metrics too? By the way my attempt, so far, is correct isn´t it?
 A: Yes, your action is of the form
\begin{equation}
S=\int\text{d}^{4}x\sqrt{-g}(\mathcal{L}_{\text{EH}}+\mathcal{L}_{\text{M}}),
\end{equation}
where
\begin{equation}
\mathcal{L}_{\text{EH}}=\frac{R}{2k^{2}}
\end{equation}
is the part whose variation with respect to $g_{\mu\nu}$ gives you the Einstein tensor in the equations of motion, and
\begin{equation}
\mathcal{L}_{\text{M}}=\frac{1}{4}F_{\mu\nu}F^{\mu\nu}+\frac{1}{2}m^{2}A_{\mu}A^{\mu}
\end{equation}
is the part corresponding to matter, whose variation with respect to $g_{\mu\nu}$ gives you the energy-momentum tensor. In order to find the correct equations, you have to write $\mathcal{L}_{\text{M}}$ as
\begin{equation}
\mathcal{L}_{\text{M}}=\frac{1}{4}g^{\mu\alpha}g^{\nu\beta}F_{\alpha\beta}F_{\mu\nu}+\frac{1}{2}m^{2}g^{\mu\alpha}A_{\alpha}A_{\mu}
\end{equation}
and apply the variation to the three metric tensors that appear there.
A: Yes.  You have to vary $g^{ab}$ everywhere it appears.
A: Yes. The field strength tensor is $F_{\mu \nu}$. The only two fundamental fields in your action are $g_{\mu \nu}$ and $A_\mu$ (unless you use Palatini variation and treat the connection as independent of the metric). So before preforming the variation, you should write the action in terms of these fundamental fields, and vary w.r.t each of them. The only other option would be to consider $A_\mu, A^\mu, F_{\mu \nu}, F^{\mu \nu}$ as independent fields, which would lead to problems like the lack of kinetic terms for all of them.
