Created
July 3, 2015 09:01
-
-
Save rosstimson/ad2b79a78159bd80ffeb to your computer and use it in GitHub Desktop.
EC2 tag version of Bash installed.
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
#!/usr/bin/env bash | |
EC2_INSTANCE_ID="`wget -q -O - http://169.254.169.254/latest/meta-data/instance-id`" | |
EC2_REGION="`wget -q -O - http://169.254.169.254/latest/meta-data/placement/availability-zone | sed 's/.$//g'`" | |
if ! type "aws" > /dev/null; then | |
if ! type "pip" > /dev/null; then | |
easy_install pip | |
fi | |
pip install awscli | |
fi | |
mkdir ~/.aws | |
cat << EOF >> ~/.aws/config | |
[profile tag] | |
output = json | |
region = $EC2_REGION | |
aws_access_key_id = $TAG_WRITE_ACCESSKEY | |
aws_secret_access_key = $TAG_WRITE_SECRETKEY | |
EOF | |
aws --profile=tag ec2 create-tags --resources $EC2_INSTANCE_ID --tags Key=bash,Value=`rpm -qa | grep bash` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment