Skip to content

Instantly share code, notes, and snippets.

@stuartphilp
Last active June 1, 2016 22:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stuartphilp/075704e8f8a0da122a13940b4321884c to your computer and use it in GitHub Desktop.
Save stuartphilp/075704e8f8a0da122a13940b4321884c to your computer and use it in GitHub Desktop.
#!/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