Copyright | (c) 2013-2017 Brendan Hay |
---|---|
License | Mozilla Public License, v. 2.0. |
Maintainer | Brendan Hay <brendan.g.hay+amazonka@gmail.com> |
Stability | auto-generated |
Portability | non-portable (GHC extensions) |
Safe Haskell | None |
Language | Haskell2010 |
Attaches a policy to a root, an organizational unit, or an individual account. How the policy affects accounts depends on the type of policy:
- Service control policy (SCP) - An SCP specifies what permissions can be delegated to users in affected member accounts. The scope of influence for a policy depends on what you attach the policy to:
- If you attach an SCP to a root, it affects all accounts in the organization.
- If you attach an SCP to an OU, it affects all accounts in that OU and in any child OUs.
- If you attach the policy directly to an account, then it affects only that account.
SCPs essentially are permission "filters". When you attach one SCP to a higher level root or OU, and you also attach a different SCP to a child OU or to an account, the child policy can further restrict only the permissions that pass through the parent filter and are available to the child. An SCP that is attached to a child cannot grant a permission that is not already granted by the parent. For example, imagine that the parent SCP allows permissions A, B, C, D, and E. The child SCP allows C, D, E, F, and G. The result is that the accounts affected by the child SCP are allowed to use only C, D, and E. They cannot use A or B because they were filtered out by the child OU. They also cannot use F and G because they were filtered out by the parent OU. They cannot be granted back by the child SCP; child SCPs can only filter the permissions they receive from the parent SCP.
AWS Organizations attaches a default SCP named "FullAWSAccess
to every root, OU, and account. This default SCP allows all services and actions, enabling any new child OU or account to inherit the permissions of the parent root or OU. If you detach the default policy, you must replace it with a policy that specifies the permissions that you want to allow in that OU or account.
For more information about how Organizations policies permissions work, see Using Service Control Policies in the AWS Organizations User Guide .
This operation can be called only from the organization's master account.
Creating a Request
Creates a value of AttachPolicy
with the minimum fields required to make a request.
Use one of the following lenses to modify other fields as desired:
apPolicyId
- The unique identifier (ID) of the policy that you want to attach to the target. You can get the ID for the policy by calling theListPolicies
operation. The regex pattern for a policy ID string requires "p-" followed by from 8 to 128 lower-case letters or digits.apTargetId
- The unique identifier (ID) of the root, OU, or account that you want to attach the policy to. You can get the ID by calling theListRoots
,ListOrganizationalUnitsForParent
, orListAccounts
operations. The regex pattern for a target ID string requires one of the following: * Root: a string that begins with "r-" followed by from 4 to 32 lower-case letters or digits. * Account: a string that consists of exactly 12 digits. * Organizational unit (OU): a string that begins with "ou-" followed by from 4 to 32 lower-case letters or digits (the ID of the root that the OU is in) followed by a second "-" dash and from 8 to 32 additional lower-case letters or digits.
data AttachPolicy Source #
See: attachPolicy
smart constructor.
Request Lenses
apPolicyId :: Lens' AttachPolicy Text Source #
The unique identifier (ID) of the policy that you want to attach to the target. You can get the ID for the policy by calling the ListPolicies
operation. The regex pattern for a policy ID string requires "p-" followed by from 8 to 128 lower-case letters or digits.
apTargetId :: Lens' AttachPolicy Text Source #
The unique identifier (ID) of the root, OU, or account that you want to attach the policy to. You can get the ID by calling the ListRoots
, ListOrganizationalUnitsForParent
, or ListAccounts
operations. The regex pattern for a target ID string requires one of the following: * Root: a string that begins with "r-" followed by from 4 to 32 lower-case letters or digits. * Account: a string that consists of exactly 12 digits. * Organizational unit (OU): a string that begins with "ou-" followed by from 4 to 32 lower-case letters or digits (the ID of the root that the OU is in) followed by a second "-" dash and from 8 to 32 additional lower-case letters or digits.
Destructuring the Response
attachPolicyResponse :: AttachPolicyResponse Source #
Creates a value of AttachPolicyResponse
with the minimum fields required to make a request.
data AttachPolicyResponse Source #
See: attachPolicyResponse
smart constructor.