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
- disable nodesync | |
nodesync disable | |
- run repair | |
nodetool repair --full | |
(optional nodetool repair -j ‘max 4 threads’ -pr to reduce | |
pressure on cluster full repair, run one node at a time) | |
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/sh | |
VERSION=${VERSION:-1.6.1} | |
URL=https://github.com/prometheus/node_exporter/releases/download/v${VERSION}/node_exporter-${VERSION}.linux-amd64.tar.gz | |
FILENAME=${URL##*/} | |
ROOT_PATH=$PWD/opt/pkg | |
APP_ROOT_PATH=$ROOT_PATH/opt/node_exporter | |
ITERATION=${ITERATION:-1} | |
mkdir -p $APP_ROOT_PATH/script | |
curl -sLO $URL |
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
"${element(split(",", replace(replace(replace(replace(join(",", data.aws_subnet_ids.private.ids), "/subnet-ca201abd,/", ""), "/subnet-fc0870c1,/", ""), "/subnet-6630da5b/", ""), "/subnet-3f35c402,/", "")), count.index)}" |
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/sh | |
date=`date +%Y-%m-%d -d "30 day ago"` | |
for region in us-east-1 us-west-2 ; do | |
aws ec2 describe-images --region $region --owners self --output text --filters 'Name=name,Values=IMAGE-NAME-*' --query 'Images[?CreationDate<=`'${date}'`][ImageId]' | grep -v `aws ec2 describe-instances --region $region --output text --filters 'Name=tag:Name,Values=IGNORE-STRING-*' --query 'Reservations[*].Instances[*].[ImageId]' | sed -n 1p` > remove_ami-$region.txt | |
for remove in `cat remove_ami-$region.txt` ; do | |
aws ec2 deregister-image --region $region --image-id $remove |
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
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "ECSAccess", | |
"Effect": "Allow", | |
"Action": [ | |
"ecs:Poll", | |
"ecs:StartTask", |
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
resource "aws_cloudwatch_metric_alarm" "cpu_credits" { | |
count = 2 | |
... | |
dimensions { InstanceId = "${element(list("i-07656896d6947814c", "i-042e664331a74e385"), count.index)}" } | |
dimensions { InstanceId = "${element(aws_instance.my_instance.*.id, count.index)}" } | |
} |
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 | |
# Find the absolute path of the java executable | |
# follow all symlinks (to cover /etc/alternatives/java ...) | |
jpath=$(readlink -e $(which java)) | |
if [[ "$jpath" != "" ]]; then | |
while [[ "$jpath" != "/" ]]; do | |
jpath=$(dirname $jpath) |
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/sh | |
email="[email protected]" | |
function runtest { | |
"$@" | |
local status=$? | |
if [ $status -ne 0 ]; then | |
echo "Script failed with error from '$@'" | mail -s "Script failure!" $email | |
exit 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
resource "aws_cloudwatch_metric_alarm" "example_host_alarm" { | |
alarm_name = "${aws_instance.example_host_alarm.id}" | |
comparison_operator = "GreaterThanOrEqualToThreshold" | |
evaluation_periods = "2" | |
metric_name = "StatusCheckFailed_System" | |
namespace = "AWS/EC2" | |
period = "60" | |
statistic = "Maximum" | |
threshold = "1.0" | |
alarm_description = "Created from EC2 Console" |
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
data "terraform_remote_state" "network" { | |
backend = "s3" | |
workspace = "${terraform.workspace}" | |
config { | |
bucket = "bucket-name" | |
key = "terraform.tfstate" | |
region = "${var.region}" | |
} | |
} |