In the case of coherent interaction with a medium of extremely short light pulses (ESPs) having a carrier frequency and harmonic shape (when the pulse durations are shorter than the population relaxation times T1 and polarization relaxation time T2 of the medium), electromagnetically induced gratings (EMIGs) of the population difference, which have a pronounced harmonic dependence on the coordinates, may appear in it. These structures can occur when pulses do not overlap or overlap in the medium. Recently, the possibility of obtaining unipolar electromagnetic pulses in the optical and adjacent ranges of non-harmonic shape, for example, rectangular and triangular, with a duration less or comparable to the duration of the extremely-short pulse in this range, has attracted interest. In this work, using the numerical solution of the system of Maxwell-Bloch equations, we study EMIG formation by rectangular attosecond pulses in a two-level resonant medium. The possibility of inducing an EMIG of a non-harmonic shape in the form of light-induced channels microresonators, (microcavities) with a size of the order of the wavelength of the resonant transition of the medium, whose parameters can be controlled, for example, by the amplitude of the incident pulses, is shown. It has been suggested that it is possible to create an EMIG of a predetermined non-harmonic shape only in the general case of using unipolar pulses. Keywords: attosecond pulses, unipolar pulses, rectangular pulses, electromagnetically induced gratings, polarization waves, light-induced microresonators.