Skip to content

Instantly share code, notes, and snippets.

@kaizenlpi
kaizenlpi / sts-console.py
Created January 18, 2019 21:03 — forked from andresriancho/sts-console.py
How to decode STS message from AWS using boto, helpful to debug permissions issues with IAM policies
>>> import json
>>> import pprint
>>> from boto.sts import STSConnection
>>> s = STSConnection()
>>> d = s.decode_authorization_message('48hdmxfrx3...41DFkQ') # replace with your own string
>>> pprint.pprint(json.loads(d.decoded_message), indent=4)
{ u'allowed': False,
u'context': { u'action': u'iam:PassRole',
u'conditions': { u'items': []},
u'principal': { u'arn': u'arn:aws:iam::334918212912:user/staging-bouncer',
@kaizenlpi
kaizenlpi / instance-types.sh
Created June 28, 2018 20:21 — forked from trestletech/instance-types.sh
Get all EC2 Instance Types in All Availability Zones
#!/bin/bash
echo "Getting list of Availability Zones"
all_regions=$(aws ec2 describe-regions --output text --query 'Regions[*].[RegionName]' | sort)
all_az=()
while read -r region; do
az_per_region=$(aws ec2 describe-availability-zones --region $region --query 'AvailabilityZones[*].[ZoneName]' --output text | sort)
while read -r az; do
#!/usr/bin/env bash
apt-get -y update
apt-get -y upgrade
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline-gplv2-dev libyaml-dev libffi-dev libjemalloc-dev
apt-get -y install autoconf curl bzip2
apt-get -y autoremove
apt-get -y clean
cd /usr/local/src
curl http://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.2.tar.gz