Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@gsantovena
gsantovena / assume-role.sh
Created January 5, 2017 17:39
AWS cross-account assume role - copied from a blog, don't remember where :(
#!/bin/bash
CMD=$@
ACTION=${1:-plan} # I'm using 'plan' because I use this mainly for Terraform/Terragrunt
MAIN_ACCOUNT_ID=${123456789012}
ASSUME_ROLE="arn:aws:iam::${MAIN_ACCOUNT_ID}:role/<IAM_ROLE_NAME>"
ROLE_SESSION_NAME="<SECOND_ACCOUNT_ID_OR_NAME>"
TMP_FILE=".temp_credentials"
@gsantovena
gsantovena / gist:5b601c921d1d5f35568f5ef9e642774c
Created January 3, 2017 00:35 — forked from cnauroth/gist:7ff52e9f80e7d856ddb3
Hadoop NameNode JMX REST Query for NameNodeStatus
> curl 'http://172.20.11.177:50070/jmx?qry=Hadoop:service=NameNode,name=NameNodeStatus'
{
"beans" : [ {
"name" : "Hadoop:service=NameNode,name=NameNodeStatus",
"modelerType" : "org.apache.hadoop.hdfs.server.namenode.NameNode",
"State" : "active",
"NNRole" : "NameNode",
"HostAndPort" : "localhost:19000",
"SecurityEnabled" : false,
"LastHATransitionTime" : 0
@gsantovena
gsantovena / .gitignore
Created July 25, 2016 07:13 — forked from octocat/.gitignore
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@gsantovena
gsantovena / Tree
Last active August 29, 2015 14:27
Create tree on a Unix/Linux/OSX without using tree command. From Twitter @nixcraft
ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'
@gsantovena
gsantovena / gist:7f18457c9ba8db5ff8d9
Last active May 16, 2018 22:07
AWS CLI to get InstanceId and Private IP Address of Instances in AutoScalingGroup
aws --output text --region ${REGION} ec2 describe-instances --instance-ids $(
aws --output text --region ${REGION} \
autoscaling describe-auto-scaling-instances \
--query 'AutoScalingInstances[*].[AutoScalingGroupName,InstanceId]' |
grep ${ASG} |
awk '{ print $2 }'
) --query 'Reservations[*].Instances[*].[InstanceId,PrivateIpAddress]'