Here's my scenario:
Problem: Search engines are (also) crawling and indexing my ${appName}.elasticbeanstalk.com URL
Q: How do I disable the ${appName}.elasticbeanstalk.com URL for good to only use my chosen (.com) name?
I will answer with the best thing I've found so far, just to make sure I can help other people.
Assuming there is no way to completely disable the elasticbeanstalk URL, best thing I found was to add an entry to .htaccess file redirecting.
# Redirect elastic beanstalk addresses to www.example.com
RewriteCond %{HTTP_HOST} elasticbeanstalk\.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
You can do something better to consider your testing environments as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With