Exhibit 5.1



Calise Cheng

+1 650 843 5172


November 5, 2020

Sunrun Inc.

225 Bush Street, Suite 1400

San Francisco, CA 94104

Ladies and Gentlemen:

You have requested our opinion, as counsel to Sunrun Inc., a Delaware corporation (the “Company”), with respect to certain matters in connection with the filing by the Company of a Registration Statement on Form S-3 (the “Registration Statement”) with the Securities and Exchange Commission, including a related prospectus (the “Prospectus”), covering the registration for resale of 8,302,668 shares of common stock, $0.0001 par value, of the Company (the “Shares”). We have been advised that the Shares have been issued by the Company pursuant to that certain Agreement and Plan of Merger, dated as July 6, 2020, by and among the Company, Viking Merger Sub, Inc., and Vivint Solar, Inc. (the “Merger Agreement”).

In connection with this opinion, we have examined and relied upon the Registration Statement, the Prospectus, the Company’s Amended and Restated Certificate of Incorporation, as amended, and Amended and Restated Bylaws, the Merger Agreement and originals or copies certified to our satisfaction of such records, documents, certificates, memoranda and other instruments as in our judgment are necessary or appropriate to enable us to render the opinion expressed below. We have assumed the genuineness of all signatures, the authenticity of all documents submitted to us as originals, the conformity to originals of all documents submitted to us as copies; the accuracy, completeness and authenticity of certificates of public officials, and the due authorization, execution and delivery of all documents by all persons other than the Company where authorization, execution and delivery are prerequisites to the effectiveness thereof. As to certain factual matters, we have relied upon a certificate of an officer of the Company and have not independently verified such matters.

Our opinion is expressed only with respect to the General Corporation Law of the State of Delaware. We express no opinion to the extent that any other laws are applicable to the subject matter hereof and express no opinion and provide no assurance as to compliance with any federal or state securities law, rule or regulation.

On the basis of the foregoing, and in reliance thereon, we are of the opinion that the Shares have been validly issued and are fully paid and non-assessable.


Cooley LLP 3175 Hanover Street Palo Alto. CA 94304 -1130

t: (650) 843-5000 f: (650) 849-7400 cooley.com


November 5, 2020

Page Two

We consent to the reference to our firm under the caption “Legal Matters” in the Prospectus and to the filing of this opinion as an exhibit to the Registration Statement.


Cooley LLP




/c/ Calise Cheng


     Calise Cheng



Cooley LLP 3175 Hanover Street Palo Alto, CA 94304-1130

t: (650) 843-5000 f: (650) 849-7400 cooley.com