The Lord has promis'd good to me,
His word my hope secures;
He will my shield and portion be
As long as life endures.

Yes, when this flesh and heart shall fail,
And mortal life shall cease;
I shall possess, within the veil,
A life of joy and peace.

The earth shall soon dissolve like snow,
The sun forbear to shine;
But God, who call'd me here below,
Will be forever mine.

John Newton, Olney Hymns, 1779

Amazing Grace was written by Rev. John Newton
(July 24, 1725 -- Dec. 21, 1807) for a sermon he preached on January 1,
1773. At the time Rev. Newton was writing a new hymn for each of his
sermons he preached.

The scripture text for that sermon was;

"And David the king came and sat before the
Lord, and said, Who am I, O Lord God, and what is mine house, that thou
hast brought me hitherto?

And yet this was a small thing in thine eyes, O God; for thou hast also
spoken of thy servant's house for a great while to come, and hast
regarded me according to the estate of a man of high degree, O Lord
God." 1 Chronicles 17:16-17 King James Bible