How to configure swap space for your Azure Ubuntu VM

It's been a long time since I've played with Linux. So, I'm learning again. The old way was to create a swap file with dd and swapon. I came across a nice article today on the modern way to do it. (yes, I'm starting to feel old). Mostly, it's the same, but a few new ways of tuning things.

In case you are interested, the echo lines are so I can see what I'm about to add when editing. After I move to the right place in the file, I paste again. It's just my way. Also makes it easier to see what I did when I dump my history.