Created
January 9, 2017 10:33
-
-
Save dblencowe/a9d51ee3adc4b4d33dabed2a92a5ea6f to your computer and use it in GitHub Desktop.
Get a public IP and write it to /etc/hosts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
IP=`aws ec2 describe-instances --profile lfc-staging --filters "Name=tag:machinetype,Values=web" | grep -m 1 PrivateIpAddress | grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}'` | |
sed -i -e "s/.*lfc-staging$/$IP lfc-staging/g" /etc/hosts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment