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
gefragt vor 5 Jahren1860 Aufrufe
1 Antwort
0
Akzeptierte Antwort

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
beantwortet vor 5 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen