Skip to content

Instantly share code, notes, and snippets.

View arbabnazar's full-sized avatar
🏠
Working from home

Arbab Nazar arbabnazar

🏠
Working from home
View GitHub Profile
@arbabnazar
arbabnazar / README
Created October 10, 2019 09:38
[Python] MFA authentication when using AWS CLI
**Try to run**
```
python export_commands_generation.py
Enter your token code: 123456
export AWS_ACCESS_KEY_ID=XXXXXXXXXXXXXXXXXXXX
export AWS_SECRET_ACCESS_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
export AWS_SESSION_TOKEN=FQoGZXIvYXdzIn
```
**Try exporting to an environment variable**
Copy, paste, and execute the 3-line export command output by the script.
@arbabnazar
arbabnazar / es_ping.py
Created July 2, 2019 06:56 — forked from jamesdavidson/es_ping.py
Ping Amazon Elasticsearch Service in Python3
import sys
from elasticsearch import Elasticsearch, RequestsHttpConnection
from aws_requests_auth.boto_utils import BotoAWSRequestsAuth
# sanity check Python version
assert(sys.version_info >= (3,6))
ES_ENDPOINT = 'search-dev-logs-kxsz2asdflkjlaksdfie7i36iry.ap-southeast-2.es.amazonaws.com'
AWS_REGION = 'ap-southeast-2'
@arbabnazar
arbabnazar / logstash-cloudwatch.yml
Created July 2, 2019 06:56 — forked from callum-p/logstash-cloudwatch.yml
Deploys lambda functions to forward cloudwatch logs to logstash
Description: Deploys lambda functions to forward cloudwatch logs to logstash
Parameters:
coreNetworkingStackName:
Type: String
Resources:
lambdaRole:
Type: "AWS::IAM::Role"
Properties:
@arbabnazar
arbabnazar / websocket-elb.md
Created April 23, 2019 20:23 — forked from zhiguangwang/websocket-elb.md
Configure websockets behind an AWS ELB.
@arbabnazar
arbabnazar / elb-nginx-websockets.md
Created April 23, 2019 20:22 — forked from Likeyn/elb-nginx-websockets.md
How-to websockets through ELB + Nginx reverse proxy

Websockets-through-ELB-to-Nginx-to-another-ELB recap

We need to setup an ELB with SSL termination in front of a Nginx reverse proxy to some already working ELB + project system. IOW: SSL-ELB -> Nginx reverse proxy -> ELB -> project. We'll assume the last ELB + project bit works properly.

Front ELB configuration

  • Configure the listeners to use TCP (80) instead of HTTP to allow the websockets (non-HTTP) to pass through. For HTTPS with SSL termination, simply use SSL (443) -> TCP (80)
@arbabnazar
arbabnazar / elb-nodejs-ws.md
Created April 23, 2019 20:20 — forked from obolton/elb-nodejs-ws.md
Configuring an AWS Elastic Load Balancer for a Node.js application using WebSockets on EC2

AWS ELB with Node.js and WebSockets

This assumes that:

  • You are using Nginx.
  • You want to accept incoming connections on port 80.
  • Your Node.js app is listening on port 3000.
  • You want to be able to connect to your Node.js instance directly as well as via the load balancer.

####1. Create load balancer

@arbabnazar
arbabnazar / autoscaling_boto.py
Created December 2, 2018 16:04 — forked from numan/autoscaling_boto.py
Example of setting up AWS auto scaling using boto API
"""
The MIT License (MIT)
Copyright (c) 2011 Numan Sachwani
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
@arbabnazar
arbabnazar / MySQL_5-7_macOS.md
Created October 31, 2018 17:34 — forked from robhrt7/MySQL_5-7_macOS.md
Install MySQL 5.7 on macOS using Homebrew

This is a fork of original gist https://gist.github.com/nrollr/3f57fc15ded7dddddcc4e82fe137b58e, with slight changes on pointing to 5.7 version branch, instead of 8 (latest default of MySQL in Hombrew).

Install MySQL 5.7 on macOS

This procedure explains how to install MySQL using Homebrew on macOS (Sierra 10.12 and up)

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.
update-alternatives --config python

Keybase proof

I hereby claim:

  • I am arbabnazar on github.
  • I am arbabnazar (https://keybase.io/arbabnazar) on keybase.
  • I have a public key ASAjO-Asee6WMD-XySaC3xOjrCEkrUCCQcvYdGLrkJKW1Qo

To claim this, I am signing this object: