IAM: CLI: How to get contents of a policy?

0

A. Policy: AmazonS3ReadOnlyAccess
B. Arn: arn:aws:iam::aws:policy/AmazonS3ReadOnlyAccess

C. Console view:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:Get*",
"s3:List*"
],
"Resource": "*"
}
]
}

D. How can I get that JSON (C.) output from CLI?

Please, advise. Thank you.

~ Mike

helices
已提问 5 年前1851 查看次数
1 回答
0
已接受的回答

Hello

  1. you could use a get-policy-version
aws iam get-policy-version --policy-arn arn:aws:iam::ACCOUNTNUMBER:policy/MyPolicy --version-id v1

https://docs.aws.amazon.com/cli/latest/reference/iam/get-policy-version.html

  1. if you are using organizations, you could do a "describe-policy" to get the content.
aws organizations describe-policy --policy-id p-yourPolicyID

https://docs.aws.amazon.com/cli/latest/reference/organizations/describe-policy.html

hope this helps,
RT

rtt
已回答 5 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则