AWS IAM documentation change
Summary
Added PowerShell V5 example with policy decoding for Get-IAMRolePolicy
Security assessment
Shows role policy retrieval and decoding without addressing least privilege or policy security best practices
Diff
diff --git a/IAM/latest/UserGuide/iam_example_iam_GetRolePolicy_section.md b/IAM/latest/UserGuide/iam_example_iam_GetRolePolicy_section.md index 786f2cf9f..7803921c4 100644 --- a//IAM/latest/UserGuide/iam_example_iam_GetRolePolicy_section.md +++ b//IAM/latest/UserGuide/iam_example_iam_GetRolePolicy_section.md @@ -110,0 +111,53 @@ PowerShell +**Tools for PowerShell V5** + + +**Example 1: This example returns the permissions policy document for the policy named`oneClick_lambda_exec_role_policy` that is embedded in the IAM role `lamda_exec_role`. The resulting policy document is URL encoded. It is decoded in this example with the `UrlDecode` .NET method.** + + + $results = Get-IAMRolePolicy -RoleName lambda_exec_role -PolicyName oneClick_lambda_exec_role_policy + $results + + +**Output:** + + + PolicyDocument PolicyName UserName + -------------- ---------- -------- + %7B%0A%20%20%22Version%22%3A%20%222012-10-17%22%2C%... oneClick_lambda_exec_role_policy lambda_exec_role + + + [System.Reflection.Assembly]::LoadWithPartialName("System.Web.HttpUtility") + [System.Web.HttpUtility]::UrlDecode($results.PolicyDocument) + + +**Output:** + + + { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "logs:*" + ], + "Resource": "arn:aws:logs:*:*:*" + }, + { + "Effect": "Allow", + "Action": [ + "s3:GetObject", + "s3:PutObject" + ], + "Resource": [ + "arn:aws:s3:::*" + ] + } + ] + } + + * For API details, see [GetRolePolicy](https://docs.aws.amazon.com/powershell/v5/reference) in _AWS Tools for PowerShell Cmdlet Reference (V5)_. + + + +