I found the answer here: https://repost.aws/questions/QU-9AGg80OQKym6-2N-1DzoA/webdriver-instance-for-mobile-web-testing
Main point: mobile devices on AWS Device Farm aren't accessible remotely. You need to upload your tests to AWS. The "command_executor" URL should be the same for iOS and Android: "http://127.0.0.1:4723/wd/hub"