Skip to content

Instantly share code, notes, and snippets.

@omerh
omerh / restore_proc.md
Last active August 12, 2019 10:51
Restore and rename aws elasticsearch kibana from snapshot

get repositories name

curl -XGET 'https://<domain-end-point>/_snapshot/_all

list snapshots from the repository

curl -XGET 'https:///_snapshot//_all
@omerh
omerh / index.js
Created July 15, 2019 12:31
Stream multiple lambda's to amazon aws elasticsearch service (Rejecting mapping update to index _type, hardcoding action.index._type)
// v1.1.2
var https = require('https');
var zlib = require('zlib');
var crypto = require('crypto');
var endpoint = 'aws-elasticsearch-service-endpoint-url';
// Set this to true if you want to debug why data isn't making it to
// your Elasticsearch cluster. This will enable logging of failed items
// to CloudWatch Logs.
@omerh
omerh / enable-websocket-on-aws-elb.sh
Created April 18, 2019 17:20
Adding support for web socket when using ELB
# First create policy
aws elb --region us-west-2\
create-load-balancer-policy \
--load-balancer-name ${elb-name} \
--policy-name EnableProxyProtocol \
--policy-type-name ProxyProtocolPolicyType \
--policy-attributes AttributeName=ProxyProtocol,AttributeValue=True
# Attach the policy to the elb
aws elb --region us-west-2 \
@omerh
omerh / curl.md
Created February 27, 2019 14:18 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@omerh
omerh / kops_to_git.sh
Created January 23, 2019 18:55
This can help with proper git flow before changes when using Kops
#!/bin/bash
echo "Getting all statestore safe configs from S3"
CLUSTERS=$(kops get cluster | grep -v NAME | awk '{print $1}')
for CLUSTER in $CLUSTERS; do
if [ ! -d $CLUSTER ]; then
mkdir $CLUSTER
fi
server {
listen *:443 ssl http2;
server_tokens off;
server_name www.domain.com;
ssl on;
ssl_certificate /path/to/cert;
ssl_certificate_key /path/to/key;
# Add all headers
@omerh
omerh / user_data.sh
Created December 23, 2018 14:30
AWS NVMe user data to add to /etc/fstab
#!/bin/bash
## nvme to fstab blkid
##
##
## Disk mapping:
## Cassandra commitlog: /dev/sdb
## Cassandra data: /dev/sdc
##
######################################
#!/bin/bash
#
# https://github.com/kubernetes/kops/blob/master/docs/networking.md
# https://chrislovecnm.com/kubernetes/cni/choosing-a-cni-provider/
# Trouble at scale
# https://blog.openai.com/scaling-kubernetes-to-2500-nodes/
export NODE_SIZE=${NODE_SIZE:-t2.micro}
export NODE_COUNT='99'
export MASTER_SIZE=${MASTER_SIZE:-m4.large}
#!/bin/bash
#
# https://github.com/kubernetes/kops/blob/master/docs/networking.md
# https://chrislovecnm.com/kubernetes/cni/choosing-a-cni-provider/
# Trouble at scale
# https://blog.openai.com/scaling-kubernetes-to-2500-nodes/
export NODE_SIZE=${NODE_SIZE:-t2.micro}
export NODE_COUNT='99'
export MASTER_SIZE=${MASTER_SIZE:-m4.large}
#!/bin/bash
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt-get update
apt-get install -y systemd apt-transport-https ca-certificates docker-ce