attachGroupPolicy
inline suspend fun IamClient.attachGroupPolicy(crossinline block: AttachGroupPolicyRequest.Builder.() -> Unit): AttachGroupPolicyResponse
Attaches the specified managed policy to the specified IAM group.
You use this operation to attach a managed policy to a group. To embed an inline policy in a group, use PutGroupPolicy
.
As a best practice, you can validate your IAM policies. To learn more, see Validating IAM policies in the IAM User Guide.
For more information about policies, see Managed policies and inline policies in the IAM User Guide.
Samples
fun main() {
//sampleStart
// The following command attaches the AWS managed policy named ReadOnlyAccess to the IAM group named
// Finance.
iamClient.attachGroupPolicy {
groupName = "Finance"
policyArn = "arn:aws:iam::aws:policy/ReadOnlyAccess"
}
//sampleEnd
}