Last active
June 1, 2016 22:55
-
-
Save stuartphilp/075704e8f8a0da122a13940b4321884c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/bash | |
which aws | |
if [ $? = 0 ]; then | |
echo "AWS CLI Found. Continuing..." | |
else | |
echo "You need to install the AWS CLI binary before running this script, and do an aws configure to set up credentials/regions." | |
pip install awscli | |
fi | |
VAGRANT_BOX=services-qa-jenkins-slave-ubuntu-desktop | |
SECURITY_GROUP=services-qa-jenkins-master | |
PROTOCOL=tcp | |
PORT=22 | |
echo "Getting IP of ${VAGRANT_BOX}" | |
UBUNTU_SLAVE_IP=$(vagrant ssh ${VAGRANT_BOX} -c "curl http://169.254.169.254/latest/meta-data/public-ipv4") | |
echo "IP of ${VAGRANT_BOX}: ${UBUNTU_SLAVE_IP}" | |
aws ec2 authorize-security-group-ingress --group-name ${SECURITY_GROUP} --protocol ${PROTOCOL} --port ${PORT} --cidr ${UBUNTU_SLAVE_IP}/32 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment