Skip to content

Instantly share code, notes, and snippets.

@ritesh
Created June 24, 2020 10:11
Show Gist options
  • Save ritesh/4dbcef60ce9afd45d7b3075d9caf2691 to your computer and use it in GitHub Desktop.
Save ritesh/4dbcef60ce9afd45d7b3075d9caf2691 to your computer and use it in GitHub Desktop.
List of IAM actions via the policy editor
#!/bin/bash
rm policies.js
rm service_actions.txt
curl -s https://awsiamconsole.s3.amazonaws.com/iam/assets/js/bundles/policies.js -O && node -e "app={}; EnvInfo ={}; _ = {has: function() {return false;}, extend: function(){},};require('./policies.js'); console.log(JSON.stringify(app));" | jq .PolicyEditorConfig.serviceMap > service_actions.txt
python iam_actions.py
import json
with open('service_actions.txt') as f:
a = json.loads(f.read())
for k, v in a.items():
prefix = (v['StringPrefix'])
for action in v['Actions']:
print (prefix + ":" + action)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment