How do you ensure job security in a hard economic situation like this?
Upskill and be the best in the path that you've chosen. There's no other choice for those who want to stay employed with the skills that they have. Otherwise, be a jack of all trades and try new things and let's learn how to plant our food in our backyards.
For me, even with these layoffs, not everyone will lose their job. Amazon and other companies will keep valuable employees. This means that wherever you work, you must constantly improve yourself and give value unless you don't like your job and want to leave. Being valuable ensures job security, even in tough economic situations like now. If you're indispensable, companies won't let you go easily.
That is true but the companies can layoff anybody that they want to. If the cost is too much to keep an employee, they'll choose to layoff rather than keep. This is the sad truth with employment, you can work for so many years with them and be loyal but they can't be and will not reciprocate in most cases and can easily replace you instantly. Looks like layoffs are everywhere and it was reported that Boeing will also layoff thousands of its employees which is equivalent to 10% of its total employees.