AWS code-library documentation change
Summary
Added PowerShell V5 example showing retrieval and decoding of role policy documents
Security assessment
Demonstrates inspection of role policies which is security-relevant, but only documents existing functionality. No vulnerability remediation or new security features are introduced.
Diff
diff --git a/code-library/latest/ug/iam_example_iam_GetRolePolicy_section.md b/code-library/latest/ug/iam_example_iam_GetRolePolicy_section.md index 7d9f67468..b553e0bb2 100644 --- a//code-library/latest/ug/iam_example_iam_GetRolePolicy_section.md +++ b//code-library/latest/ug/iam_example_iam_GetRolePolicy_section.md @@ -112,0 +113,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)_. + + + +