Last active
August 29, 2015 14:23
-
-
Save MizukiSonoko/7717ebf372ef7a5a1e5e to your computer and use it in GitHub Desktop.
Make in c4.4xlarge
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
echo "Input instance id" | |
read INSTANCE_ID | |
if [ $(aws ec2 describe-instances --instance-ids $INSTANCE_ID | jq '.Reservations[].Instances[].State.Name') != "\"running"\" ] ; then | |
echo "start instance!" | |
aws ec2 start-instances --instance-ids $INSTANCE_ID | |
fi | |
while [ $(aws ec2 describe-instances --instance-ids $INSTANCE_ID | jq '.Reservations[].Instances[].State.Name') != "\"running"\" ] | |
do | |
echo $(aws ec2 describe-instances --instance-ids $INSTANCE_ID | jq '.Reservations[].Instances[].State.Name') | |
done | |
ip_addr=$(aws ec2 describe-instances --instance-ids $INSTANCE_ID | jq '.Reservations[].Instances[].NetworkInterfaces[].PrivateIpAddress') | |
IP=$(echo $ip_addr | sed -e "s/\"//g") | |
echo $IP | |
scp -i ~/.ssh/id_rsa tmp.sh ubuntu@$IP:~/ | |
cat s1_exe.sh | ssh -i ~/.ssh/id_rsa ubuntu@$IP bash | |
scp -i ~/.ssh/id_rsa ubuntu@$IP:~/nginx-1.9.2.zip ~/ | |
cat s2_clean.sh | ssh -i ~/.ssh/id_rsa ubuntu@$IP bash | |
aws ec2 stop-instances --instance-ids $INSTANCE_ID | |
unzip nginx-1.9.2.zip | |
cd nginx-1.9.2 | |
./configure |
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
curl -O http://nginx.org/download/nginx-1.9.2.tar.gz | |
tar xzvf nginx-1.9.2.tar.gz | |
cd nginx-1.9.2/ | |
sudo apt-get install gcc g++ make | |
sudo apt-get install libpcre3 libpcre3-dev | |
sudo apt-get install zlib1g-dev | |
./configure | |
make | |
cd .. | |
zip -r nginx-1.9.2.zip nginx-1.9.2 |
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
rm -rf nginx-1.9.2* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment