AWS code-library documentation change
Summary
Refactored policy document formatting, updated client initialization methods to use fromEnvironment, and simplified credential provider configuration
Security assessment
Changes focus on code style improvements and modern client initialization patterns. The S3 policy still contains a wildcard action ('s3:*') and resource ('*'), but this is existing behavior. No explicit security guidance added or vulnerabilities addressed in the documentation changes.
Diff
diff --git a/code-library/latest/ug/iam_example_iam_Scenario_CreateUserAssumeRole_section.md b/code-library/latest/ug/iam_example_iam_Scenario_CreateUserAssumeRole_section.md index b261f27b9..7199a786e 100644 --- a//code-library/latest/ug/iam_example_iam_Scenario_CreateUserAssumeRole_section.md +++ b//code-library/latest/ug/iam_example_iam_Scenario_CreateUserAssumeRole_section.md @@ -4158,13 +4158,14 @@ Create functions that wrap IAM user actions. - val policyDocumentValue: String = - "{" + - " \"Version\": \"2012-10-17\"," + - " \"Statement\": [" + - " {" + - " \"Effect\": \"Allow\"," + - " \"Action\": [" + - " \"s3:*\"" + - " ]," + - " \"Resource\": \"*\"" + - " }" + - " ]" + - "}" + val policyDocumentValue = """ + { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "s3:*" + ], + "Resource": "*" + } + ] + } + """.trimIndent() @@ -4178 +4179 @@ Create functions that wrap IAM user actions. - IamClient { region = "AWS_GLOBAL" }.use { iamClient -> + IamClient.fromEnvironment { region = "AWS_GLOBAL" }.use { iamClient -> @@ -4212 +4213 @@ Create functions that wrap IAM user actions. - IamClient { region = "AWS_GLOBAL" }.use { iamClient -> + IamClient.fromEnvironment { region = "AWS_GLOBAL" }.use { iamClient -> @@ -4255,5 +4256 @@ Create functions that wrap IAM user actions. - val stsClient = - StsClient { - region = "us-east-1" - } - + val stsClient = StsClient.fromEnvironment { region = "us-east-1" } @@ -4272,2 +4269 @@ Create functions that wrap IAM user actions. - val staticCredentials = - StaticCredentialsProvider { + val staticCredentials = StaticCredentialsProvider { @@ -4280,3 +4276 @@ Create functions that wrap IAM user actions. - val s3 = - S3Client { - credentialsProvider = staticCredentials + val s3 = S3Client.fromEnvironment { @@ -4283,0 +4278 @@ Create functions that wrap IAM user actions. + credentialsProvider = staticCredentials @@ -4305 +4300 @@ Create functions that wrap IAM user actions. - val iam = IamClient { region = "AWS_GLOBAL" } + val iam = IamClient.fromEnvironment { region = "AWS_GLOBAL" } @@ -4336 +4331 @@ Create functions that wrap IAM user actions. - val iam = IamClient { region = "AWS_GLOBAL" } + val iam = IamClient.fromEnvironment { region = "AWS_GLOBAL" }