Skip to content

Instantly share code, notes, and snippets.

@ahmetozer
Created November 22, 2023 22:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahmetozer/a5fe06131c874fccc3a3246ed1e28d40 to your computer and use it in GitHub Desktop.
Save ahmetozer/a5fe06131c874fccc3a3246ed1e28d40 to your computer and use it in GitHub Desktop.
AWS Cloud Trail Events to IAM actions
import json
f = open('event.json')
data = json.load(f)
actions = {}
for i in data['Records']:
service=i["eventSource"].split(".")[0]
action=i["eventName"]
if service not in actions:
actions[service]=[]
if action not in actions[service]:
actions[service].append(action)
f.close()
for s in actions:
for a in actions[s]:
print(s+":"+a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment