Two of Shakespeare's best-known and best-loved sonnets, Sonnet 20 and Sonnet 55, both contain explicit promises that the person to whom they are addressed will be immortalized by in them.
Sonnet 29 begins with
Devouring Time, blunt thou the lion's paws
And concludes with the couplet
Yet do thy worst, old Time, despite thy wrong,
My love shall in my verse ever live young.
Sonnet 55 begins with
Not marble nor the gilded monuments
Of princes shall outlive this powerful rhyme
And ends with this couplet:
So, till the judgment that yourself arise,
You live in this, and dwell in lovers' eyes.
In other words, the loved one will remain alive in Shakespeare's verse until Judgment Day and afterwards will undoubtedly dwell in heaven for eternity.
Sonnet 55 seems to be set in a cemetery, and there is a strong suggestion that the person to whom it is addressed has recently died, especially in the words "So, till the judgment that yourself arise." So the sonnet would be an elegy, somewhat similar to Milton's "Lycidas" or Shelley's "Adonais."
The subjects of both sonnets have survived in Shakespeare's poems for over four hundred years and seem likely to survive for at least another four hundred. All printed copies of both poems could be destroyed by some great global catastrophe, but they would still survive in many people's memories.