Exhibit 23.1
Consent of Independent Registered Public Accounting Firm
We consent to the reference to our firm under the caption "Experts" in the Registration Statement (Form F-3) and the related Prospectus of Ecopetrol S.A. and to the incorporation by reference therein of our report dated April 19, 2024, with respect to the consolidated financial statements of Ecopetrol S.A., and the effectiveness of internal control over financial reporting of Ecopetrol S.A., included in its Annual Report (Form 20-F) for the year ended December 31, 2023, filed with the Securities and Exchange Commission.
/s/ Ernst & Young Audit S.A.S.
A Member Practice of
Ernst & Young Global Limited
Bogotá D.C., Colombia
April 19, 2024