I believe you have to create a new environment, and when it's working you can terminate the old one.
The docs don't say much, except
If your Elastic Beanstalk application is based on an Amazon Linux AMI platform branch, use this page to learn how to migrate your application's environments to Amazon Linux 2. The two platform generations aren't guaranteed to be backward compatible with your existing application. Furthermore, even if your application code successfully deploys to the new platform version, it might behave or perform differently due to operating system and run time differences. Although Amazon Linux AMI and Amazon Linux 2 share the same Linux kernel, they differ in their initialization system, libc versions, the compiler tool chain, and various packages. We've also updated platform specific versions of runtime, build tools, and other dependencies. Therefore we recommend that you take your time, test your application thoroughly in a development environment, and make any necessary adjustments.
When you're ready to go to production, Elastic Beanstalk requires a blue/green deployment to perform the upgrade. For details about platform update strategies, see Updating your Elastic Beanstalk environment's platform version.
Blue/green deployment basically means that you'll switch your URL from the old environment to the new one once it's working and then you can terminate the old one.
We haven't done the migration ourselves yet, but that's how I understand it.