The type of bond formed will depend on the energy and the attraction between the atoms also depends on the nature of the atoms.
First, let's define what each of the above types of links is:
Covalent: electrons are shared between two atoms
Iónic: are formed by the transfer of an electron from one atom to another.
To know whether a bond is covalent or ionic, we must calculate the difference in electronegativity. The electronegativity can be seen in the periodic table of the elements.
That is the electronegativity of the elements that you can find in the periodic table, you must subtract both electronegativities:
Now, when the difference is less than 1.7 we will have a covalent bond, if it is greater than 1.7 we will have an ionic bond.
In this case, the result is 1.55 < 1.7, so AlCl3 has a covalent bond.