I am looking for a way to list all of the actions that can be used in a AWS IAM policy.
This is an example policy that uses IAM actions:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1457442845000",
"Effect": "Allow",
"Action": [
"iam:CreatePolicy",
"iam:CreatePolicyVersion",
"iam:GetGroupPolicy",
"iam:CreateGroup",
"iam:GetPolicy",
"iam:GetPolicyVersion",
"iam:GetRolePolicy",
"iam:ListAttachedGroupPolicies"
],
"Resource": [
"*"
]
}
]
}
I would like to search through actions from a file, and for that I would like to have all the available actions. I could not find a way yet to get that list. Any direction is appreciated.
I liked Trentium answer, but it will need maintenance.
I think I will use the AWS Policy Generator call for the policies.js file
Amazon provides a policy generator which it self, knows all of the possible APIs and Actions at the current point in time.
One can generate a list of Actions from the AWS Policy Generator policies.js
:
curl --header 'Connection: keep-alive' \
--header 'Pragma: no-cache' \
--header 'Cache-Control: no-cache' \
--header 'Accept: */*' \
--header 'Referer: https://awspolicygen.s3.amazonaws.com/policygen.html' \
--header 'Accept-Language: en-US,en;q=0.9' \
--silent \
--compressed \
'https://awspolicygen.s3.amazonaws.com/js/policies.js' |
cut -d= -f2 |
jq -r '.serviceMap[] | .StringPrefix as $prefix | .Actions[] | "\($prefix):\(.)"' |
sort |
uniq
If you have node installed on your machine, simply type npx get-aws-actions
in your terminal. No need to install anything. This npx command fetches the actions from the AWS policy generator file https://awspolicygen.s3.amazonaws.com/js/policies.js
and support text search to pinpoint the actions for specific AWS services (e.g., search for s3:
to list all the S3 actions).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With