Strapi v4 deployed to AWS EBS trying to load resource from localhost

I use the same configuration and it works for me.
Check what settings you have in Amazon.
For a test you can do them as I showed in the screenshot.
It is very difficult for me to debug the problem in this way without being able to simulate it for myself.

Try a new build and clear the cache.