Skip to content

Instantly share code, notes, and snippets.

@atr0s
atr0s / gist:06ecc48c921fcefc6a4ada4d177eff9b
Created September 21, 2020 00:33
Convert AWS config into assume role links using gawk
gawk 'BEGIN { RS = "\n\n\\[" } {split($2,p,"\]",seps); split($5,a,":",seps); split($5,b,"/",seps) ; if (a[5]!="") printf("https://signin.aws.amazon.com/switchrole?account=%s&displayName=%s&roleName=%s\n",a[5],p[1],b[2])}' ~/.aws/config
@atr0s
atr0s / keybase.md
Created September 11, 2019 21:23
keybase.md

Keybase proof

I hereby claim:

  • I am atr0s on github.
  • I am atros (https://keybase.io/atros) on keybase.
  • I have a public key ASC24pogXsXu3AreHT4vVp3oz8PsePuFLe_AogwIOomgqwo

To claim this, I am signing this object:

@atr0s
atr0s / .bash_profile
Last active April 30, 2024 22:24
AWS Session Manager SSH/SCP helper
# Snippet of code to be put on ~/.bash_profile to help SSH into instances via Session Manager while specifying AWS profiles
# It can be used by saving ~/.ssm_bash_profile and adding the following line to ~/.bash_profile
# source ~/.ssm_bash_profile
function aws-ssm-instance-list {
if [ "$#" -lt 1 ]; then
echo "Usage: aws-ssm-instance-list <profile name>"
else
output=$(aws ssm describe-instance-information --profile $1 --query "InstanceInformationList[*].{Name:ComputerName,Id:InstanceId,IPAddress:IPAddress}" --output text)
echo "$output"