We most certainly do not 'attach' a surface when evaluating a magnetic field using Ampère's Law.
I think what you are referring to is the imaginary surface, which is called an 'Ampèrian Loop'.
An Ampèrian Loop is an imaginary, closed surface that is assumed to exist, through which the electric current passes. It is usually selected so as to make the calculation of the magnetic field 'simple', so it has a certain element of symmetry to it and thus the choice of an Ampèrian Loop is crucial in order to find the magnetic field. It is defined by:
In Integral Form:
$$\oint_C \mathbf{B}.d\mathbf{l}=\mu_o\iint_S \mathbf {J}.d\mathbf{S}=\mu_oI_{enc.}$$
In Differential Form:
$$\nabla \times \mathbf{B}=\mu_o \mathbf{J}$$
where, $J$ is the current density
$\int_C$ is the closed line integral over a curve C
$\iint_S$ is surface integral over a surface S enclosed by C
Cheers!