Skip to content

Instantly share code, notes, and snippets.

View snandam's full-sized avatar

Sanjeev Nithyanandam snandam

View GitHub Profile
@snandam
snandam / aws_check_instance_availability.sh
Last active March 15, 2024 16:33
Identify AWS regions a particular instance type is available
####################
# IAM user need to have "ec2:DescribeInstanceTypeOfferings" permission to be able to run this
####################
#!/bin/bash
instance_type=g5g.2xlarge
echo "Region $instance_type Availability"
echo "------ -------------------------"

Keybase proof

I hereby claim:

  • I am snandam on github.
  • I am askjeev (https://keybase.io/askjeev) on keybase.
  • I have a public key ASDNzb1dsMqfClN6vkTVa7TycNTVHLaFjt_jSD1B0HsCIQo

To claim this, I am signing this object:

@snandam
snandam / ec2.tf
Last active November 15, 2022 19:43
Terraform - Bootstrap ec2 machine with ansible, copy scripts and run playbook
#--------------------------------------------------------------
# Create an EC2 machine, bootstrap with ansible
#
resource "aws_instance" "ec2-linux" {
ami = "ami-a4c7edb2"
vpc_security_group_ids = ["${aws_security_group.allow-all-test-sg.id}"]
key_name = "${var.private_ssh_key}"
instance_type = "t2.nano"
@snandam
snandam / get-latest-ami.sh
Last active August 29, 2017 18:40
Search for latest AWS AMI
#!/bin/bash
aws ec2 \
--region us-east-1 describe-images \
--filters \
'Name=architecture,Values=x86_64' \
'Name=root-device-type,Values=ebs' \
'Name=state,Values=available' \
'Name=virtualization-type,Values=hvm' \
'Name=image-type,Values=machine' \
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
# Load dynamic modules. See /usr/share/nginx/README.dynamic.
```
Attempted to send a bulk request to Elasticsearch configured at '["https://foo.us-east-1.es.amazonaws.com:443"]', but an error occurred and it failed! Are you sure you can reach elasticsearch from this machine using the configuration provided? {:client_config=>{:hosts=>["https://foo.us-east-1.es.amazonaws.com:443"], :region=>"us-east-1", :aws_access_key_id=>"key", :aws_secret_access_key=>"key", :transport_options=>{:request=>{:open_timeout=>0, :timeout=>60}, :proxy=>nil}, :transport_class=>Elasticsearch::Transport::Transport::HTTP::AWS, :logger=>nil, :tracer=>nil, :reload_connections=>false, :retry_on_failure=>false, :reload_on_failure=>false, :randomize_hosts=>false, :http=>{:scheme=>"https", :user=>nil, :password=>nil, :port=>443}}, :error_message=>"[400] {\"error\":\"ElasticsearchIllegalArgumentException[explicit index in bulk is not allowed]\",\"status\":400}", :error_class=>"Elasticsearch::Transport::Transport::Errors::BadRequest", :backtrace=>["/opt/logstash/vendor/bundle/jruby/1.9/gems/elasticsearc
@snandam
snandam / US_zipcode_to_geopoint.yaml
Created November 30, 2015 04:06
Data to use to translate zipcode or postal code to geopoint : logstash transform filter
This file has been truncated, but you can view the full file.
"70175": "30.06, -89.93"
"11542": "40.86, -73.63"
"11547": "40.82, -73.63"
"11545": "40.84, -73.61"
"11548": "40.81, -73.62"
"11549": "40.7, -73.61"
"19399": "40.05, -75.41"
"19398": "40.05, -75.41"
"19397": "40.05, -75.41"
@snandam
snandam / nvm-install.sh
Last active May 27, 2021 11:02
Remove node, npm, nvm and install again
#!/bin/bash
# node-reinstall
# credit:
# http://stackoverflow.com/a/11178106/2083544
# https://gist.github.com/brock/5b1b70590e1171c4ab54
## program version
## Update versions accordingly. https://github.com/creationix/nvm/releases
VERSION="0.31.0"
@snandam
snandam / gist:4794f6a5bfa81c3a815d
Created February 16, 2015 21:20
librarian-puppet install
➜ librarian-test librarian-puppet install --verbose
[Librarian] Ruby Version: 2.0.0
[Librarian] Ruby Platform: universal.x86_64-darwin13
[Librarian] Rubygems Version: 2.0.14
[Librarian] Librarian Version: 0.1.2
[Librarian] Librarian Adapter: puppet
[Librarian] Librarian Adapter Version: 2.0.1
[Librarian] Project: /Users/nithyans/Documents/CDK/Stash/ALM/Puppet_Testing/librarian-test
[Librarian] Specfile: Puppetfile
[Librarian] Lockfile: Puppetfile.lock
@snandam
snandam / check_for_directory.yml
Created November 4, 2014 16:28
Ansible playbook to check for a directory/file in ansible
---
-
hosts: dev
gather_facts: yes
vars:
app_name: creditcompliance
path_to_verify: /var/www/edge-app/{{app_name}}/web/config/app.conf.json
tasks:
-
name: "Check if path exists for {{ path_to_verify }}"