Skip to content
Snippets Groups Projects
Commit b9e2d9ef authored by Matei Zaharia's avatar Matei Zaharia
Browse files

Merge pull request #419 from shivaram/ec2-ip-change

Detect whether we run on EC2 using ec2-metadata as well
parents 6ad8540b 717b221c
No related branches found
No related tags found
No related merge requests found
...@@ -26,7 +26,8 @@ fi ...@@ -26,7 +26,8 @@ fi
# Set SPARK_PUBLIC_DNS so the master report the correct webUI address to the slaves # Set SPARK_PUBLIC_DNS so the master report the correct webUI address to the slaves
if [ "$SPARK_PUBLIC_DNS" = "" ]; then if [ "$SPARK_PUBLIC_DNS" = "" ]; then
# If we appear to be running on EC2, use the public address by default: # If we appear to be running on EC2, use the public address by default:
if [[ `hostname` == *ec2.internal ]]; then # NOTE: ec2-metadata is installed on Amazon Linux AMI. Check based on that and hostname
if command -v ec2-metadata > /dev/null || [[ `hostname` == *ec2.internal ]]; then
export SPARK_PUBLIC_DNS=`wget -q -O - http://instance-data.ec2.internal/latest/meta-data/public-hostname` export SPARK_PUBLIC_DNS=`wget -q -O - http://instance-data.ec2.internal/latest/meta-data/public-hostname`
fi fi
fi fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment