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
Set a Tag on an Instance | |
#!/bin/sh -ex | |
instance_id=556677 | |
tag="mytags%3Abar%3Dfoo" | |
# Issue curl command to get and store the cookie | |
curl -H "$api_version" -b "$api_cookie" --request PUT https://my.rightscale.com/api/acct/"$api_account"/tags/set?resource_href=/ec2_instances/"$instance_id" -d 'tags[]='"$tag" | |
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 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
. ~/.bashrc | |
mkdir ~/local | |
mkdir ~/node-latest-install | |
cd ~/node-latest-install | |
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
./configure --prefix=~/local | |
make install # ok, fine, this step probably takes more than 30 seconds... | |
curl https://npmjs.org/install.sh | sh |
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
source 'https://rubygems.org' | |
group :test do | |
gem 'chefspec', '~> 1.3' | |
gem 'foodcritic', '~> 2.1' | |
gem 'strainer', '~> 3.0' | |
gem 'test-kitchen', '~> 1.0.0.alpha' | |
gem 'kitchen-lxc', '~> 0.0.1.beta1' | |
gem 'knife-spork', '~> 1.0.17' | |
gem 'hipchat', '~> 0.10.0' |
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
#!/bin/bash | |
# Replace the following variables for your environment | |
# zxtm - hostname of your Stingray Traffic Manager | |
# zxtmuser - username used to log in to Stingray SSH interface | |
# git_path - path to the git repo you want to store the config backups in | |
# | |
# I recommend that zxtmuser is able to log in to the Traffic Manager | |
# without using a password, using SSH keys. | |
# |
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
$ aws --region ap-northeast-1 ec2 describe-images --owner amazon --query 'Images[?Name!=`null`]|[?contains(Name, `ecs-optimized`) == `true`]|[?contains(Name, to_string(`2016`)) == `true`]|[0:3].[Name,ImageId,CreationDate,Description]' --output text | sort -rk1 | |
amzn-ami-2016.03.g-amazon-ecs-optimized ami-058a4964 2016-08-11T22:26:29.000Z Amazon Linux AMI 2016.03.g x86_64 ECS HVM GP2 | |
amzn-ami-2016.03.e-amazon-ecs-optimized ami-2b08f44a 2016-07-11T22:28:39.000Z Amazon Linux AMI 2016.03.e x86_64 ECS HVM GP2 | |
amzn-ami-2016.03.c-amazon-ecs-optimized ami-095dbf68 2016-05-26T23:32:34.000Z Amazon Linux AMI 2016.03.c x86_64 ECS HVM GP2 | |
# or check the page http://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_container_instance.html for latest AMI ID |
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
$ aws ec2 describe-regions --query 'Regions[*].RegionName' --output table | awk '$2 ~/-/{print $2}' | while read region; do aws ec2 describe-availability-zones --region $region --query AvailabilityZones[*].ZoneName --output table; done | awk '$2 ~/-/{print $2}' | |
ap-south-1a | |
ap-south-1b | |
eu-west-1a | |
eu-west-1b | |
eu-west-1c | |
ap-southeast-1a | |
ap-southeast-1b | |
ap-southeast-2a | |
ap-southeast-2b |
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
#!/bin/bash | |
az=$(curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone) | |
region=${az%%?} | |
instance_id=$(curl -s http://169.254.169.254/latest/meta-data/instance-id) | |
aws ec2 create-tags --resources $instance_id --region $region --tags \ | |
Key=foo,Value=bar \ | |
Key=Name,Value=myname |
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
#!/bin/bash | |
instanceId='i-XXXXXXXXXXXXX' | |
aws elb describe-load-balancers --query \ | |
"LoadBalancerDescriptions[?Instances[?InstanceId=='${instanceId}']].LoadBalancerName" |
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
#!/bin/bash | |
az=$(curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone) | |
region=${az%%?} | |
instance_id=$(curl -s http://169.254.169.254/latest/meta-data/instance-id) | |
logfile='/tmp/termination-time.out' | |
sns_arn=${ARN-undefined_arn} | |
sns_subject=${SUBJECT-"spot instance is terminating"} |
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
#!/bin/bash | |
instance_id=$(curl -s http://169.254.169.254/latest/meta-data/instance-id) | |
az=$(curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone) | |
region=${az%%?} | |
list_elb(){ | |
aws --region $region elb describe-load-balancers --query \ | |
"LoadBalancerDescriptions[?Instances[?InstanceId=='${1}']].LoadBalancerName" | |
} |
OlderNewer