Skip to content

Instantly share code, notes, and snippets.

View kshailen's full-sized avatar

Shailendra kshailen

View GitHub Profile
@kshailen
kshailen / Functional Test cases for putting and getting keys in etcd cluster
Last active July 12, 2017 02:23
Pythn Program to put key value pair in etcd cluster
#Suppose both files are presenen in functionalTest directory. There is following way to run context on this.
#Method 1
[root@marx-vagrant-setup coreos-vagrant]# run-contexts functionalTest
10
.....
----------------------------------------------------------------------
PASSED!
2 contexts, 3 assertions
(0.2 seconds)
@kshailen
kshailen / Build and RUN Dockerfile with becnchmark and hey
Last active June 21, 2017 01:59
Building a docker which has go language , benchmark tool , hey and bech.sh
#Go to the directory where you have put this docker file.
cd <Path to the DockerFile>
# Run following to build an docker image
docker build -t go-container .
#Check image by using docker images. It will show like this.
shailendra-kumar:Docker shailendra.kumar$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
1.Test procedure
A- Take cluster of 3 etcd noses as shown below
core@core-02 ~ $ etcdctl cluster-health
member 348dd9a63bc9c9d3 is healthy: got healthy result from http://172.17.8.102:2379
member 7d26e3d2ee11a98e is healthy: got healthy result from http://172.17.8.103:2379
member 95d2e7af71fc961d is healthy: got healthy result from http://172.17.8.101:2379
cluster is healthy
core@core-02 ~ $ etcdctl member list
348dd9a63bc9c9d3: name=219d42232433483c8ad19163ba1c6020 peerURLs=http://172.17.8.102:2380 clientURLs=http://172.17.8.102:2379 isLeader=true
7d26e3d2ee11a98e: name=edbfd19500b0496485e286801bdfa04b peerURLs=http://172.17.8.103:2380 clientURLs=http://172.17.8.103:2379 isLeader=false
@kshailen
kshailen / ETCD Run Book - REST API
Last active July 14, 2017 08:44
CoreOS ETCD Cluster RUN book
Other way of intracting with ETCD is HTTP/JSON API.
Etcd HTTP/JSON API Usage
The other way to interacting with etcd is with the simple HTTP/JSON API.
To access the API, you can use a simple HTTP program like curl. You must supply the -L flag to follow any redirects that are passed back. From within your cluster, you can use the local 127.0.0.1 interface and port 4001/2379 for most queries.
The normal keyspace can be reached by going to http://127.0.0.1:4001/v2/keys/ on any of the host machines. For instance, to get a listing of the top-level keys/directories, type:
##################### ElasticSearch Configuration Example #####################
# This file contains an overview of various configuration settings,
# targeted at operations staff. Application developers should
# consult the guide at <http://elasticsearch.org/guide>.
#
# The installation procedure is covered at
# <http://elasticsearch.org/guide/en/elasticsearch/reference/current/setup.html>.
#
# ElasticSearch comes with reasonable defaults for most settings,
@kshailen
kshailen / elasticsearch.yml
Created August 4, 2017 09:44 — forked from alinpopa/elasticsearch.yml
elasticsearch.yml example
name: ${HOSTNAME}
# The cluster should be named with the name of the AD domain
cluster:
name: bldrprod-0.14.0
routing:
allocation:
# As small as possible, very large performance hits during recovery
concurrent_recoveries: 1
@kshailen
kshailen / CheckUpdateCertificates.sh
Last active August 23, 2017 14:40
CulsterManagerAPI Check
#!/bin/bash
#Check for paas-cluster-manager
HOST=`fleetctl list-units | grep paas-cluster-manager| grep -w active | grep running |head -1 | awk '{print $2}' | awk -F"/" '{print $NF}'`
if [ -z $HOST ]then
echo "paas-cluster-manager is not running in this Cluster"
exit 1
@kshailen
kshailen / test_CreateLogFile.py
Created September 15, 2017 02:51
Testing log file creation in /var/log/msi directory
import requests
import json
import os
import subprocess
import skycommon
class When_getting_machine_list_from_fleet_and_comparing_with_elastic_machine_list:
def __init__(self):
@kshailen
kshailen / Connecting_postgress_RDS_from_local_via_bastion.md
Last active May 14, 2024 11:51
Ways to connect to postgress RDS instance from bastion host and from local host

When it comes to databases and AWS VPC, best practice is to place your database in private subnet. By definition, private subnet in AWS is not reachable from the Internet because no Internet gateway is attached to private subnet. This is the way you protect your data. This kind of configuration is good for security but bad for data management.

How can you easily access and manage your secured data?

basic_RDS_bastion_architecture

There are two basic ways to acees it.

  1. Access postgres RDS from bastion host. There are following requirements for this.
@kshailen
kshailen / 01_get_account_id_for_user_ec2instance_role_or_lambda.py
Created April 8, 2020 07:22 — forked from gene1wood/01_get_account_id_for_user_ec2instance_role_or_lambda.py
Method to determine your AWS account ID using boto3 for either a user or an ec2 instance or lambda function
import boto3
print(boto3.client('sts').get_caller_identity()['Account'])