Skip to content

Instantly share code, notes, and snippets.

@sharmaansh21
sharmaansh21 / rds_enhanced_monitoring2mackerel_host_metrics.py
Created June 25, 2017 07:54 — forked from ohsawa0515/rds_enhanced_monitoring2mackerel_host_metrics.py
Send metrics of RDS enhanced monitoring(Cloudwatch Logs) to Mackerel host metrics using AWS Lambda.
from __future__ import print_function
from base64 import b64decode
from urllib2 import Request, urlopen
import time
import json
import zlib
from datetime import datetime, timedelta
import boto3
import os
@sharmaansh21
sharmaansh21 / nginx.conf
Created June 10, 2017 08:14 — forked from cpswan/nginx.conf
Using nginx to proxy to an AWS ELB
daemon off;
worker_processes 1;
events { worker_connections 1024; }
http{
sendfile on;
@sharmaansh21
sharmaansh21 / lambda_function-ECS-cloudwatch-slack.py
Created June 1, 2017 04:06 — forked from dfetterman/lambda_function-ECS-cloudwatch-slack.py
Lambda function that takes ECS Cloudwatch events and sends a notification to Slack
# Written by Dane Fetterman on 12/1/2016
# https://aws.amazon.com/blogs/compute/monitor-cluster-state-with-amazon-ecs-event-stream/
# Where they use a cloud watch event from ECS to notify a SNS topic. We're
# sending a notification directly to slack instead
import requests
import json
from boto3 import session, client
@sharmaansh21
sharmaansh21 / RDS-Aurora-CloudFormation-Example.yaml
Created May 20, 2017 02:53 — forked from sjparkinson/RDS-Aurora-CloudFormation-Example.yaml
A basic CloudFormation template for an RDS Aurora cluster.
---
AWSTemplateFormatVersion: 2010-09-09
Description: A basic CloudFormation template for an RDS Aurora cluster.
Parameters:
DatabaseInstanceType:
Default: db.r3.large
AllowedValues:
- db.r3.large
- db.r3.xlarge
- db.r3.2xlarge
@sharmaansh21
sharmaansh21 / 100_base.conf
Created April 4, 2017 16:00 — forked from danackerson/100_base.conf
using nginx + lua + redis for redirects and rewrites
# using such a setup requires `apt-get install lua-nginx-redis` under Ubuntu Trusty
# more info @ http://wiki.nginx.org/HttpLuaModule#access_by_lua
http {
lua_package_path "/etc/nginx/include.d/?.lua;;";
lua_socket_pool_size 100;
lua_socket_connect_timeout 10ms;
lua_socket_read_timeout 10ms;
server {
@sharmaansh21
sharmaansh21 / elasticsearch.yml
Created March 1, 2017 17:41 — forked from reyjrar/elasticsearch.yml
ElasticSearch config for a write-heavy cluster
##################################################################
# /etc/elasticsearch/elasticsearch.yml
#
# Base configuration for a write heavy cluster
#
# Cluster / Node Basics
cluster.name: logng
# Node can have abritrary attributes we can use for routing
@sharmaansh21
sharmaansh21 / coreos-ecs-agent-cloudformation.template
Created February 27, 2017 05:17 — forked from kgorskowski/coreos-ecs-agent-cloudformation.template
AWS CloudFormation Template for CoreOS stable including AWS ECS Agent. Provide ECS - Cluster and IAM Role, otherwise the ECS service will not work
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "CoreOS on EC2: http://coreos.com/docs/running-coreos/cloud-providers/ec2/",
"Mappings" : {
"RegionMap" : {
"eu-central-1" : {
"AMI" : "ami-487d4d55"
},
@sharmaansh21
sharmaansh21 / Dockerfile
Created February 22, 2017 05:57 — forked from rlister/Dockerfile
Example Dockerfile for NewRelic sysmond
FROM busybox:ubuntu-14.04
MAINTAINER [email protected]
ENV VERSION 2.3.0.132
ADD https://download.newrelic.com/server_monitor/release/newrelic-sysmond-${VERSION}-linux.tar.gz .
RUN tar zxvf newrelic-sysmond-${VERSION}-linux.tar.gz && \
rm -f newrelic-sysmond-${VERSION}-linux.tar.gz
WORKDIR /newrelic-sysmond-${VERSION}-linux
@sharmaansh21
sharmaansh21 / openresty-ubuntu-install.sh
Created January 25, 2017 11:06 — forked from developersteve/openresty-ubuntu-install.sh
Easy install openresty (used and tested on Ubuntu 14.04, 15.10 and 16.04)
#!/bin/bash
apt-get -y update
apt-get -y install nginx-extras build-essential libpcre3-dev libssl-dev libgeoip-dev libpq-dev libxslt1-dev libgd2-xpm-dev
wget -c https://openresty.org/download/openresty-1.9.15.1.tar.gz
tar zxvf openresty-1.9.15.1.tar.gz
cd openresty-1.9.15.1
./configure \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
@sharmaansh21
sharmaansh21 / migrate-redis.py
Created November 26, 2016 03:40 — forked from thomasst/migrate-redis.py
Migrate Redis data on Amazon ElastiCache
"""
Copies all keys from the source Redis host to the destination Redis host.
Useful to migrate Redis instances where commands like SLAVEOF and MIGRATE are
restricted (e.g. on Amazon ElastiCache).
The script scans through the keyspace of the given database number and uses
a pipeline of DUMP and RESTORE commands to migrate the keys.
Requires Redis 2.8.0 or higher.