attachPolicy

Attaches a policy to a root, an organizational unit (OU), or an individual account. How the policy affects accounts depends on the type of policy. Refer to the Organizations User Guide for information about each policy type:

You can only call this operation from the management account or a member account that is a delegated administrator.

Samples

// The following example shows how to attach a service control policy (SCP) to an account
organizationsClient.attachPolicy {
    targetId = "333333333333"
    policyId = "p-examplepolicyid111"
}
// The following example shows how to attach a service control policy (SCP) to an OU
organizationsClient.attachPolicy {
    targetId = "ou-examplerootid111-exampleouid111"
    policyId = "p-examplepolicyid111"
}