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
rpm --nodeps -e mysql-libs percona-xtrabackup-20 | |
rpm -qa | grep percona-release-0.0-1* || rpm -ivh http://www.percona.com/downloads/percona-release/percona-release-0.0-1.x86_64.rpm | |
yum -y install perl-DBD-MySQL perl-DBI | |
yum -y install Percona-Server-client-56 Percona-Server-devel-56 Percona-Server-server-56 Percona-Server-shared-56 percona-xtrabackup percona-toolkit | |
touch /var/log/mysql-slow.log | |
chown mysql.mysql /var/log/mysql-slow.log | |
chmod 755 /var/log/mysql-slow.log |
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
wget "https://packages.chef.io/files/stable/chef-server/12.14.0/el/6/chef-server-core-12.14.0-1.el6.x86_64.rpm" | |
rpm -Uvh chef-server-core-12.14.0-1.el6.x86_64.rpm | |
chef-server-ctl reconfigure | |
chef-server-ctl install chef-manage | |
chef-server-ctl reconfigure | |
chef-manage-ctl reconfigure |
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 | |
# port 15672 belongs to rabbitmq management portal, if not enabled use below command. | |
# rabbitmq-plugins enable rabbitmq_management | |
# guest:guest replace it with username:password of rabbitmq readonly user | |
status=$(curl -s -o /dev/null -w "%{http_code}" localhost:15672/api/overview --user guest:guest) | |
if [ $status = "200" ]; then |
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
#!/usr/bin/env python | |
##### USE ON YOUR OWN RISK - THIS IS GOING TO DEREGISTER AMI OLDER THAN 30 DAYS | |
import boto3 | |
from dateutil.parser import parse | |
import datetime | |
age = 30 | |
aws_profile_name = 'prod' | |
def days_old(date): | |
get_date_obj = parse(date) |
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
#!/usr/bin/python | |
#This script is useful for reducing the unnecessary cost inccured while using AWS | |
#It checks | |
#1.for all the idle load balancers in your account | |
#2.Checks the number of RDS connections in the past 1 week | |
#3.Identifies all the idle EBS Volumes | |
#4.Checks for all the Legacy instances which are being used | |
#5.Checks whether the ec2 instances are being fully utilised or not | |
#6.Checks all the unassociated Elastic IP's |
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
#!/usr/bin/env python | |
# find REPLACE_WITH_ARN and replace with real SNS ARN | |
import boto3 | |
from dateutil.parser import parse | |
import datetime | |
aws_profile_name = 'prod' | |
def get_instance_name(fid): |
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
import os | |
import boto3 | |
key=os.environ['TF_VAR_aws_access_key'] | |
secret=os.environ['TF_VAR_aws_secret_key'] | |
client = boto3.client('ec2', region_name=os.environ['TF_VAR_region'], aws_access_key_id=key, aws_secret_access_key=secret) | |
def elastic_ips_cleanup(client_connection): | |
""" Cleanup elastic IPs that are not being used """ | |
addresses_dict = client_connection.describe_addresses() |
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
#!/usr/bin/env python | |
##### USE ON YOUR OWN RISK - THIS IS GOING TO delete_snapshot OLDER THAN 30 DAYS | |
import datetime | |
import sys | |
import boto3 | |
age = 30 | |
aws_profile_name = 'prod' | |
def days_old(date): | |
date_obj = date.replace(tzinfo=None) | |
diff = datetime.datetime.now() - date_obj |
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
import time | |
import datetime | |
import requests | |
import boto3 | |
aws_profile_name = 'default' | |
token = 'XXX' # generate token from http://docs.spotinst.com/#page:authentication,header:header-permanent-access-token | |
headers = {'Authorization': 'Bearer '+token} | |
def get_instance_by_id(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
import boto3 | |
s3 = boto3.client('s3') | |
response = s3.list_buckets() | |
buckets = [bucket['Name'] for bucket in response['Buckets']] | |
for bucket in buckets: | |
print bucket | |
tag={'TagSet':[{'Key': 'Name', 'Value': bucket}]} | |
try: | |
response = s3.put_bucket_tagging(Bucket=bucket, Tagging=tag) |
OlderNewer