Antibiotics represent an important therapeutic class, but their overuse and erroneous use for humans, animals and agriculture have resulted in increased levels of exposure to sub-therapeutic concentrations of antibiotics, with an increased number of allergies and in the development and spread of antibiotic resistance, a major health problem for the modern world. For these reasons, World Health Organization recommends an urgent improvement in the surveillance of the use of antibiotics, hence the need for developing new analytical sensors, capable to detect selectively low concentrations of antibiotics from different matrices. This study focused on the detection of ampicillin, a beta-lactam antibiotic, widely used, both for humans and as veterinary drug, due to its large spectrum of action. The purpose of this study was to develop an electrochemical sensor based on the use of an ampicillin-selective aptamer for the detection of ampicillin from environmental and pharmaceuticals samples. Two different strategies for the immobilization of the ampicillin-selective aptamer have been employed: by the grafting of a carboxyl containing diazonium salt by cathodic reduction on a glassy carbon electrode, followed by the chemical reaction with the aptamer containing an amino group and by incubating the aptamer containing a thiol group on a gold electrode, leading to a self-assembling layer of the aptamer. The modified electrodes have been characterized by electrochemical impedance spectroscopy. The detection of ampicillin using the modified electrodes is a label-free method, using the variation in the impedance signals to quantify the ampicillin concentration.