

# Managing organization policies with AWS Organizations
<a name="orgs_manage_policies"></a>

Policies in AWS Organizations enable you to apply additional types of management to the AWS accounts in your organization. You can use policies when [all features are enabled ](orgs_manage_org_support-all-features.md) in your organization.

The AWS Organizations console displays the enabled or disabled status for each policy type. On the **Organize accounts** tab, choose the `Root` in the left navigation pane. The details pane on the right side of the screen shows all of the available policy types. The list indicates which are enabled and which are disabled in that organization root. If the option to **Enable** a type is present, that type is currently disabled. If the option to **Disable** a type is present, that type is currently enabled.

**Topics**
+ [Policy types](#orgs-policy-types)
+ [Authorization policies](orgs_manage_policies_authorization_policies.md)
+ [Management policies](orgs_manage_policies_management_policies.md)
+ [Delegated administrator for AWS Organizations](orgs_delegate_policies.md)
+ [Enabling a policy type](enable-policy-type.md)
+ [Disabling a policy type](disable-policy-type.md)
+ [Creating policies](orgs_policies_create.md)
+ [Updating policies](orgs_policies_update.md)
+ [Editing tags attached to policies](orgs_policies_edit.md)
+ [Attaching policies](orgs_policies_attach.md)
+ [Detaching policies](orgs_policies_detach.md)
+ [Getting policy details](orgs_manage_policies_info-operations.md)
+ [Deleting policies](orgs_policies_delete.md)

## Policy types
<a name="orgs-policy-types"></a>

Organizations offers policy types in the following two broad categories:

### Authorization policies
<a name="orgs-policy-types-list-authorization"></a>

Authorization policies help you to centrally manage the security of AWS accounts across an organization.
+ **[Service control policies (SCPs)](orgs_manage_policies_scps.md)** offer central control over the maximum available permissions for IAM users and IAM roles in an organization.
+ **[Resource control policies (RCPs)](orgs_manage_policies_rcps.md)** offer central control over the maximum available permissions for resources in an organization.

### Management policies
<a name="orgs-policy-types-list-management"></a>

Management policies help you centrally configure and manage AWS services and their features across an organization.
+ **[Declarative policies](orgs_manage_policies_declarative.md)** allow you to centrally declare and enforce desired configurations for a given AWS service at scale across an organization. Once attached, the configuration is always maintained when the service adds new features or APIs.
+ **[Backup policies](orgs_manage_policies_backup.md)** allow you to centrally manage and apply backup plans to the AWS resources across an organization's accounts.
+ **[Tag policies](orgs_manage_policies_tag-policies.md)** allow you to standardize the tags attached to the AWS resources in an organization's accounts.
+ **[Chat applications policies](orgs_manage_policies_chatbot.md)** allow you to control access to an organization's accounts from chat applications such as Slack and Microsoft Teams.
+ **[AI services opt-out policies](orgs_manage_policies_ai-opt-out.md)** allow you to control data collection for AWS AI services for all the accounts in an organization.
+ **[Security Hub policies](orgs_manage_policies_security_hub.md)** allow you to address security coverage gaps that align with your organization's security requirements and centrally applying them across an organization.
+ **[Amazon Inspector policies](orgs_manage_policies_inspector.md)** allow you to centrally enable and manage Amazon Inspector across accounts in your AWS organization.
+ **[Amazon Bedrock policies](orgs_manage_policies_bedrock.md)** allow you to enforce safeguards configured in Amazon Bedrock Guardrails automatically across any element in your organization structure for all model inference calls to Amazon Bedrock.
+ **[Upgrade rollout policies](orgs_manage_policies_upgrade_rollout.md)** allow you to centrally manage and stagger automatic upgrades across multiple AWS resources and accounts in your organization. 
+ **[Amazon S3 policies](orgs_manage_policies_s3.md)** allow you to centrally manage configurations for Amazon S3 resources at scale across the accounts in an organization. 

The following table summarizes some of the characteristics of each policy type. For additional characteristics about these policy types, see [Quotas and service limits for AWS Organizations](orgs_reference_limits.md).


| Policy type | Policy category | Affects management account | Maximum number you can attach to a root, OU, or account | Maximum size | Supports viewing effective policy for OU or account | 
| --- | --- | --- | --- | --- | --- | 
| SCP | Authorization | ![\[No\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/icon-no.png) No | 5 | 5120 characters | ![\[No\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/icon-no.png) No | 
| RCP | Authorization | ![\[No\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/icon-no.png) No | 5 | 5120 characters | ![\[No\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/icon-no.png) No | 
| Declarative policy | Management | ![\[Yes\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/icon-yes.png) Yes | 10 | 10,000 characters | ![\[Yes\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/icon-yes.png) Yes | 
| Backup policy | Management | ![\[Yes\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/icon-yes.png) Yes | 10 | 10,000 characters | ![\[Yes\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/icon-yes.png) Yes | 
| Tag policy | Management | ![\[Yes\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/icon-yes.png) Yes | 10 | 10,000 characters | ![\[Yes\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/icon-yes.png) Yes | 
| Chat applications policy | Management | ![\[Yes\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/icon-yes.png) Yes | 5 | 10,000 characters | ![\[Yes\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/icon-yes.png) Yes | 
| AI services opt-out policy | Management | ![\[Yes\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/icon-yes.png) Yes | 5 | 2500 characters | ![\[Yes\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/icon-yes.png) Yes | 
| Security Hub policy | Management | ![\[Yes\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/icon-yes.png) Yes | 10 | 10,000 characters | ![\[Yes\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/icon-yes.png) Yes | 
| Amazon Inspector policy | Management | ![\[Yes\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/icon-yes.png) Yes | 10 | 10,000 characters | ![\[Yes\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/icon-yes.png) Yes | 
| Amazon Bedrock policy | Management | ![\[Yes\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/icon-yes.png) Yes | 10 | 10,000 characters | ![\[Yes\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/icon-yes.png) Yes | 
| Upgrade rollout policy | Management | ![\[Yes\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/icon-yes.png) Yes | 10 | 10,000 characters | ![\[Yes\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/icon-yes.png) Yes | 
| S3 policy | Management | ![\[Yes\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/icon-yes.png) Yes | 10 | 10,000 characters | ![\[Yes\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/icon-yes.png) Yes | 

# Authorization policies in AWS Organizations
<a name="orgs_manage_policies_authorization_policies"></a>

Authorization policies in AWS Organizations enable you to centrally configure and manage access for principals and resources in your member accounts. How those policies affect the organizational units (OUs) and accounts that you apply them to depends on the type of authorization policy that you apply.

There are two different types of authorization policies in AWS Organizations: service control policies (SCPs) and resource control policies (RCPs).

**Topics**
+ [Differences between SCPs and RCPs](#understanding-scps-and-rcps)
+ [Using SCPs and RCPs](#when-to-use-scps-and-rcps)
+ [Service control policies](orgs_manage_policies_scps.md)
+ [Resource control policies](orgs_manage_policies_rcps.md)

## Differences between SCPs and RCPs
<a name="understanding-scps-and-rcps"></a>

SCPs are principal-centric controls. SCPs create a permissions guardrail, or set limits, on the maximum permissions available to principals in your member accounts. You can use an SCP when you want to centrally enforce consistent access controls on principals in your organization. This can include specifying which services your IAM users and IAM roles can access, which resources they can access, or the conditions under which they can make requests (for example, from specific regions or networks).

RCPs are resource-centric controls. RCPs create a permissions guardrail, or set limits, on the maximum permissions available for resources in your member accounts. You can use an RCP when you want to centrally enforce consistent access controls across resources in your organization. This can restrict access to your resources so that they can only be accessed by identities that belong to your organization, or specifying the conditions under which identities external to your organization can access your resources. 

Some controls can be applied in a similar way through SCPs and RCPs. For example, you might want to [prevent your users from uploading unencrypted objects to S3](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps_examples_s3.html#example-s3-1) which can be written as an SCP to enforce a control on the actions that your principals can take on your S3 buckets. This control can also be written as an RCP to require encryption whenever any principal uploads objects to your S3 bucket. The second option might be preferred if your bucket allows principals outside of your organization, such as third-party vendors, to upload objects to your S3 bucket. However, some controls can only be implemented in an RCP, and some controls can only be implemented in an SCP. For more information, see [General use cases for SCPs and RCPs](#scps-rcps-general-use-cases).

## Using SCPs and RCPs
<a name="when-to-use-scps-and-rcps"></a>

SCPs and RCPs are independent controls. You can choose to enable only SCPs or RCPs, or use both policy types together. By using both SCPs and RCPs, you can create a [data perimeter](https://aws.amazon.com/identity/data-perimeters-on-aws/) around your identities and your resources. 

SCPs provide an ability to control which resources your identities can access. For example, you may want to allow your identities to access resources in your AWS organization. However, you may want to prevent your identities from accessing resources outside of your organization. You can enforce this control using SCPs.

RCPs provide an ability to control which identities can access your resources. For example, you may want to allow identities in your organization to be able to access resources in your organization. However, you may want to prevent identities external to your organization from accessing your resources. You can enforce this control using RCPs. RCPs provide an ability to impact the effective permissions for principals external to your organization that are accessing your resources. SCPs can only impact the effective permissions for principals within your AWS organization. 

### General use cases for SCPs and RCPs
<a name="scps-rcps-general-use-cases"></a>

The following table details general use cases for using an SCP and RCPs


****  

|  | **Impacts** | 
| --- |--- |
| **Use case** | **Policy type** | **Your identities** | **External identities** | **Your Resources** | **External resources (target of the request)** | 
| --- |--- |--- |--- |--- |--- |
| Restrict which services or actions your identities can use | SCP | X |  | X | X | 
| Restrict which resources your identities can access | SCP | X |  | X | X | 
| Enforce requirements on how your identities can access resources | SCP | X |  | X | X | 
| Restrict which identities can access your resources | RCP | X | X | X |  | 
| Protect sensitive resources in your organization | RCP | X | X | X |  | 
| Enforce requirements on how your resources can be accessed | RCP | X | X | X |  | 

# Service control policies (SCPs)
<a name="orgs_manage_policies_scps"></a>

Service control policies (SCPs) are a type of organization policy that you can use to manage permissions in your organization. SCPs offer central control over the maximum available permissions for the IAM users and IAM roles in your organization. SCPs help you to ensure your accounts stay within your organization’s access control guidelines. SCPs are available only in an organization that has [all features enabled](orgs_manage_org_support-all-features.md). SCPs aren't available if your organization has enabled only the consolidated billing features. For instructions on enabling SCPs, see [Enabling a policy type](enable-policy-type.md).

SCPs do not grant permissions to the IAM users and IAM roles in your organization. No permissions are granted by an SCP. An SCP defines a permission guardrail, or sets limits, on the actions that the IAM users and IAM roles in your organization can perform. To grant permissions, the administrator must attach policies to control access, such as identity-based policies that are attached to IAM users and IAM roles, and resource-based policies that are attached to the resources in your accounts. For more information, see [Identity-based policies and resource-based policies](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_identity-vs-resource.html) in the *IAM User Guide*.

The [effective permissions](#scp-effects-on-permissions) are the logical intersection between what is allowed by the SCP and [resource control policies (RCPs)](orgs_manage_policies_rcps.md) and what is allowed by the identity-based and resource-based policies.

**SCPs don't affect users or roles in the management account**  
SCPs don't affect users or roles in the management account. They affect only the member accounts in your organization. This also means that SCPs apply to member accounts that are designated as delegated administrators.

****Topics on this page****
+ [Testing effects of SCPs](#scp-warning-testing-effect)
+ [Maximum size of SCPs](#scp-size-limit)
+ [Attaching SCPs to different levels in the organization](#scp-about-inheritance)
+ [SCP effects on permissions](#scp-effects-on-permissions)
+ [Using access data to improve SCPs](#data-from-iam)
+ [Tasks and entities not restricted by SCPs](#not-restricted-by-scp)
+ [SCP evaluation](orgs_manage_policies_scps_evaluation.md)
+ [SCP syntax](orgs_manage_policies_scps_syntax.md)
+ [Service control policy examples](orgs_manage_policies_scps_examples.md)
+ [Troubleshooting service control policies (SCPs) with AWS Organizations](org_troubleshoot_policies.md)

## Testing effects of SCPs
<a name="scp-warning-testing-effect"></a>

AWS strongly recommends that you don't attach SCPs to the root of your organization without thoroughly testing the impact that the policy has on accounts. Instead, create an OU that you can move your accounts into one at a time, or at least in small numbers, to ensure that you don't inadvertently lock users out of key services. One way to determine whether a service is used by an account is to examine the [service last accessed data in IAM](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_access-advisor.html). Another way is to [use AWS CloudTrail to log service usage at the API level](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/how-cloudtrail-works.html).

**Note**  
You should not remove the **FullAWSAccess** policy unless you modify or replace it with a separate policy with allowed actions, otherwise all AWS actions from member accounts will fail.

## Maximum size of SCPs
<a name="scp-size-limit"></a>

All characters in your SCP count against its [maximum size](orgs_reference_limits.md#min-max-values). The examples in this guide show the SCPs formatted with extra white space to improve their readability. However, to save space if your policy size approaches the maximum size, you can delete any white space, such as space characters and line breaks that are outside quotation marks.

**Tip**  
Use the visual editor to build your SCP. It automatically removes extra white space.

## Attaching SCPs to different levels in the organization
<a name="scp-about-inheritance"></a>

For a detailed explanation of how SCPs work, see [SCP evaluation](orgs_manage_policies_scps_evaluation.md).

## SCP effects on permissions
<a name="scp-effects-on-permissions"></a>

SCPs are similar to AWS Identity and Access Management permission policies and use almost the same syntax. However, an SCP never grants permissions. Instead, SCPs are access controls that specify the maximum available permissions for the IAM users and IAM roles in your organization. For more information, see [Policy Evaluation Logic](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic.html) in the *IAM User Guide*. 
+ SCPs ***affect only IAM users and roles*** that are managed by accounts that are part of the organization. SCPs don't affect resource-based policies directly. They also don't affect users or roles from accounts outside the organization. For example, consider an Amazon S3 bucket that's owned by account A in an organization. The bucket policy (a resource-based policy) grants access to users from account B outside the organization. Account A has an SCP attached. That SCP doesn't apply to those outside users in account B. The SCP applies only to users that are managed by account A in the organization. 
+ An SCP restricts permissions for IAM users and roles in member accounts, including the member account's root user. Any account has only those permissions permitted by ***every*** parent above it. If a permission is blocked at any level above the account, either implicitly (by not being included in an `Allow` policy statement) or explicitly (by being included in a `Deny` policy statement), a user or role in the affected account can't use that permission, even if the account administrator attaches the `AdministratorAccess` IAM policy with \$1/\$1 permissions to the user.
+ SCPs affect only ***member*** accounts in the organization. They have no effect on users or roles in the management account. This also means that SCPs apply to member accounts that are designated as delegated administrators. For more information, see [Best practices for the management account](orgs_best-practices_mgmt-acct.md).
+ Users and roles must still be granted permissions with appropriate IAM permission policies. A user without any IAM permission policies has no access, even if the applicable SCPs allow all services and all actions.
+ If a user or role has an IAM permission policy that grants access to an action that is also allowed by the applicable SCPs, the user or role can perform that action.
+ If a user or role has an IAM permission policy that grants access to an action that is either not allowed or explicitly denied by the applicable SCPs, the user or role can't perform that action.
+ SCPs affect all users and roles in attached accounts, ***including the root user***. The only exceptions are those described in [Tasks and entities not restricted by SCPs](#not-restricted-by-scp).
+ SCPs ***do not ***affect any service-linked role. Service-linked roles enable other AWS services to integrate with AWS Organizations and can't be restricted by SCPs.
+ When you disable the SCP policy type in a root, all SCPs are automatically detached from all AWS Organizations entities in that root. AWS Organizations entities include organizational units, organizations, and accounts. If you reenable SCPs in a root, that root reverts to only the default `FullAWSAccess` policy automatically attached to all entities in the root. Any attachments of SCPs to AWS Organizations entities from before SCPs were disabled are lost and aren't automatically recoverable, although you can manually reattach them.
+ If both a permissions boundary (an advanced IAM feature) and an SCP are present, then the boundary, the SCP, and the identity-based policy must all allow the action.

## Using access data to improve SCPs
<a name="data-from-iam"></a>

When signed in with management account credentials, you can view [service last accessed data](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_access-advisor.html) for an AWS Organizations entity or policy in the **AWS Organizations** section of the IAM console. You can also use the AWS Command Line Interface (AWS CLI) or AWS API in IAM to retrieve service last accessed data. This data includes information about which allowed services that the IAM users and roles in an AWS Organizations account last attempted to access and when. You can use this information to identify unused permissions so that you can refine your SCPs to better adhere to the principle of [least privilege](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#grant-least-privilege).

For example, you might have a [deny list SCP](orgs_manage_policies_scps_evaluation.md#how_scps_deny) that prohibits access to three AWS services. All services that aren't listed in the SCP's `Deny` statement are allowed. The service last accessed data in IAM tells you which AWS services are allowed by the SCP but are never used. With that information, you can update the SCP to deny access to services that you don't need.

For more information, see the following topics in the *IAM User Guide*:
+ [Viewing Organizations Service Last Accessed Data for Organizations](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_access-advisor-view-data-orgs.html)
+ [ Using Data to Refine Permissions for an Organizational Unit](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_access-advisor-example-scenarios.html#access_policies_access-advisor-reduce-permissions-orgs) 

## Tasks and entities not restricted by SCPs
<a name="not-restricted-by-scp"></a>

You ***can't*** use SCPs to restrict the following tasks:
+ Any action performed by the management account
+ Any action performed using permissions that are attached to a service-linked role
+ Register for the Enterprise support plan as the root user
+ Provide trusted signer functionality for CloudFront private content
+ Configure reverse DNS for an Amazon Lightsail email server and Amazon EC2 instance as the root user
+ Tasks on some AWS-related services:
  + Alexa Top Sites
  + Alexa Web Information Service
  + Amazon Mechanical Turk
  + Amazon Product Marketing API

# SCP evaluation
<a name="orgs_manage_policies_scps_evaluation"></a>

**Note**  
The information in this section does ***not*** apply to management policy types, including backup policies, tag policies, chat applications policies, or AI services opt-out policies. For more information, see [Understanding management policy inheritance](orgs_manage_policies_inheritance_mgmt.md).

As you can attach multiple service control policies (SCPs) at different levels in AWS Organizations, understanding how SCPs are evaluated can help you write SCPs that yield the right outcome.

**Topics**
+ [How SCPs work with Allow](#how_scps_allow)
+ [How SCPs work with Deny](#how_scps_deny)
+ [Strategy for using SCPs](#strategy_using_scps)

## How SCPs work with Allow
<a name="how_scps_allow"></a>

For a permission to be **allowed** for a specific account, there must be an **explicit `Allow` statement** at every level from the root through each OU in the direct path to the account (including the target account itself). This is why when you enable SCPs, AWS Organizations attaches an AWS managed SCP policy named [FullAWSAccess](https://console.aws.amazon.com/organizations/v2/home/policies/service-control-policy/p-FullAWSAccess) which allows all services and actions. If this policy is removed and not replaced at any level of the organization, all OUs and accounts under that level would be blocked from taking any actions.

For example, let's walk through the scenario shown in figures 1 and 2. For a permission or a service to be allowed at Account B, a SCP that allows the permission or service should be attached to Root, the Production OU, and to Account B itself.

SCP evaluation follows a deny-by-default model, meaning that any permissions not explicitly allowed in the SCPs are denied. If an allow statement is not present in the SCPs at any of the levels such as Root, Production OU or Account B, the access is denied. 

![\[Example organization structure with an Allow statement attached at Root, Production OU and Account B\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/scp_allow_1.png)


*Figure 1: Example organization structure with an `Allow` statement attached at Root, Production OU and Account B*

![\[Example organization structure with an Allow statement missing at Production OU and its impact on Account B\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/scp_allow_2.png)


*Figure 2: Example organization structure with an `Allow` statement missing at Production OU and its impact on Account B*

## How SCPs work with Deny
<a name="how_scps_deny"></a>

For a permission to be **denied** for a specific account, **any SCP** from the root through each OU in the direct path to the account (including the target account itself) can deny that permission.

For example, let’s say there is an SCP attached to the Production OU that has an explicit `Deny` statement specified for a given service. There also happens to be another SCP attached to Root and to Account B that explicitly allows access to that same service, as shown in Figure 3. As a result, both Account A and Account B will be denied access to the service as a deny policy attached to any level in the organization is evaluated for all the OUs and member accounts underneath it.

![\[Example organization structure with a Deny statement attached at Production OU and its impact on Account B\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/scp_deny_1.png)


*Figure 3: Example organization structure with an `Deny` statement attached at Production OU and its impact on Account B*

## Strategy for using SCPs
<a name="strategy_using_scps"></a>

While writing SCPs you can make use of a combination of `Allow` and `Deny` statements to allow intended actions and services in your organization. `Deny` statements are a powerful way to implement restrictions that should be true for a broader part of your organization or OUs because when they are applied at the root or the OU-level they affect all the accounts under it.

**Tip**  
You can use [service last accessed data](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_access-advisor.html) in [IAM](https://docs.aws.amazon.com/IAM/latest/UserGuide/introduction.html) to update your SCPs to restrict access to only the AWS services that you need. For more information, see [Viewing Organizations Service Last Accessed Data for Organizations](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_access-advisor-view-data-orgs.html) in the *IAM User Guide.* 

AWS Organizations attaches an AWS managed SCP named [https://console.aws.amazon.com/organizations/v2/home/policies/service-control-policy/p-FullAWSAccess](https://console.aws.amazon.com/organizations/v2/home/policies/service-control-policy/p-FullAWSAccess) to every root, OU and account when it's created. This policy allows all services and actions. You can replace **FullAWSAccess** with a policy allowing only a set of services so that new AWS services are not allowed unless they are explicitly allowed by updating SCPs. For example, if your organization wants to only allow the use of a subset of services in your environment, you can use an `Allow` statement to only allow specific services. You can choose to either replace **FullAWSAccess** at the root level or at every level. If you attach a service-specific allowlist SCP at the root, it automatically applies to all OUs and accounts beneath it—meaning a single root-level policy determines the effective service allowlist across the entire organization as shown in scenario 7. Alternatively, you can remove and replace **FullAWSAccess** at each OU and account, allowing you to implement more granular service allowlists that differ between organizational units or individual accounts. 

 Note: Relying solely on allow statements and the implicit deny-by-default model can lead to unintended access, because broader or overlapping Allow statements can override more restrictive ones.

------
#### [ JSON ]

****  

```
{
"Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "ec2:*",
                "cloudwatch:*",
                "organizations:*"
            ],
            "Resource": "*"
        }
    ]
}
```

------

A policy combining the two statements might look like the following example, which prevents member accounts from leaving the organization and allows use of desired AWS services. The organization administrator can detach the **FullAWSAccess** policy and attach this one instead.

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "ec2:*",
                "cloudwatch:*",
                "organizations:*"
            ],
            "Resource": "*"
        },
        {
            "Effect": "Deny", 
            "Action":"organizations:LeaveOrganization",
            "Resource": "*" 
        }
    ]
}
```

------

To demonstrate how multiple service control policies (SCPs) can be applied in an AWS Organization, consider the following organizational structure and scenarios.

### Scenario 1: Impact of Deny policies
<a name="scp_scenario_1"></a>

This scenario demonstrates how deny policies at higher levels in the organization impact all accounts below. When the Sandbox OU has both "Full AWS access" and "Deny S3 access" policies, and Account B has a "Deny EC2 access" policy, the result is that Account B cannot access S3 (from the OU-level deny) and EC2 (from its account-level deny). Account A does not have S3 access (from the OU-level deny).

![\[Scenario 1: Impact of Deny policies\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/scp_scenario_1.png)


### Scenario 2: Allow policies must exist at every level
<a name="scp_scenario_2"></a>

This scenario shows how allow policies work in SCPs. For a service to be accessible, there must be an explicit allow at every level from the root down to the account. Here, as the Sandbox OU has an "Allow EC2 access" policy, which only explicitly allows EC2 service access, Account A and B will only have EC2 access.

![\[Scenario 2: Allow policies must exist at every level\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/scp_scenario_2.png)


### Scenario 3: Impact of missing an Allow statement at the root-level
<a name="scp_scenario_3"></a>

Missing an "Allow" statement at the root-level in an SCP is a critical misconfiguration that will effectively block all access to AWS services and actions for all member accounts in your organization.

![\[Scenario 3: Impact of missing an Allow statement at the root-level\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/scp_scenario_3.png)


### Scenario 4: Layered Deny statements and resulting permissions
<a name="scp_scenario_4"></a>

This scenario demonstrates a two-level deep OU structure. Both the Root and the Workloads OU have "Full AWS access", the Test OU has "Full AWS access" with "Deny EC2 access", and the Production OU has "Full AWS access". As a result, Account D has all service access except EC2 and Account E and F have all service access.

![\[Scenario 4: Layered Deny statements and resulting permissions\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/scp_scenario_4.png)


### Scenario 5: Allow policies at the OU-level to restrict service access
<a name="scp_scenario_5"></a>

This scenario shows how allow policies can be used to restrict access to specific services. The Test OU has an "Allow EC2 access" policy, which means only EC2 services are permitted for Account D. The Production OU maintains "Full AWS access", so Accounts E and F have access to all services. This demonstrates how more restrictive allow policies can be implemented at the OU-level while maintaining a broader allow at the root-level.

![\[Scenario 5: Allow policies at the OU-level to restrict service access\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/scp_scenario_5.png)


### Scenario 6: Root-level deny affects all accounts regardless of lower-level allows
<a name="scp_scenario_6"></a>

This scenario demonstrates that a deny policy at the root-level affects all accounts in the organization, regardless of allow policies at lower levels. The root has both "Full AWS access" and "Deny S3 access" policies. Even though the Test OU has an "Allow S3 access" policy, the root-level S3 deny takes precedence. Account D has no service access because the Test OU only allows S3 access, but S3 is denied at the root-level. Accounts E and F can access other services except for S3 because of the explicit deny at the root-level.

![\[Scenario 6: Root-level deny affects all accounts regardless of lower-level allows\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/scp_scenario_6.png)


### Scenario 7: Root level custom allow policies to restrict OU-level access
<a name="scp_scenario_7"></a>

This scenario demonstrates how SCPs with explicit service allow lists function when applied at root level within an AWS Organizations. At the organization root level, two custom "Service Allow" SCPs are attached that explicitly permits access to a limited set of AWS services — SCP\$11 allows IAM and Amazon EC2, SCP\$12 allows Amazon S3 and Amazon CloudWatch. At the organizational unit (OU) level, the default FullAWSAccess policy remains attached. However, due intersection behaviour, accounts A and B under these OUs can only access the services explicitly permitted by the root-level SCP. The more restrictive root policy takes precedence, effectively limiting access to only IAM, EC2, S3, and CloudWatch services, regardless of the broader permissions granted at lower organizational levels.

![\[Scenario 7: Root level custom allow policies to restrict OU-level access\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/scp_scenario_7.png)


# SCP syntax
<a name="orgs_manage_policies_scps_syntax"></a>

Service control policies (SCPs) use a similar syntax to that used by AWS Identity and Access Management (IAM) permission policies and [resource-based policies](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_resource-based) (like Amazon S3 bucket policies). For more information about IAM policies and their syntax, see [Overview of IAM Policies](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html) in the *IAM User Guide*.

An SCP is a plaintext file that is structured according to the rules of [JSON](http://json.org). It uses the elements that are described in this topic.

**Note**  
All characters in your SCP count against its [maximum size](orgs_reference_limits.md#min-max-values). The examples in this guide show the SCPs formatted with extra white space to improve their readability. However, to save space if your policy size approaches the maximum size, you can delete any white space, such as space characters and line breaks that are outside quotation marks.

For general information about SCPs, see [Service control policies (SCPs)](orgs_manage_policies_scps.md).

## Elements summary
<a name="scp-elements-table"></a>

The following table summarizes the policy elements that you can use in SCPs. Some policy elements are available only in SCPs that deny actions. The **Supported effects** column lists the effect type that you can use with each policy element in SCPs.


| Element | Purpose | Supported effects | 
| --- | --- | --- | 
|  [Action](#scp-syntax-action)  |  Specifies AWS service and actions that the SCP allows or denies.  |  `Allow`, `Deny`  | 
| [Effect](#scp-syntax-effect) | Defines whether the SCP statement [allows](orgs_manage_policies_scps_evaluation.md#how_scps_allow) or [denies](orgs_manage_policies_scps_evaluation.md#how_scps_deny) access to the IAM users and roles in an account. |  `Allow`, `Deny`  | 
| [Statement](#scp-syntax-statement) | Serves as the container for policy elements. You can have multiple statements in SCPs. |  `Allow`, `Deny`  | 
| [Statement ID (Sid)](#scp-syntax-sid) | (Optional) Provides a friendly name for the statement. |  `Allow`, `Deny`  | 
| [Version](#scp-syntax-version) | Specifies the language syntax rules to use for processing the policy. |  `Allow`, `Deny`  | 
| [Condition](#scp-syntax-condition) | Specifies conditions for when the statement is in effect. |  `Allow,``Deny`  | 
|  [NotAction](#scp-syntax-action)  |  Specifies AWS service and actions that are exempt from the SCP. Used instead of the `Action` element.  |  `Allow,``Deny`  | 
| [Resource](#scp-syntax-resource) | Specifies the AWS resources that the SCP applies to. |  `Allow,``Deny`  | 
| [NotResource](#scp-syntax-resource) | Specifies AWS resources that are exempt from the SCP. Used instead of the Resource element. |  `Allow`, `Deny`  | 

The following sections provide more information and examples of how policy elements are used in SCPs.

**Topics**
+ [Elements summary](#scp-elements-table)
+ [`Action` and `NotAction` elements](#scp-syntax-action)
+ [`Condition` element](#scp-syntax-condition)
+ [`Effect` element](#scp-syntax-effect)
+ [`Resource`and `NotResource` element](#scp-syntax-resource)
+ [`Statement` element](#scp-syntax-statement)
+ [Statement ID (`Sid`) element](#scp-syntax-sid)
+ [`Version` element](#scp-syntax-version)
+ [Unsupported elements](#scp-syntax-unsupported)

## `Action` and `NotAction` elements
<a name="scp-syntax-action"></a>

The value for the `Action` or `NotAction` element is a list (a JSON array) of strings that identify AWS services and actions that are allowed or denied by the statement.

Each string consists of the abbreviation for the service (such as "s3", "ec2", "iam", or "organizations"), in all lowercase, followed by a colon and then an action from that service. The actions and notactions are case-insensitive. Generally, they are all entered with each word starting with an uppercase letter and the rest lowercase. For example: `"s3:ListAllMyBuckets"`.

You also can use wildcard characters such as asterisk (\$1) or question mark (?) in an SCP:
+ Use an asterisk (\$1) as a wildcard to match multiple actions that share part of a name. The value `"s3:*"` means all actions in the Amazon S3 service. The value `"ec2:Describe*"` matches only the EC2 actions that begin with "Describe".
+ Use the question mark (?) wildcard to match a single character. 

For a list of all the services and the actions that they support in both AWS Organizations SCPs and IAM permission policies, see [Actions, Resources, and Condition Keys for AWS Services](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_actionsconditions.html) in the *IAM User Guide*.

For more information, see [IAM JSON Policy Elements: Action](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_action.html) and [IAM JSON Policy Elements: NotAction](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_notaction.html) in the *IAM User Guide*.

### Example of `Action` element
<a name="scp-syntax-action-example"></a>

The following example shows an SCP with a statement that permits account administrators to delegate describe, start, stop, and terminate permissions for EC2 instances in the account. This is an example of an [allow list](orgs_manage_policies_scps_evaluation.md#how_scps_allow), and is useful when the default `Allow *` policies are ***not*** attached so that, by default, permissions are implicitly denied. If the default `Allow *` policy is still attached to the root, OU, or account to which the following policy is attached, the policy has no effect.

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": {
        "Effect": "Allow",
        "Action": [
          "ec2:DescribeInstances", "ec2:DescribeImages", "ec2:DescribeKeyPairs",
          "ec2:DescribeSecurityGroups", "ec2:DescribeAvailabilityZones", "ec2:RunInstances",
          "ec2:TerminateInstances", "ec2:StopInstances", "ec2:StartInstances"
        ],
        "Resource": "*"
    }
}
```

------

The following example shows how you can [deny access](orgs_manage_policies_scps_evaluation.md#how_scps_deny) to services that you don't want used in attached accounts. It assumes that the default `"Allow *"` SCPs are still attached to all OUs and the root. This example policy prevents the account administrators in attached accounts from delegating any permissions for the IAM, Amazon EC2, and Amazon RDS services. Any action from other services can be delegated as long as there isn't another attached policy that denies them.

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": {
        "Effect": "Deny",
        "Action": [ "iam:*", "ec2:*", "rds:*" ],
        "Resource": "*"
    }
}
```

------

### Example of `NotAction` element
<a name="scp-syntax-notaction-example"></a>

The following example shows how you can use a `NotAction` element to exclude AWS services from the effect of the policy.

------
#### [ JSON ]

****  

```
{
  "Version":"2012-10-17",		 	 	 
  "Statement": [
    {
      "Sid": "LimitActionsInRegion",
      "Effect": "Deny",
      "NotAction": "iam:*",
      "Resource": "*",
      "Condition": {
        "StringNotEquals": {
          "aws:RequestedRegion": "us-west-1"
         }
       }
     }
   ]
}
```

------

With this statement, affected accounts are limited to taking actions in the specified AWS Region, except when using IAM actions.

## `Condition` element
<a name="scp-syntax-condition"></a>

You can specify a `Condition` element in allow and deny statements in an SCP.

The following example shows how to use a condition element with an allow statement in an SCP to permit specific principals to access AWS services.

```
{
   "Version":"2012-10-17",		 	 	 
   "Statement":[
      {
         "Sid":"AllowServicesForSpecificPrincipal",
         "Effect":"Allow",
         "Action":[
            "ec2:*",
            "s3:*",
            "rds:*",
            "lambda:*",
            "cloudformation:*",
            "iam:*",
            "cloudwatch:*"
         ],
         "Resource":"*",
         "Condition":{
            "StringEquals":{
               "aws:PrincipalArn":[
                  "arn:aws:iam::123456789012:role/specific-role"
               ]
            }
         }
      }
   ]
}
```

The following example shows how to use a condition element with a deny statement in an SCP to restrict access to any operations outside the `eu-central-1` and `eu-west-1` Regions, except for actions in the specified services. 

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "DenyAllOutsideEU",
            "Effect": "Deny",
            "NotAction": [
                "cloudfront:*",
                "iam:*",
                "route53:*",
                "support:*"
            ],
            "Resource": "*",
            "Condition": {
                "StringNotEquals": {
                    "aws:RequestedRegion": [
                        "eu-central-1",
                        "eu-west-1"
                    ]
                }
            }
        }
    ]
}
```

------

For more information, see [IAM JSON Policy Elements: Condition](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html) in the *IAM User Guide*.

## `Effect` element
<a name="scp-syntax-effect"></a>

Each statement must contain one `Effect` element. The value can be either `Allow` or `Deny`. It affects any actions listed in the same statement.

For more information, see [IAM JSON Policy Elements: Effect](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_effect.html) in the *IAM User Guide*.

### `"Effect": "Allow"`
<a name="scp-syntax-effect-allow"></a>

The following example shows an SCP with a statement that contains an `Effect` element with a value of `Allow` that permits account users to perform actions for the Amazon S3 service. This example is useful in an organization that uses the [allow list strategy](orgs_manage_policies_scps_evaluation.md#how_scps_allow) (where the default `FullAWSAccess` policies are all detached so that permissions are implicitly denied by default). The result is that the statement [allows](orgs_manage_policies_scps_evaluation.md#how_scps_allow) the Amazon S3 permissions for any attached accounts:

```
{
    "Statement": {
        "Effect": "Allow",
        "Action": "s3:*",
        "Resource": "*"
    }
}
```

Even though this statement uses the same `Allow` value keyword as an IAM permission policy, in an SCP it doesn't actually grant a user permission to do anything. Instead, SCPs act as filters that specify the maximum permissions for the accounts in an organization, organizational unit (OU), or account. In the preceding example, even if a user in the account had the `AdministratorAccess` managed policy attached, this SCP limits ***all*** users in affected accounts to only Amazon S3 actions.

### `"Effect": "Deny"`
<a name="scp-syntax-effect-deny"></a>

In a statement where the `Effect` element has a value of `Deny`, you can also restrict access to specific resources or define conditions for when SCPs are in effect. 

The following shows an example of how to use a condition key in a deny statement.

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": {
        "Effect": "Deny",
        "Action": "ec2:RunInstances",
        "Resource": "arn:aws:ec2:*:*:instance/*",
        "Condition": {
            "StringNotEquals": {
                "ec2:InstanceType": "t2.micro"
            }
        }
    }
}
```

------

This statement in an SCP sets a guardrail to prevent affected accounts (where the SCP is attached to the account itself or to the organization root or OU that contains the account), from launching Amazon EC2 instances if the Amazon EC2 instance isn't set to `t2.micro`. Even if an IAM policy that allows this action is attached to the account, the guardrail created by the SCP prevents it.

## `Resource`and `NotResource` element
<a name="scp-syntax-resource"></a>

In statements where the `Effect` element has a value of `Allow`, you can specify only "\$1" in the `Resource` element of an SCP. You can't specify individual resource Amazon Resource Names (ARNs). 

You can use wildcard characters such as asterisk (\$1) or question mark (?) in the resource element:
+ Use an asterisk (\$1) as a wildcard to match multiple actions that share part of a name. 
+ Use the question mark (?) wildcard to match a single character. 

In statements where the `Effect` element has a value of `Deny`, you *can* specify individual ARNs, as shown in the following example.

------
#### [ JSON ]

****  

```
{    
  "Version":"2012-10-17",		 	 	 
  "Statement": [
    {
      "Sid": "DenyAccessToAdminRole",
      "Effect": "Deny",
      "Action": [
        "iam:AttachRolePolicy",
        "iam:DeleteRole",
        "iam:DeleteRolePermissionsBoundary",
        "iam:DeleteRolePolicy",
        "iam:DetachRolePolicy",
        "iam:PutRolePermissionsBoundary",
        "iam:PutRolePolicy",
        "iam:UpdateAssumeRolePolicy",
        "iam:UpdateRole",
        "iam:UpdateRoleDescription"
      ],
      "Resource": [
        "arn:aws:iam::*:role/role-to-deny"
      ]
    }
  ]
}
```

------

This SCP restricts IAM users and roles in affected accounts from making changes to a common administrative IAM role created in all accounts in your organization.

The following example shows how to use a `NotResource` element to exclude specific Amazon Bedrock models from the effect of the policy.

```
{
   "Version":"2012-10-17",		 	 	 
   "Statement":[
      {
         "Sid":"Statement1",
         "Effect":"Deny",
         "Action":[
            "bedrock:InvokeModel",
            "bedrock:InvokeModelWithResponseStream"
         ],
         "NotResource":[
            "arn:aws:bedrock:*::foundation-model/model-to-permit"
         ]
      }
   ]
}
```

For more information, see [IAM JSON Policy Elements: Resource](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_resource.html) in the *IAM User Guide*.

## `Statement` element
<a name="scp-syntax-statement"></a>

An SCP consists of one or more `Statement` elements. You can have only one `Statement` keyword in a policy, but the value can be a JSON array of statements (surrounded by [ ] characters).

The following example shows a single statement that consists of single `Effect`, `Action`, and `Resource` elements.

```
    "Statement": {
        "Effect": "Allow",
        "Action": "*",
        "Resource": "*"
    }
```

The following example includes two statements as an array list inside one `Statement` element. The first statement allows all actions, while the second denies any EC2 actions. The result is that an administrator in the account can delegate any permission *except* those from Amazon Elastic Compute Cloud (Amazon EC2).

```
    "Statement": [
        {
            "Effect": "Allow",
            "Action": "*",
            "Resource": "*"
        },
        {
            "Effect": "Deny",
            "Action": "ec2:*",
            "Resource": "*"
        }
    ]
```

For more information, see [IAM JSON Policy Elements: Statement](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_statement.html) in the *IAM User Guide*.

## Statement ID (`Sid`) element
<a name="scp-syntax-sid"></a>

The `Sid` is an optional identifier that you provide for the policy statement. You can assign a `Sid` value to each statement in a statement array. The following example SCP shows a sample `Sid` statement. 

```
{
    "Statement": {
        "Sid": "AllowsAllActions",
        "Effect": "Allow",
        "Action": "*",
        "Resource": "*"
    }
}
```

For more information, see [IAM JSON Policy Elements: Id](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_id.html) in the *IAM User Guide*.

## `Version` element
<a name="scp-syntax-version"></a>

Every SCP must include a `Version` element with the value `"2012-10-17"`. This is the same version value as the most recent version of IAM permission policies.

For more information, see [IAM JSON Policy Elements: Version](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_version.html) in the *IAM User Guide*.

## Unsupported elements
<a name="scp-syntax-unsupported"></a>

The following elements aren't supported in SCPs:
+ `NotPrincipal`
+ `Principal`

# Service control policy examples
<a name="orgs_manage_policies_scps_examples"></a>

The example [service control policies (SCPs)](orgs_manage_policies_scps.md) displayed in this topic are for information purposes only.

**Before using these examples**  
Before you use these example SCPs in your organization, consider the following:  
[Service control policies (SCPs)](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps.html) are meant to be used as coarse-grained guardrails, and they don't directly grant access. The administrator must still attach [identity-based or resource-based policies](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_identity-vs-resource.html) to IAM principals or resources in your accounts to actually grant permissions. The effective permissions are the logical intersection between the Service control policy/Resource control policy and an identity policy or the Service control policy/Resource control policy and a resource policy. You can get more details about SCP effects on permissions [here](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps.html#scp-effects-on-permissions). 
A [Service control policy (SCP)](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps.html), when attached to an organization, organization unit or an account offers a central control over the maximum available permissions for all accounts in your organization, organization unit or an account. As an SCP can be applied at multiple levels in an organization, understanding how [SCPs are evaluated](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps_evaluation.html) can help you write SCPs that yield the right outcome.
The service control policies in this repository are shown as examples. You should not attach SCPs without thoroughly testing the impact that the policy has on accounts. Once you have a policy ready that you would like to implement, we recommend testing in a separate organization or OU that can be represent your production environment. Once tested, you should deploy changes to more specific OUs and then slowly deploy the changes to broader and broader OUs over time. 
The SCP examples in this repository use a [deny list strategy](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps_evaluation.html#strategy_using_scps), which means that you also need a [FullAWSAccess](https://console.aws.amazon.com/organizations/?#/policies/p-FullAWSAccess) policy or other policy that allows access attached to your organization entities to allow actions. You still also need to grant appropriate permissions to your principals by using identity-based or resource-based policies.

**Tip**  
You can use [service last accessed data](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_access-advisor.html) in [IAM](https://docs.aws.amazon.com/IAM/latest/UserGuide/introduction.html) to update your SCPs to restrict access to only the AWS services that you need. For more information, see [Viewing Organizations Service Last Accessed Data for Organizations](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_access-advisor-view-data-orgs.html) in the *IAM User Guide.* 

## GitHub repository
<a name="scp-github-repositories"></a>
+ [Service control policy examples](https://github.com/aws-samples/service-control-policy-examples) - This GitHub repository contains example policies to get started or mature your usage of AWS SCPs

# Troubleshooting service control policies (SCPs) with AWS Organizations
<a name="org_troubleshoot_policies"></a>

Use the information here to help you diagnose and fix common errors found in service control policies (SCPs).

Service control policies (SCPs) in AWS Organizations are similar to IAM policies and share a common syntax. This syntax begins with the rules of [JavaScript Object Notation](http://www.json.org) (JSON). JSON describes an *object* with name and value pairs that make up the object. The [IAM policy grammar](https://docs.aws.amazon.com/IAM/latest/UserGuide/policies-grammar.html) builds on that by defining what names and values have meaning for, and are understood by, the AWS services that use policies to grant permissions.

AWS Organizations uses a subset of the IAM syntax and grammar. For details, see [SCP syntax](orgs_manage_policies_scps_syntax.md).

**Topics**
+ [More than one policy object](#morethanonepolicyblock)
+ [More than one statement element](#morethanonestatement)
+ [Policy document exceeds maximum size](#scptoolong)

## More than one policy object
<a name="morethanonepolicyblock"></a>

An SCP must consist of one and only one JSON object. You denote an object by placing \$1 \$1 braces around it. Although you can nest other objects within a JSON object by embedding additional \$1 \$1 braces within the outer pair, a policy can contain only one outermost pair of \$1 \$1 braces. The following example is ***incorrect*** because it contains two objects at the top level (called out in *red*):

------
#### [ JSON ]

****  

```
{
  "Version":"2012-10-17",		 	 	 
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "ec2:Describe*",
      "Resource": "*"
    },
    {
      "Effect": "Deny",
      "Action": "s3:*",
      "Resource": "*"
    }
  ]
}
```

------

You can, however, meet the intention of the preceding example with the use of correct policy grammar. Instead of including two complete policy objects, each with its own `Statement` element, you can combine the two blocks into a single `Statement` element. The `Statement` element has an array of two objects as its value, as shown in the following example: 

```
{
  "Version": "2012-10-17",		 	 	 
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "ec2:Describe*",
      "Resource": "*"
    },
    {
      "Effect": "Deny",
      "Action": "s3:*",
      "Resource": "*"
    }
  ]
}
```

This example cannot be further compressed into a `Statement` with one element because the two elements have different effects. Generally, you can combine statements only when the `Effect` and `Resource` elements in each statement are identical.

## More than one statement element
<a name="morethanonestatement"></a>

This error might at first appear to be a variation on the error in the preceding section. However, syntactically it's a different type of error. In the following example, there is only one policy object as denoted by a single pair of \$1 \$1 braces at the top level. However, that object contains two `Statement` elements within it.

An SCP must contain only one `Statement` element, consisting of the name (`Statement`) appearing to the left of a colon, followed by its value on the right. The value of a `Statement` element must be an object, denoted by \$1 \$1 braces, containing one `Effect` element, one `Action` element, and one `Resource` element. The following example is ***incorrect*** because it contains two `Statement` elements in the policy object:

------
#### [ JSON ]

****  

```
{
  "Version":"2012-10-17",		 	 	 
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "ec2:Describe*",
      "Resource": "*"
    },
    {
      "Effect": "Deny",
      "Action": "s3:*",
      "Resource": "*"
    }
  ]
}
```

------

Because a value object can be an array of multiple value objects, you can solve this problem by combining the two `Statement` elements into one element with an object array, as shown in the following example:

------
#### [ JSON ]

****  

```
{
  "Version":"2012-10-17",		 	 	 
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "ec2:Describe*",
      "Resource":"*"
    },
    {
      "Effect": "Deny",
      "Action": "s3:*",
      "Resource": "*"
    }
 ]
}
```

------

The value of the `Statement` element is an object array. The array in the example consists of two objects, each of which is a correct value for a `Statement` element. Each object in the array is separated by commas. 

## Policy document exceeds maximum size
<a name="scptoolong"></a>

The maximum size of an SCP document is 5,120 characters. This maximum size includes all characters, including white space. To reduce the size of your SCP, you can remove all white space characters (such as spaces and line breaks) that are outside quotation marks. 

**Note**  
If you save the policy by using the AWS Management Console, extra white space between JSON elements and outside of quotation marks is removed and not counted. If you save the policy using an SDK operation or the AWS CLI, then the policy is saved exactly as you provided and no automatic removal of characters occurs.

# Resource control policies (RCPs)
<a name="orgs_manage_policies_rcps"></a>

**Note**  
**Service control policies (SCPs) and resource control policies (RCPs)**  
Use an SCP when you need to limit permissions of IAM principals within your organization's member accounts.  
Use an RCP when you need to restrict IAM principals that are external to your organization accounts making requests to access resources within your organization’s member accounts.  
For more information, see [Understanding SCPs and RCPs](orgs_manage_policies_authorization_policies.md).

Resource control policies (RCPs) are a type of organization policy that you can use to manage permissions in your organization. RCPs offer central control over the maximum available permissions for resources in your organization. RCPs help you to ensure resources in your accounts stay within your organization’s access control guidelines. RCPs are available only in an organization that has [all features enabled](orgs_manage_org_support-all-features.md). RCPs aren't available if your organization has enabled only the consolidated billing features. For instructions on enabling RCPs, see [Enabling a policy type](enable-policy-type.md).

RCPs alone are not sufficient in granting permissions to the resources in your organization. No permissions are granted by an RCP. An RCP defines a permissions guardrail, or sets limits, on the actions that identities can take on resources in your organizations. The administrator must still attach identity-based policies to IAM users or roles, or resource-based policies to resources in your accounts to actually grant permissions. For more information, see [Identity-based policies and resource-based policies](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_identity-vs-resource.html) in the *IAM User Guide*.

The [effective permissions](#rcp-effects-on-permissions) are the logical intersection between what is allowed by the RCPs and [service control policies (SCPs)](orgs_manage_policies_scps.md) and what is allowed by the identity-based and resource-based policies.

**RCPs don't affect resources in the management account**  
RCPs don't affect resources in the management account. They only affect resources in the member accounts within your organization. This also means that RCPs apply to member accounts that are designated as delegated administrators.

****Topics on this page****
+ [List of AWS services that support RCPs](#rcp-supported-services)
+ [Testing effects of RCPs](#rcp-warning-testing-effect)
+ [Maximum size of RCPs](#rcp-size-limit)
+ [Attaching RCPs to different levels in the organization](#rcp-about-inheritance)
+ [RCP effects on permissions](#rcp-effects-on-permissions)
+ [Resources and entities not restricted by RCPs](#actions-not-restricted-by-rcps)
+ [RCP evaluation](orgs_manage_policies_rcps_evaluation.md)
+ [RCP syntax](orgs_manage_policies_rcps_syntax.md)
+ [Resource control policy examples](orgs_manage_policies_rcps_examples.md)

## List of AWS services that support RCPs
<a name="rcp-supported-services"></a>

RCPs apply to actions for the following AWS services:
+ [Amazon S3](https://docs.aws.amazon.com/s3)
+ [AWS Security Token Service](https://docs.aws.amazon.com/iam)
+ [AWS Key Management Service](https://docs.aws.amazon.com/kms)
+ [Amazon SQS](https://docs.aws.amazon.com/sqs)
+ [AWS Secrets Manager](https://docs.aws.amazon.com/secretsmanager)
+ [Amazon Cognito](https://docs.aws.amazon.com/cognito)
+ [Amazon CloudWatch Logs](https://docs.aws.amazon.com/cloudwatch)
+ [Amazon DynamoDB](https://docs.aws.amazon.com/dynamodb)
+ [Amazon Elastic Container Registry](https://docs.aws.amazon.com/ecr)
+ [Amazon OpenSearch Serverless](https://docs.aws.amazon.com/opensearch-service)

## Testing effects of RCPs
<a name="rcp-warning-testing-effect"></a>

AWS strongly recommends that you don't attach RCPs to the root of your organization without thoroughly testing the impact that the policy has on resources in your accounts. You can begin by attaching RCPs to individual test accounts, moving them up to OUs lower in the hierarchy, and then working your way up through the organization structure as needed. One way to determine impact is to review AWS CloudTrail logs for Access Denied errors.

## Maximum size of RCPs
<a name="rcp-size-limit"></a>

All characters in your RCP count against its [maximum size](orgs_reference_limits.md#min-max-values). The examples in this guide show the RCPs formatted with extra white space to improve their readability. However, to save space if your policy size approaches the maximum size, you can delete any white space, such as space characters and line breaks that are outside quotation marks.

**Tip**  
Use the visual editor to build your RCP. It automatically removes extra white space.

## Attaching RCPs to different levels in the organization
<a name="rcp-about-inheritance"></a>

You can attach RCPs directly to individual accounts, OUs, or the organization root. For a detailed explanation of how RCPs work, see [RCP evaluation](orgs_manage_policies_rcps_evaluation.md).

## RCP effects on permissions
<a name="rcp-effects-on-permissions"></a>

RCPs are a type of AWS Identity and Access Management (IAM) policy. They are most closely related to [resource-based policies](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_identity-vs-resource.html). However, an RCP never grants permissions. Instead, RCPs are access controls that specify the maximum available permissions for resources in your organization. For more information, see [Policy evaluation logic](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic.html) in the *IAM User Guide*.
+ RCPs apply to resources for a subset of AWS services. For more information, see [List of AWS services that support RCPs](#rcp-supported-services).
+ RCPs ***affect only resources*** that are managed by accounts that are part of the organization which has attached the RCPs. They don't affect resources from accounts outside the organization. For example, consider an Amazon S3 bucket that's owned by Account A in an organization. The bucket policy (a resource-based policy) grants access to users from Account B outside the organization. Account A has an RCP attached. That RCP applies to the S3 bucket in Account A even when accessed by users from Account B. However, that RCP does not apply to resources in Account B when accessed by users in Account A.
+ An RCP restricts permissions for resources in member accounts. Any resource in an account has only those permissions permitted by ***every*** parent above it. If a permission is blocked at any level above the account, a resource in the affected account does not have that permission, even if the resource owner attaches a resource-based policy that allows full access to any user.
+ RCPs apply to the resources that are authorized as part of an operation request. These resources can be found in the “Resource type” column of the Action table in the [Service Authorization Reference](https://docs.aws.amazon.com/service-authorization/latest/reference/reference_policies_actions-resources-contextkeys.html#actions_table). If a resource is specified in the "Resource type" column, then the RCPs of the calling principal account are applied. For example, `s3:GetObject` authorizes the object resource. Whenever a `GetObject` request is made, an applicable RCP will apply to determine whether the requesting principal can invoke the `GetObject` operation. An *applicable RCP* is an RCP that has been attached to an account, to an organizational unit (OU), or to the root of the organization that owns the resource being accessed.
+ RCPs affect only resources in ***member*** accounts in the organization. They have no effect on resources in the management account. This also means that RCPs apply to member accounts that are designated as delegated administrators. For more information, see [Best practices for the management account](orgs_best-practices_mgmt-acct.md).
+ When a principal makes a request to access a resource within an account that has an attached RCP (a resource with an applicable RCP), the RCP is included in the policy evaluation logic to determine whether the principal is allowed or denied access.
+ RCPs impact the effective permissions of principals trying to access resources in a member account with an applicable RCP, regardless of whether the principals belong to the same organizations or not. This includes root users. The exception is when principals are service-linked roles because RCPs do not apply to calls made by service-linked roles. Service-linked roles enable AWS services to perform necessary actions on your behalf and can't be restricted by RCPs. 
+ Users and roles must still be granted permissions with appropriate IAM permission policies, including identity-based and resource-based policies. A user or role without any IAM permission policies has no access, even if an applicable RCP allows all services, all actions, and all resources.

## Resources and entities not restricted by RCPs
<a name="actions-not-restricted-by-rcps"></a>

You ***can't*** use RCPs to restrict the following:
+ Any action on resources in the management account.
+ RCPs do not impact the effective permissions of any service-linked role. Service-linked roles are a unique type of IAM role that is linked directly to an AWS service and include all the permissions that the service requires to call other AWS services on your behalf. The permissions of service-linked roles can't be restricted by RCPs. RCPs also do not impact AWS services' ability to assume a service-linked role; that is, the service-linked role's trust policy is also not impacted by RCPs.
+ RCPs do not apply to [AWS managed keys for AWS Key Management Service](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-managed-cmk). AWS managed keys are created, managed, and used on your behalf by an AWS service. You cannot change or manage their permissions.
+ RCPs do not impact following permissions:  
****    
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_rcps.html)

# RCP evaluation
<a name="orgs_manage_policies_rcps_evaluation"></a>

**Note**  
The information in this section does ***not*** apply to management policy types, including backup policies, tag policies, chat applications policies, or AI services opt-out policies. For more information, see [Understanding management policy inheritance](orgs_manage_policies_inheritance_mgmt.md).

As you can attach multiple resource control policies (RCPs) at different levels in AWS Organizations, understanding how RCPs are evaluated can help you write RCPs that yield the right outcome.

## Strategy for using RCPs
<a name="how_rcps_deny"></a>

The `RCPFullAWSAccess` policy is an AWS managed policy. It is automatically attached to the organization root, every OU, and every account in your organization, when you enable resource control policies (RCPs). You cannot detach this policy. This default RCP allows all principals and actions access to pass through RCP evaluation, meaning until you start creating and attaching RCPs, all your existing IAM permissions continue to operate as they did. This AWS managed policy does not grant access.

You can make use of `Deny` statements to block access to resources in your organization. For a permission to be **denied** for a resource in a specific account, **any RCP** from the root through each OU in the direct path to the account (including the target account itself) can deny that permission.

`Deny` statements are a powerful way to implement restrictions that should be true for a broader part of your organization. For example, you can attach a policy to help prevent identities external to your organization from accessing your resources root level, and that will be effective for all accounts in the organization. AWS strongly recommends that you don't attach RCPs to the root of your organization without thoroughly testing the impact that the policy has on resources in your accounts. For more information, see [Testing effects of RCPs](orgs_manage_policies_rcps.md#rcp-warning-testing-effect).

In Figure 1, there is an RCP attached to the Production OU that has an explicit `Deny` statement specified for a given service. As a result, both Account A and Account B will be denied access to the service as a deny policy attached to any level in the organization is evaluated for all the OUs and member accounts underneath it.

![\[Example organization structure with a Deny statement attached at Production OU and its impact on Account A and Account B\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/rcp_deny_1.png)


*Figure 1: Example organization structure with an `Deny` statement attached at Production OU and its impact on Account A and Account B*

# RCP syntax
<a name="orgs_manage_policies_rcps_syntax"></a>

Resource control policies (RCPs) use a similar syntax to that used by [resource-based policies](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_resource-based). For more information about IAM policies and their syntax, see [Overview of IAM Policies](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html) in the *IAM User Guide*.

An RCP is structured according to the rules of [JSON](http://json.org). It uses the elements that are described in this topic.

**Note**  
All characters in your RCP count against its [maximum size](orgs_reference_limits.md#min-max-values). The examples in this guide show the RCPs formatted with extra white space to improve their readability. However, to save space if your policy size approaches the maximum size, you can delete any white space, such as space characters and line breaks that are outside quotation marks.

For general information about RCPs, see [Resource control policies (RCPs)](orgs_manage_policies_rcps.md).

## Elements summary
<a name="rcp-elements-table"></a>

The following table summarizes the policy elements that you can use in RCPs.

**Note**  
**The effect of `Allow` is only supported for the `RCPFullAWSAccess` policy**  
The effect of `Allow` is only supported for the `RCPFullAWSAccess` policy. This policy is automatically attached to the organization root, every OU, and every account in your organization, when you enable resource control policies (RCPs). You cannot detach this policy. This default RCP allows all principals and actions access to pass through RCP evaluation, meaning until you start creating and attaching RCPs, all your existing IAM permissions continue to operate as they did. This does not grant access.


| Element | Purpose | 
| --- | --- | 
| [Version](#rcp-syntax-version) | Specifies the language syntax rules to use for processing the policy. | 
| [Statement](#rcp-syntax-statement) | Serves as the container for policy elements. You can have multiple statements in RCPs. | 
| [Statement ID (Sid)](#rcp-syntax-sid) | (Optional) Provides a friendly name for the statement. | 
| [Effect](#rcp-syntax-effect) | Defines whether the RCP statement denies access to the resources in an account. | 
| [Principal](#rcp-syntax-principal) | Specifies the principal that is allowed or denied access to resources in an account. | 
|  [Action](#rcp-syntax-action)  |  Specifies AWS service and actions that the RCP allows or denies.  | 
| [Resource](#rcp-syntax-resource) | Specifies the AWS resources that the RCP applies to. | 
| [NotResource](#rcp-syntax-resource) |  Specifies the AWS resources that are exempt from the RCP. Used instead of the `Resource` element.  | 
| [Condition](#rcp-syntax-condition) | Specifies conditions for when the statement is in effect. | 

**Topics**
+ [Elements summary](#rcp-elements-table)
+ [`Version` element](#rcp-syntax-version)
+ [`Statement` element](#rcp-syntax-statement)
+ [Statement ID (`Sid`) element](#rcp-syntax-sid)
+ [`Effect` element](#rcp-syntax-effect)
+ [`Principal` element](#rcp-syntax-principal)
+ [`Action` element](#rcp-syntax-action)
+ [`Resource` and `NotResource` elements](#rcp-syntax-resource)
+ [`Condition` element](#rcp-syntax-condition)
+ [Unsupported elements](#rcp-syntax-unsupported)

## `Version` element
<a name="rcp-syntax-version"></a>

Every RCP must include a `Version` element with the value **"2012-10-17"**. This is the same version value as the most recent version of IAM permission policies.

For more information, see [IAM JSON Policy Elements: Version](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_version.html) in the *IAM User Guide*.

## `Statement` element
<a name="rcp-syntax-statement"></a>

An RCP consists of one or more `Statement` elements. You can have only one `Statement` keyword in a policy, but the value can be a JSON array of statements (surrounded by [ ] characters).

The following example shows a single statement that consists of single `Effect`, `Principal`, `Action`, and `Resource` elements.

```
 {
    "Statement": {
        "Effect": "Deny",
        "Principal": "*",
        "Action": "s3:PutBucketPublicAccessBlock",
        "Resource": "*"
    }
}
```

For more information, see [IAM JSON Policy Elements: Statement](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_statement.html) in the *IAM User Guide*.

## Statement ID (`Sid`) element
<a name="rcp-syntax-sid"></a>

The `Sid` is an optional identifier that you provide for the policy statement. You can assign a `Sid` value to each statement in a statement array. The following example RCP shows a sample `Sid` statement. 

```
{
    "Statement": {
        "Sid": "DenyBPAConfigurations",
        "Effect": "Deny",
        "Principal": "*",
        "Action": "s3:PutBucketPublicAccessBlock",
        "Resource": "*"
    }
}
```

For more information, see [IAM JSON Policy Elements: Sid](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_sid.html) in the *IAM User Guide*.

## `Effect` element
<a name="rcp-syntax-effect"></a>

Each statement must contain one `Effect` element. Using the value of `Deny` in the `Effect` element, you can restrict access to specific resources or define conditions for when RCPs are in effect. For RCPs that you create, the value must be `Deny`. For more information, see [RCP evaluation](orgs_manage_policies_rcps_evaluation.md) and [IAM JSON Policy Elements: Effect](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_effect.html) in the *IAM User Guide*.

## `Principal` element
<a name="rcp-syntax-principal"></a>

Each statement must contain the `Principal` element. You can only specify “`*`” in the `Principal` element of an RCP. Use the `Conditions` element to restrict specific principals.

For more information, see [IAM JSON Policy Elements: Principal](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_principal.html) in the *IAM User Guide*.

## `Action` element
<a name="rcp-syntax-action"></a>

Each statement must contain the `Action` element.

The value for the `Action` element is a string or list (a JSON array) of strings that identify AWS services and actions that are allowed or denied by the statement.

Each string consists of the abbreviation for the service (such as "s3", "sqs", or "sts"), in all lowercase, followed by a colon and then an action from that service. Generally, they are all entered with each word starting with an uppercase letter and the rest lowercase. For example: `"s3:ListAllMyBuckets"`.

You also can use wildcard characters such as asterisk (\$1) or question mark (?) in an RCP:
+ Use an asterisk (\$1) as a wildcard to match multiple actions that share part of a name. The value `"s3:*"` means all actions in the Amazon S3 service. The value `"sts:Get*"` matches only the AWS STS actions that begin with "Get".
+ Use the question mark (?) wildcard to match a single character. 

**Note**  
**Wildcards (\$1) and question marks (?) can be used anywhere in the action name**  
You cannot use "\$1" in the Action element of a customer managed RCP and have to specify the abbreviation for the service (such as "s3", "sqs", or "sts") you want to restrict access to.

For a list of the services that support RCPs, see [List of AWS services that support RCPs](orgs_manage_policies_rcps.md#rcp-supported-services). For a list of the actions an AWS service supports, see [Actions, Resources, and Condition Keys for AWS Services](https://docs.aws.amazon.com/service-authorization/latest/reference/reference_policies_actions-resources-contextkeys.html.html) in the *Service Authorization Reference*.

For more information, see [IAM JSON Policy Elements: Action](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_action.html) in the *IAM User Guide*.

## `Resource` and `NotResource` elements
<a name="rcp-syntax-resource"></a>

Each statement must contain the `Resource` or `NotResource` element.

You can use wildcard characters such as asterisk (\$1) or question mark (?) in the resource element:
+ Use an asterisk (\$1) as a wildcard to match multiple resources that share part of a name. 
+ Use the question mark (?) wildcard to match a single character.

For more information, see [IAM JSON Policy Elements: Resource](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_resource.html) and see [IAM JSON Policy Elements: NotResource](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_notresource.html) in the *IAM User Guide*.

## `Condition` element
<a name="rcp-syntax-condition"></a>

 You can specify a `Condition` element in deny statements in an RCP. 

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Deny",
            "Principal": "*",
            "Action": "s3:*",
            "Resource": "*",
            "Condition": {
                "BoolIfExists": {
                    "aws:SecureTransport": "false"
                }
            }
        }
    ]
}
```

------

This RCP denies access to Amazon S3 operations and resources unless the request occurs over secure transport (the request was sent over TLS). 

For more information, see [IAM JSON Policy Elements: Condition](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html) in the *IAM User Guide*.

## Unsupported elements
<a name="rcp-syntax-unsupported"></a>

The following elements are not supported in RCPs:
+ `NotPrincipal`
+ `NotAction`

# Resource control policy examples
<a name="orgs_manage_policies_rcps_examples"></a>

The example [resource control policies (RCPs)](orgs_manage_policies_rcps.md) displayed in this topic are for information purposes only.

**Before using these examples**  
Before you use these example RCPs in your organization, consider the following:  
[Resource control policies (RCPs)](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_rcps.html) are meant to be used as coarse-grained preventative controls, and they don't grant access. You must still attach [identity-based or resource-based policies](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_identity-vs-resource.html) to IAM principals or resources in your accounts to actually grant permissions. The effective permissions are the logical intersection between the SCP/RCP and an identity policy or the SCP/RCP and a resource policy. You can get more details about RCP effects on permissions [here](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_rcps.html#rcp-effects-on-permissions).
The resource control policies in this repository are shown as examples. You should not attach RCPs without thoroughly testing the impact that the policy has on resources in your accounts. Once you have a policy ready that you would like to implement, we recommend testing in a separate organization or OU that can represent your production environment. Once tested, you should deploy changes to test OUs and then progressively deploy the changes to a broader set of OUs over time. 
The [RCPFullAWSAccess](https://console.aws.amazon.com/organizations/v2/home/policies/resource-control-policy/p-RCPFullAWSAccess) policy is automatically attached to the organization root, every OU, and every account in your organization, when you enable resource control policies (RCPs). This default RCP allows all principals and actions access to pass through RCP evaluation. You can make use of Deny statements to restrict access to resources in your organization. You still also need to grant appropriate permissions to your principals by using identity-based or resource-based policies.
A [Resource control policy (RCP)](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_rcps.html), when attached to an organization root, organization unit, or an account offers a central control over the maximum available permissions for resources in your organization, organization unit or an account. As an RCP can be applied at multiple levels in an organization, understanding how [RCPs are evaluated](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_rcps_evaluation.html) can help you write RCPs that yield the expected outcome.
The example policies in this section demonstrate the implementation and use of RCPs. They're ***not*** intended to be interpreted as official AWS recommendations or best practices to be implemented exactly as shown. It is your responsibility to carefully test any policies for its suitability to solve the business requirements of your environment. Deny-based resource control policies can unintentionally limit or block your use of AWS services unless you add the necessary exceptions to the policy.

**Tip**  
Before implementing RCPs, in addition to reviewing [AWS CloudTrail logs](https://aws.amazon.com/cloudtrail/), assessing [IAM Access Analyzer external access findings](https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-findings-view.html#access-analyzer-findings-view-external) can help understand which resources are currently public or shared externally. 

## GitHub repository
<a name="rcp-github-repositories"></a>
+ [Resource control policy examples](https://github.com/aws-samples/resource-control-policy-examples) - This GitHub repository contains example policies to get started or mature your usage of AWS RCPs

# Management policies in AWS Organizations
<a name="orgs_manage_policies_management_policies"></a>

Management policies enable you to centrally configure and manage AWS services and their features. How those policies affect the OUs and accounts that inherit them depends on the type of management policy you apply in AWS Organizations. Review the topics in this section to understand relevant terms and concepts about management policies.

**Topics**
+ [Prerequisites and permissions](orgs_manage_policies_prereqs.md)
+ [Understanding policy inheritance](orgs_manage_policies_inheritance_mgmt.md)
+ [Viewing effective policies](orgs_manage_policies_effective.md)
+ [Invalid policy alerts](invalid-policy-alerts.md)
+ [Declarative policies](orgs_manage_policies_declarative.md)
+ [Backup policies](orgs_manage_policies_backup.md)
+ [Tag policies](orgs_manage_policies_tag-policies.md)
+ [Chat applications policies](orgs_manage_policies_chatbot.md)
+ [AI services opt-out policies](orgs_manage_policies_ai-opt-out.md)
+ [Security Hub policies](orgs_manage_policies_security_hub.md)
+ [Amazon Bedrock policies](orgs_manage_policies_bedrock.md)
+ [Amazon Inspector policies](orgs_manage_policies_inspector.md)
+ [Upgrade rollout policies](orgs_manage_policies_upgrade_rollout.md)
+ [Amazon S3 policies](orgs_manage_policies_s3.md)
+ [AWS Shield Network Security Director policies](orgs_manage_policies_network_security_director.md)

# Prerequisites and permissions for management policies for AWS Organizations
<a name="orgs_manage_policies_prereqs"></a>

This page describes the prerequisites and required permissions for management policies for AWS Organizations.

**Topics**
+ [Prerequisites for management policies](#manage-policies-prereqs-overview)
+ [Permissions for management policies](#manage-policies-permissions)

## Prerequisites for management policies
<a name="manage-policies-prereqs-overview"></a>

Using management policies for an organization requires the following:
+ Your organization must have [all features enabled](orgs_manage_org_support-all-features.md). 
+ You must be signed in to your organization's management account or be a delegated administrator.
+ Your AWS Identity and Access Management (IAM) user or role must have the permissions that are listed in the following section.

## Permissions for management policies
<a name="manage-policies-permissions"></a>

The following example IAM policy provides permissions to use all aspects of management policies in an organization. 

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "OrganizationPolicies",
            "Effect": "Allow",
            "Action": [
                "organizations:AttachPolicy",
                "organizations:CreatePolicy",
                "organizations:DeletePolicy",
                "organizations:DescribeAccount",
                "organizations:DescribeCreateAccountStatus",
                "organizations:DescribeEffectivePolicy",
                "organizations:DescribeOrganization",
                "organizations:DescribeOrganizationalUnit",
                "organizations:DescribePolicy",
                "organizations:DetachPolicy",
                "organizations:DisableAWSServiceAccess",
                "organizations:DisablePolicyType",
                "organizations:EnableAWSServiceAccess",
                "organizations:EnablePolicyType",
                "organizations:ListAccounts",
                "organizations:ListAccountsForParent",
                "organizations:ListAWSServiceAccessForOrganization",
                "organizations:ListCreateAccountStatus",
                "organizations:ListOrganizationalUnitsForParent",
                "organizations:ListParents",
                "organizations:ListPolicies",
                "organizations:ListPoliciesForTarget",
                "organizations:ListRoots",
                "organizations:ListTargetsForPolicy",
                "organizations:UpdatePolicy"
            ],
            "Resource": "*"
        }
    ]
}
```

------

For more information about IAM policies and permissions, see the [IAM User Guide](https://docs.aws.amazon.com/IAM/latest/UserGuide/).

# Understanding management policy inheritance
<a name="orgs_manage_policies_inheritance_mgmt"></a>

**Important**  
The information in this section does ***not*** apply to authorization policies: service control policies (SCPs) and resource control policies (RCPs). For more information about how SCPs and RCPs work in an AWS Organizations hierarchy, see [SCP evaluation](orgs_manage_policies_scps_evaluation.md) and [RCP evaluation](orgs_manage_policies_rcps_evaluation.md).

You can attach management policies to organization entities (organization root, organizational unit (OU), or account) in your organization:
+ When you attach a management policy to the organization root, all OUs and accounts in the organization inherit that policy. 
+ When you attach a management policy to a specific OU, accounts that are directly under that OU or any child OU inherit the policy.
+ When you attach a management policy to a specific account, it affects only that account. 

Because you can attach management policies to multiple levels in the organization, accounts can inherit multiple policies.

This following topics explain how parent policies and child policies are processed into the effective policy for an account. 

**Topics**
+ [Terminology](inheritance-terminology.md)
+ [Management policy types](syntax-inheritance.md)
+ [Inheritance operators](policy-operators.md)
+ [Inheritance examples](inheritance-examples.md)

# Inheritance terminology
<a name="inheritance-terminology"></a>

This topic uses the following terms when discussing management policy inheritance.

**Policy inheritance**  
The interaction of policies at differing levels of an organization, moving from the top-level root of the organization, down through the organizational unit (OU) hierarchy to individual accounts.  
You can attach policies to the organization root, OUs, individual accounts, and to any combination of these organization entities. Policy inheritance refers to management policies that are attached to the organization root or to an OU. All accounts that are members of the organization root or OU where a management policy is attached *inherit* that policy.  
For example, when management policies are attached to the organization root, all accounts in the organization inherit that policy. That's because all accounts in an organization are always under the organization root. When you attach a policy to a specific OU, accounts that are directly under that OU or any child OU inherit that policy. Because you can attach policies to multiple levels in the organization, accounts might inherit multiple policy documents for a single policy type. 

**Parent policies**  
Policies that are attached higher in the organizational tree than policies that are attached to entities lower in the tree.   
For example, if you attach management policy A to the organization root, it's just a policy. If you also attach policy B to an OU under that root, policy A is the parent policy of Policy B. Policy B is the child policy of Policy A. Policy A and policy B merge to create the effective tag policy for accounts in the OU.

**Child policies**  
Policies that are attached at a lower level in the organization tree than the parent policy. 

**Effective policies**  
The final, single policy document that specifies the rules that apply to an account. The effective policy is the aggregation of any policies the account inherits, plus any policy that is directly attached to the account. For more information, see [Viewing effective management policies](orgs_manage_policies_effective.md).

**Inheritance operators**  
Operators that control how inherited policies merge into a single effective policy. These operators are considered an advanced feature. Experienced policy authors can use them to limit what changes a child policy can make and how settings in policies merge. For more information, see [Inheritance operators](policy-operators.md).

# Policy syntax and inheritance for management policy types
<a name="syntax-inheritance"></a>

Exactly how policies affect the OUs and accounts that inherit them depends on the type of management policy you choose. Management policy types include:
+ [Declarative policies](orgs_manage_policies_declarative.md)
+ [Backup policies](orgs_manage_policies_backup.md)
+ [Tag policies](orgs_manage_policies_tag-policies.md)
+ [Chat applications policies](orgs_manage_policies_chatbot.md)
+ [AI services opt-out policies](orgs_manage_policies_ai-opt-out.md)
+ [Security Hub policies](orgs_manage_policies_security_hub.md)
+ [Bedrock policies](orgs_manage_policies_bedrock.md)
+ [Inspector policies](orgs_manage_policies_inspector.md)
+ [Upgrade rollout policies](orgs_manage_policies_upgrade_rollout.md)
+ [S3 policies](orgs_manage_policies_s3.md)
+ [AWS Shield Network Security Director policies](orgs_manage_policies_network_security_director.md)

The syntax for management policy types includes *[Inheritance operators](policy-operators.md)*, which enable you to specify with fine granularity what elements from the parent policies are applied and what elements can be overridden or modified when inherited by child OUs and accounts.

The *effective policy* is the set of rules that are inherited from the organization root and OUs along with those directly attached to the account. The effective policy specifies the final set of rules that apply to the account. You can view the effective policy for an account that includes the effect of all of the inheritance operators in the policies applied. For more information, see [Viewing effective management policies](orgs_manage_policies_effective.md).

# Inheritance operators
<a name="policy-operators"></a>

Inheritance operators control how inherited policies and account policies merge into the account's effective policy. These operators include value-setting operators and child control operators. 

When you use the visual editor in the AWS Organizations console, you can use only the `@@assign` operator. Other operators are considered an advanced feature. To use the other operators, you must manually author the JSON policy. Experienced policy authors can use inheritance operators to control what values are applied to the effective policy and limit what changes child policies can make. 

For information about how policy inheritance works in an organization, see [Inheritance examples](inheritance-examples.md).

## Value-setting operators
<a name="value-setting-operators"></a>

You can use the following value-setting operators to control how your policy interacts with its parent policies:
+ `@@assign` – **Overwrites** any inherited policy settings with the specified settings. If the specified setting isn't inherited, this operator adds it to the effective policy. This operator can apply to any policy setting of any type.
  + For single-valued settings, this operator replaces the inherited value with the specified value.
  + For multi-valued settings (JSON arrays), this operator removes any inherited values and replaces them with the values specified by this policy.
+ `@@append` – **Adds** the specified settings (without removing any) to the inherited ones. If the specified setting isn't inherited, this operator adds it to the effective policy. You can use this operator with only multi-valued settings.
  + This operator adds the specified values to any values in the inherited array.
+ `@@remove` – **Removes** the specified inherited settings from the effective policy, if they exist. You can use this operator with only multi-valued settings.
  + This operator removes only the specified values from the array of values inherited from the parent policies. Other values can continue to exist in the array and can be inherited by child policies.

## Child control operators
<a name="child-control-operators"></a>

Using child control operators is optional. You can use the `@@operators_allowed_for_child_policies` operator to control which value-setting operators child policies can use. You can allow all operators, some specific operators, or no operators. By default, all operators (`@@all`) are allowed.
+ `"@@operators_allowed_for_child_policies"`:`["@@all"]` – Child OUs and accounts can use any operator in policies. By default, all operators are allowed in child policies.
+ `"@@operators_allowed_for_child_policies"`:`["@@assign", "@@append", "@@remove"]` – Child OUs and accounts can use only the specified operators in child policies. You can specify one or more value-setting operators in this child control operator.
+ `"@@operators_allowed_for_child_policies"`:`["@@none"]` – Child OUs and accounts can't use operators in policies. You can use this operator to effectively lock in the values that are defined in a parent policy so that child policies can't add, append, or remove those values.

**Note**  
If an inherited child control operator limits the use of an operator, you can't reverse that rule in a child policy. If you include child control operators in a parent policy, they limit the value-setting operators in all child policies.

# Inheritance examples
<a name="inheritance-examples"></a>

These examples show how policy inheritance works by showing how parent and child tag policies are merged into an effective tag policy for an account.

The examples assume that you have the organization structure shown in the following diagram.

![\[An organization with one root, two OUs, and several accounts.\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/org-structure-inheritance.png)


**Topics**
+ [Example 1: Allow child policies to overwrite *only* tag values](#example-assign-operator)
+ [Example 2: Append new values to inherited tags](#example-append-operator)
+ [Example 3: Remove values from inherited tags](#example-remove-operator)
+ [Example 4: Restrict changes to child policies](#example-restrict-child)
+ [Example 5: Conflicts with child control operators](#multiple-same-node-operators)
+ [Example 6: Conflicts with appending values at same hierarchy level](#multiple-same-node-values)

## Example 1: Allow child policies to overwrite *only* tag values
<a name="example-assign-operator"></a>

The following tag policy defines the `CostCenter` tag key and two acceptable values, `Development` and `Support`. If you attach it to the organization root, the tag policy is in effect for all accounts in the organization. 

**Policy A – Organization root tag policy**

```
{
    "tags": {
        "costcenter": {
            "tag_key": {
                "@@assign": "CostCenter"
            },
            "tag_value": {
                "@@assign": [
                    "Development",
                    "Support"
                ]
            }
        }
    }
}
```

Assume that you want users in OU1 to use a different tag value for a key, and you want to enforce the tag policy for specific resource types. Because policy A doesn't specify which child control operators are allowed, all operators are allowed. You can use the `@@assign` operator and create a tag policy like the following to attach to OU1. 

**Policy B – OU1 tag policy**

```
{
    "tags": {
        "costcenter": {
            "tag_key": {
                "@@assign": "CostCenter"
            },
            "tag_value": {
                "@@assign": [
                    "Sandbox"
                ]
            },
            "enforced_for": {
                "@@assign": [
                    "redshift:*",
                    "dynamodb:table"
                ]
            }
        }
    }
}
```

Specifying the `@@assign` operator for the tag does the following when policy A and policy B merge to form the *effective tag policy* for an account:
+ Policy B overwrites the two tag values that were specified in the parent policy, policy A. The result is that `Sandbox` is the only compliant value for the `CostCenter` tag key.
+ The addition of `enforced_for` specifies that the `CostCenter` tag *must* be the specified tag value on all Amazon Redshift resources and Amazon DynamoDB tables.

As shown in the diagram, OU1 includes two accounts: 111111111111 and 222222222222. 

**Resultant effective tag policy for accounts 111111111111 and 222222222222**

**Note**  
You can't directly use the contents of a displayed effective policy as the contents of a new policy. The syntax doesn't include the operators needed to control merging with other child and parent policies. The display of an effective policy is intended only for understanding the results of the merger. 

```
{
    "tags": {
        "costcenter": {
            "tag_key": "CostCenter",
            "tag_value": [
                "Sandbox"
            ],
            "enforced_for": [
                "redshift:*",
                "dynamodb:table"
            ]
        }
    }
}
```

## Example 2: Append new values to inherited tags
<a name="example-append-operator"></a>

There may be cases where you want all accounts in your organization to specify a tag key with a short list of acceptable values. For accounts in one OU, you may want to allow an additional value that only those accounts can specify when creating resources. This example specifies how to do that by using the `@@append` operator. The `@@append` operator is an advanced feature. 

Like example 1, this example starts with policy A for the organization root tag policy. 

**Policy A – Organization root tag policy**

```
{
    "tags": {
        "costcenter": {
            "tag_key": {
                "@@assign": "CostCenter"
            },
            "tag_value": {
                "@@assign": [
                    "Development",
                    "Support"
                ]
            }
        }
    }
}
```

For this example, attach policy C to OU2. The difference in this example is that using the `@@append` operator in policy C *adds to*, rather than overwrites, the list of acceptable values and the `enforced_for` rule.

**Policy C – OU2 tag policy for appending values**

```
{
    "tags": {
        "costcenter": {
            "tag_key": {
                "@@assign": "CostCenter"
            },
            "tag_value": {
                "@@append": [
                    "Marketing"
                ]
            },
            "enforced_for": {
                "@@append": [
                    "redshift:*",
                    "dynamodb:table"
                ]
            }
        }
    }
}
```

Attaching policy C to OU2 has the following effects when policy A and policy C merge to form the effective tag policy for an account:
+ Because policy C includes the `@@append` operator, it allows for *adding to*, not overwriting, the list of acceptable tag values that are specified in Policy A.
+ As in policy B, the addition of `enforced_for` specifies that the `CostCenter` tag must be used as the specified tag value on all Amazon Redshift resources and Amazon DynamoDB tables. Overwriting (`@@assign`) and adding (`@@append`) have the same effect if the parent policy doesn't include a child control operator that restricts what a child policy can specify.

As shown in the diagram, OU2 includes one account: 999999999999. Policy A and policy C merge to create the effective tag policy for account 999999999999.

**Effective tag policy for account 999999999999**

**Note**  
You can't directly use the contents of a displayed effective policy as the contents of a new policy. The syntax doesn't include the operators needed to control merging with other child and parent policies. The display of an effective policy is intended only for understanding the results of the merger. 

```
{
    "tags": {
        "costcenter": {
            "tag_key": "CostCenter",
            "tag_value": [
                "Development",
                "Support",
                "Marketing"
            ],
            "enforced_for": [
                "redshift:*",
                "dynamodb:table"
            ]
        }
    }
}
```

## Example 3: Remove values from inherited tags
<a name="example-remove-operator"></a>

There may be cases where the tag policy that is attached to the organization defines more tag values than you want an account to use. This example explains how to revise a tag policy using the `@@remove` operator. The `@@remove` is an advanced feature.

Like the other examples, this example starts with policy A for the organization root tag policy.

**Policy A – Organization root tag policy**

```
{
    "tags": {
        "costcenter": {
            "tag_key": {
                "@@assign": "CostCenter"
            },
            "tag_value": {
                "@@assign": [
                    "Development",
                    "Support"
                ]
            }
        }
    }
}
```

For this example, attach policy D to account 999999999999. 

**Policy D – Account 999999999999 tag policy for removing values**

```
{
    "tags": {
        "costcenter": {
            "tag_key": {
                "@@assign": "CostCenter"
            },
            "tag_value": {
                "@@remove": [
                    "Development",
                    "Marketing"
                ],
                "enforced_for": {
                    "@@remove": [
                        "redshift:*",
                        "dynamodb:table"
                    ]
                }
            }
        }
    }
}
```

Attaching policy D to account 999999999999 has the following effects when policy A, policy C, and policy D merge to form the effective tag policy:
+ Assuming you performed all of the previous examples, policies B, C, and C are child policies of A. Policy B is only attached to OU1, so it has no effect on account 9999999999999.
+ For account 9999999999999, the only acceptable value for the `CostCenter` tag key is `Support`.
+ Compliance is not enforced for the `CostCenter` tag key.

**New effective tag policy for account 999999999999**

**Note**  
You can't directly use the contents of a displayed effective policy as the contents of a new policy. The syntax doesn't include the operators needed to control merging with other child and parent policies. The display of an effective policy is intended only for understanding the results of the merger. 

```
{
    "tags": {
        "costcenter": {
            "tag_key": "CostCenter",
            "tag_value": [
                "Support"
            ]
        }
    }
}
```

If you later add more accounts to OU2, their effective tag policies would be different than for account 999999999999. That's because the more restrictive policy D is only attached at the account level, and not to the OU. 

## Example 4: Restrict changes to child policies
<a name="example-restrict-child"></a>

There may be cases where you want to restrict changes in child policies. This example explains how to do that using child control operators.

This example starts with a new organization root tag policy and assumes that tag policies aren't yet attached to organization entities. 

**Policy E – Organization root tag policy for restricting changes in child policies **

```
{
    "tags": {
        "project": {
            "tag_key": {
                "@@operators_allowed_for_child_policies": ["@@none"],
                "@@assign": "Project"
            },
            "tag_value": {
                "@@operators_allowed_for_child_policies": ["@@append"],
                "@@assign": [
                    "Maintenance",
                    "Escalations"
                ]
            }
        }
    }
}
```

When you attach policy E to the organization root, the policy prevents child policies from changing the `Project` tag key. However, child policies can overwrite or append tag values.

Assume you then attach the following policy F to an OU.

**Policy F – OU tag policy**

```
{
    "tags": {
        "project": {
            "tag_key": {
                "@@assign": "PROJECT"
            },
            "tag_value": {
                "@@append": [
                    "Escalations - research"
                ]
            }
        }
    }
}
```

Merging policy E and policy F have the following effects on the OU's accounts:
+ Policy F is a child policy to Policy E.
+ Policy F attempts to change the case treatment, but it can't. That's because policy E includes the `"@@operators_allowed_for_child_policies": ["@@none"]` operator for the tag key.
+ However, policy F can append tag values for the key. That's because policy E includes `"@@operators_allowed_for_child_policies": ["@@append"]` for the tag value. 

**Effective policy for accounts in the OU**

**Note**  
You can't directly use the contents of a displayed effective policy as the contents of a new policy. The syntax doesn't include the operators needed to control merging with other child and parent policies. The display of an effective policy is intended only for understanding the results of the merger. 

```
{
    "tags": {
        "project": {
            "tag_key": "Project",
            "tag_value": [
                "Maintenance",
                "Escalations",
                "Escalations - research"
            ]
        }
    }
}
```

## Example 5: Conflicts with child control operators
<a name="multiple-same-node-operators"></a>

Child control operators can exist in tag policies that are attached at the same level in the organization hierarchy. When that happens, the intersection of the allowed operators is used when the policies merge to form the effective policy for accounts.

Assume policy G and policy H are attached to the organization root. 

**Policy G – Organization root tag policy 1**

```
{
    "tags": {
        "project": {
            "tag_value": {
                "@@operators_allowed_for_child_policies": ["@@append"],
                "@@assign": [
                    "Maintenance"
                ]
            }
        }
    }
}
```

**Policy H – Organization root tag policy 2**

```
{
    "tags": {
        "project": {
            "tag_value": {
                "@@operators_allowed_for_child_policies": ["@@append", "@@remove"]
            }
        }
    }
}
```

In this example, one policy at the organization root defines that the values for the tag key can only be appended to. The other policy attached to the organization root allows child policies to both append and remove values. The intersection of these two permissions is used for child policies. The result is that child policies can append values, but not remove values. Therefore, the child policy can append a value to the list of tag values but can't remove the `Maintenance` value.

## Example 6: Conflicts with appending values at same hierarchy level
<a name="multiple-same-node-values"></a>

You can attach multiple tag policies to each organization entity. When you do this, the tag policies that are attached to the same organization entity might include conflicting information. Policies are evaluated based on the order in which they were attached to the organization entity. To change which policy is evaluated first, you can detach a policy and then reattach it.

Assume policy J is attached to the organization root first, and then policy K is attached to the organization root. 

**Policy J – First tag policy attached to the organization root**

```
{
    "tags": {
        "project": {
            "tag_key": {
                "@@assign": "PROJECT"
            },
            "tag_value": {
                "@@append": ["Maintenance"]
            }
        }
    }
}
```

**Policy K – Second tag policy attached to the organization root**

```
{
    "tags": {
        "project": {
            "tag_key": {
                "@@assign": "project"
            }
        }
    }
}
```

In this example, the tag key `PROJECT` is used in the effective tag policy because the policy that defined it was attached to the organization root first.

**Policy JK – Effective tag policy for account**

The effective policy for the account is as follows.

**Note**  
You can't directly use the contents of a displayed effective policy as the contents of a new policy. The syntax doesn't include the operators needed to control merging with other child and parent policies. The display of an effective policy is intended only for understanding the results of the merger. 

```
{
    "tags": {
        "project": {
            "tag_key": "PROJECT",
            "tag_value": [
                "Maintenance"
            ]
        }
    }
}
```

# Viewing effective management policies
<a name="orgs_manage_policies_effective"></a>

Determine the effective management policy for an account in your organization.

## What is an effective management policy?
<a name="effective-policy-defined"></a>

The *effective policy* specifies the final rules that apply to an AWS account for a management policy type. It is the aggregation for a management policy that the account inherits, plus any policies for that management policy type that are directly attached to the account. When you attach a management policy to the organization's root, it applies to all accounts in your organization. When you attach a management policy to an organiztional unit (OU), it applies to all accounts and OUs that belong to the OU. When you attach a management policy directly to an account, it applies only to that one AWS account.

For information about how policies are combined into the final effective policy, see [Understanding management policy inheritance](orgs_manage_policies_inheritance_mgmt.md).

**Backup policy example**

The backup policy attached to the organization root might specify that all accounts in the organization back up all Amazon DynamoDB tables with a default backup frequency of once per week. A separate backup policy attached directly to one member account with critical information in a table can override the frequency with a value of once per day. The combination of these backup policies comprises the effective backup policy. This effective backup policy is determined for each account in the organization individually. In this example, the result is that all accounts in the organization back up their DynamoDB tables once per week, with the exception of one account that backs up its tables daily.

**Tag policy example**

The tag policy attached to the organization root might define a `CostCenter` tag with four compliant values. A separate tag policy attached to the account may restrict the `CostCenter` key to only two of the four compliant values. The combination of these tag policies comprises the effective tag policy. The result is that only two of the four compliant tag values defined in the organization root tag policy are compliant for the account.

**Chat applications policy example**

Amazon Q Developer in chat applications will reevaluate any previously created Amazon Q Developer in chat applications configurations against the effective chat applications policies and deny any previously allowed actions if they are consistent with the permitted settings and guardrails in the effective policy. The effective policy for a member account defines the permitted settings and guardrails. For example, if a chat applications policy with deny access for public Slack channels is applied to a member account, then the existing Amazon Q Developer in chat applications configurations for public Slack channels in the member account will be disabled. Amazon Q Developer in chat applications will not deliver notifications and channel members will not be able to run any tasks in the blocked channel. The Amazon Q Developer in chat applications console will mark the affected channels as disabled with an appropriate error messaging next to it.

**AI services opt-out example**

The AI services opt-out policy attached to the organization root might specify that all accounts in the organization opt out of content use by all AWS machine learning services. A separate AI services opt-out policy attached directly to one member account specifies that it opts in to content use for only Amazon Rekognition. The combination of these AI services opt-out policies comprises the effective AI services opt-out policy. The result is that all accounts in the organization are opted out of all AWS services, with the exception of one account that opts in to Amazon Rekognition.

## How to view the effective management policy
<a name="how-to-view-effective-policies"></a>

You can view the effective policy of a management policy type for an account from the AWS Management Console, AWS API, or AWS Command Line Interface.

**Minimum permissions**  
To view the effective policy of a management policy type for an account, you must have permission to run the following actions:  
`organizations:DescribeEffectivePolicy`
`organizations:DescribeOrganization` – required only when using the Organizations console

------
#### [ AWS Management Console ]

**To view the effective policy of a management policy type for an account**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[AWS accounts](https://console.aws.amazon.com/organizations/v2/home/accounts)** page, choose the name of the account for which you want to view the effective policy. You might have to expand OUs (choose the ![\[Gray cloud icon representing cloud computing or storage services.\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/console-expand.png)) to find the account that you want.

1. On the **Policies** tab, choose the management policy type for which you want to view the effective policy.

1. Choose **View the effective policy for this AWS account**.

   The console displays the effective policy applied to the specified account.
**Note**  
You can't copy and paste an effective policy and use it as the JSON for another policy without significant changes. Policy documents must include the [inheritance operators](policy-operators.md) that specify how each setting is merged into the final effective policy. 

------
#### [ AWS CLI & AWS SDKs ]

**To view the effective policy of a management policy type for an account**  
You can use one of the following to view the effective policy:
+ AWS CLI: [describe-effective-policy](https://docs.aws.amazon.com/cli/latest/reference/organizations/describe-effective-policy.html)

  The following example shows the effective AI services opt-out policy for an account.

  ```
  $ aws organizations describe-effective-policy \
      --policy-type AISERVICES_OPT_OUT_POLICY \
      --target-id 123456789012
  {
      "EffectivePolicy": {
          "PolicyContent": "{\"services\":{\"comprehend\":{\"opt_out_policy\":\"optOut\"},   ....TRUNCATED FOR BREVITY....   "opt_out_policy\":\"optIn\"}}}",
          "LastUpdatedTimestamp": "2020-12-09T12:58:53.548000-08:00",
          "TargetId": "123456789012",
          "PolicyType": "AISERVICES_OPT_OUT_POLICY"
      }
  }
  ```
+ AWS SDKs: [DescribeEffectivePolicy](https://docs.aws.amazon.com/organizations/latest/APIReference/API_DescribeEffectivePolicy.html) 

------

For information about situations in which an effective policy could become invalid, see [Viewing invalid policy alerts](https://docs.aws.amazon.com//organizations/latest/userguide/invalid-policy-alerts.html). 

# About invalid effective policy alerts
<a name="invalid-policy-alerts"></a>

*Invalid policy alerts* let you know about invalid effective policies and provide mechanisms (APIs) to identify accounts with invalid policies. AWS Organizations notifies you asynchronously when one of your accounts has an invalid effective policy. The notification appears as a banner in the AWS Organizations console page, and it is recorded as an AWS CloudTrail event.

## Detect invalid effective management policies in your organization
<a name="detect-invalid-policies"></a>

There are several ways in which you can view invalid effective management policies in your organization: from the AWS Management Console, AWS API, AWS Command Line Interface (CLI), or as an AWS CloudTrail event.

**Minimum permissions**  
 To find the information related to invalid effective policies of a management policy type in your organization, you must have permission to run the following actions:  
`organizations:ListAccountsWithInvalidEffectivePolicy`
`organizations:ListEffectivePolicyValidationErrors`
`organizations:ListRoots` - required only when using the Organizations console

------
#### [ AWS Management Console ]

**To view invalid effective management policies from the console**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[AWS accounts](https://console.aws.amazon.com/organizations/v2/home/accounts)** page page, if your organization has invalid effective policies, a warning banner is displayed at the top of the page.

1. In the banner, click on **View detected issues** to view the list of all accounts in your organization that have invalid effective policies.

1. For each account in the list, select **View issues** to get more information on errors for each account shown under the **Effective policy issues** sections on this page.

------
#### [ AWS CLI & AWS SDKs ]

**To view the effective policy of a management policy type for an account**  
The following commands help you view accounts with invalid effective policies
+ AWS CLI: [list-accounts-with-invalid-effective-policy](https://docs.aws.amazon.com/cli/latest/reference/organizations/list-accounts-with-invalid-effective-policy.html)
+ AWS SDKs: [ListAccountsWithInvalidEffectivePolicy](https://docs.aws.amazon.com/organizations/latest/APIReference/API_ListAccountsWithInvalidEffectivePolicy.html) 

**The following commands help you view effective policy errors on an account**
+ AWS CLI: [list-effective-policy-validation-errors](https://docs.aws.amazon.com/cli/latest/reference/organizations/list-effective-policy-validation-errors.html)
+ AWS SDKs: [ListEffectivePolicyValidationErrors](https://docs.aws.amazon.com/organizations/latest/APIReference/API_ListEffectivePolicyValidationErrors.html) 

------

**AWS CloudTrail**

You can use AWS CloudTrail events to monitor when accounts in your organizations have invalid effective management policies and when the policies are fixed. For more information, see *Effective policy examples* in [Understanding AWS Organizations log file entries](https://docs.aws.amazon.com//organizations/latest/userguide/orgs_cloudtrail-integration.html#understanding-service-name-entries).

If you receive an invalid effective policy notification, you can navigate through the AWS Organizations console or call these APIs from your management or delegated administrator account to find more details about the status of specific accounts and policies:
+  `ListAccountsWithInvalidEffectivePolicy` – Returns a list of accounts in the organization that have invalid effective policies of a specified type.
+ `ListEffectivePolicyValidationErrors` – Returns a list of validation errors for a specified account and management policy type. The validation errors contain details, including the error code, error description, and contributing policies that made the effective policy invalid.

## When an effective management policy might be considered invalid
<a name="effective-policy-invalid"></a>

Effective policies on an account can become invalid if they violate the constraints defined for the particular policy type. For example, a policy might be missing a required parameter in the final effective policy or exceed certain quotas defined for the policy type.

**Backup policy example**

Suppose that you create a backup policy with nine backup rules and attach it to the root of your organization. Later, you create another backup policy for the same backup plan – with two more rules – and attach it to any account in the organization. In that situation, there's an invalid effective policy on the account. It is invalid because the aggregation of the two policies defines 11 rules for the backup plan. The limit is 10 backup rules in a plan.

**Warning**  
If any account in the organization has an invalid effective policy, that account will not receive effective policy updates for the particular policy type. It continues with the last applied valid effective policy for the account, unless all the errors are fixed.

**Examples of possible errors for effective policies**
+ `ELEMENTS_TOO_MANY` – Occurs when a particular attribute in an effective policy exceeds the allowed limit, such as when more than 10 rules are given for a backup plan.
+ `ELEMENTS_TOO_FEW` – Occurs when a particular attribute in an effective policy does not meet the minimum limit, such as when no region is defined for a backup plan.
+ `KEY_REQUIRED` – Occurs when a required configuration is missing in the effective policy, such as when a backup plan is missing a backup rule.

AWS Organizations validates effective policies before applying them to the accounts in your organization. This auditing process is especially beneficial if you have a large organization structure, and if your organization's policies are managed by more than one team.

# Declarative policies
<a name="orgs_manage_policies_declarative"></a>

Declarative policies allow you to centrally declare and enforce your desired configuration for a given AWS service at scale across an organization. Once attached, the configuration is always maintained when the service adds new features or APIs. Use declarative policies to prevent noncompliant actions. For example, you can block public internet access to Amazon VPC resources across your organization. 

The key benefits of using declarative policies are:
+ **Ease of use**: You can enforce the baseline configuration for an AWS service with a few selections in the AWS Organizations and AWS Control Tower consoles or with a few commands using the AWS CLI & AWS SDKs.
+ **Set once and forget**: The baseline configuration for an AWS service is always maintained, even when the service introduces new features or APIs. The baseline configuration is also maintained when new accounts are added to an organization or when new principals and resources are created.
+ **Transparency**: The account status report allows you to review the current status of all attributes supported by declarative policies for the accounts in scope. You can also create customizable error messages, which can help administrators redirect end users to internal wiki pages or provide a descriptive message that can help end users understand why an action failed. 

 For a full list of supported AWS services and attributes, see [Supported AWS services and attributes](#orgs_manage_policies_declarative-supported-controls).

**Topics**
+ [How declarative policies work](#orgs_manage_policies_declarative-how-work)
+ [Custom error messages](#orgs_manage_policies_declarative-custom-message)
+ [Account status report](#orgs_manage_policies_declarative-account-status-report)
+ [Supported services](#orgs_manage_policies_declarative-supported-controls)
+ [Getting started](orgs_manage_policies-declarative_getting-started.md)
+ [Best practices](orgs_manage_policies_declarative_best-practices.md)
+ [Generating the account status report](orgs_manage_policies_declarative_status-report.md)
+ [Declarative policy syntax and examples](orgs_manage_policies_declarative_syntax.md)

## How declarative policies work
<a name="orgs_manage_policies_declarative-how-work"></a>

Declarative policies are enforced in the service's control plane, which is an important distinction from [authorization policies such as service control policies (SCPs) and resource control policies (RCPs)](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_authorization_policies.html). While authorization policies regulate access to APIs, declarative policies are applied directly at the service level to enforce durable intent. This ensures that the baseline configuration is always enforced, even when new features or APIs are introduced by the service.

The following table helps illustrate this distinction and provides some use cases.


****  

|  | Service control policies | Resource control policies | Declarative policies | 
| --- | --- | --- | --- | 
| Why? |  To centrally define and enforce consistent access controls on principals (such as IAM users and IAM roles) at scale.   |  To centrally define and enforce consistent access controls on resources at scale  |  To centrally define and enforce the baseline configuration for AWS services at scale.  | 
| How? |  By controlling the maximum available access permissions of principals at an API level.  |  By controlling the maximum available access permissions for resources at an API level.  |  By enforcing the desired configuration of an AWS service without using API actions.  | 
| Governs service-linked roles? | No | No | Yes | 
| Feedback mechanism | Non-customizable access denied SCP error. | Non-customizable access denied RCP error. | Customizable error message. For more information, see [Custom error messages for declarative policies](#orgs_manage_policies_declarative-custom-message). | 
| Example policy | [Deny member accounts from leaving the organization](https://github.com/aws-samples/service-control-policy-examples/blob/main/Privileged-access-controls/Deny-member-accounts-from-leaving-your-AWS-organization.json) | [Restrict access to only HTTPS connections to your resources](https://github.com/aws-samples/resource-control-policy-examples/blob/main/Restrict-resource-access-patterns/Restrict-access-to-only-HTTPS-connections-to-your-resources.json) | [Allowed Images Settings](orgs_manage_policies_declarative_syntax.md#declarative-policy-ec2-ami-allowed-images) | 

After you have [created](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_policies_create.html#create-declarative-policy-procedure) and [attached](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_policies_attach.html) a declarative policy, it is applied and enforced across your organization. Declarative policies can be applied to an entire organization, organizational units (OUs), or accounts. Accounts joining an organization will automatically inherit the declarative policy in the organization. For more information, see [Understanding management policy inheritance](orgs_manage_policies_inheritance_mgmt.md).

The *effective policy* is the set of rules that are inherited from the organization root and OUs along with those directly attached to the account. The effective policy specifies the final set of rules that apply to the account. For more information, see [Viewing effective management policies](orgs_manage_policies_effective.md).

If a declarative policy is [detached](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_policies_detach.html), the attribute state will roll back to its previous state before the declarative policy was attached.

## Custom error messages for declarative policies
<a name="orgs_manage_policies_declarative-custom-message"></a>

Declarative policies allow you to create custom error messages. For example, if an API operation fails due to a declarative policy, you can set the error message or provide a custom URL, such as a link to an internal wiki or a link to a message that describes the failure. If you do not specify a custom error message, AWS Organizations provides the following default error message: `Example: This action is denied due to an organizational policy in effect`.

You can also audit the process of creating declarative policies, updating declarative policies, and deleting declarative policies with AWS CloudTrail. CloudTrail can flag API operation failures due to declarative policies. For more information, see [Logging and monitoring](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_security_incident-response.html).

**Important**  
Do not include *personally identifiable information (PII)* or other sensitive information in a custom error message. PII includes general information that can be used to identify or locate an individual. It covers records such as financial, medical, educational, or employment. PII examples include addresses, bank account numbers, and phone numbers.

## Account status report for declarative policies
<a name="orgs_manage_policies_declarative-account-status-report"></a>

The *account status report* allows you to review the current status of all attributes supported by declarative policies for the accounts in scope. You can choose the accounts and organizational units (OUs) to include in the report scope, or choose an entire organization by selecting the root.

This report helps you assess readiness by providing a Region breakdown and if the current state of an attribute is *uniform across accounts* (through the `numberOfMatchedAccounts`) or *inconsistent* (through the `numberOfUnmatchedAccounts`). You can also see the *most frequent value*, which is the configuration value that is most frequently observed for the attribute.

In Figure 1, there is a generated account status report, which shows uniformity across accounts for the following attributes: VPC Block Public Access and Image Block Public Access. This means that, for each attribute, all the accounts in scope have the same configuration for that attribute.

The generated account status report shows inconsistent accounts for the following attributes: Allowed Images Settings, Instance Metadata defaults, Serial Console Access, and Snapshot Block Public Access. In this example, each attribute with an inconsistent account is due to there being one account with a different configuration value.

If there is a most frequent value, that is displayed in its respective column. For more detailed information of what each attribute controls, see [Declarative policy syntax and example policies](orgs_manage_policies_declarative_syntax.md).

You can also expand an attribute to see a Region breakdown. In this example, Image Block Public Access is expanded and in each Region, you can see that there is also uniformity across accounts.

The choice to attach a declarative policy for enforcing a baseline configuration depends on your specific use case. Use the account status report to help you assess your readiness before attaching a declarative policy.

For more information, see [Generating the account status report](orgs_manage_policies_declarative_status-report.md).

![\[Example account status report with uniformity across accounts for VPC Block Public Access and Image Block Public Access\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/declarative-status-report.png)


*Figure 1: Example account status report with uniformity across accounts for VPC Block Public Access and Image Block Public Access.*

## Supported AWS services and attributes
<a name="orgs_manage_policies_declarative-supported-controls"></a>

### Supported attributes for declarative policies for EC2
<a name="orgs_manage_policies_declarative-supported-controls-ec2"></a>

The following table displays the attributes supported for Amazon EC2 related services.


**Declarative policies for EC2**  
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_declarative.html)

# Getting started with declarative policies
<a name="orgs_manage_policies-declarative_getting-started"></a>

Follow these steps to get started using declarative policies.

1. [Learn about the permissions you must have to perform declarative policy tasks](orgs_manage_policies_prereqs.md).

1. [Enable declarative policies for your organization](enable-policy-type.md).
**Note**  
**Enabling trust access is required**  
You must enable trusted access for the service where the declarative policy will enforce a baseline configuration. This creates a read-only service-linked role that is used to generate the account status report of what the existing configuration is for accounts across your organization.  
**Using the console**  
If you use the Organizations console, this step is a part of the process for enabling declarative policies.  
**Using the AWS CLI**  
If you use the AWS CLI, there are two separate APIs:  
[EnablePolicyType](https://docs.aws.amazon.com/organizations/latest/APIReference/API_EnablePolicyType.html), which you use to enable declarative policies.
[EnableAWSServiceAccess](https://docs.aws.amazon.com/organizations/latest/APIReference/API_EnableAWSServiceAccess.html), which you use to enable trusted access.
For more information on how to enable trusted access for a specific service with the AWS CLI see, [AWS services that you can use with AWS Organizations](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_integrate_services_list.html).

1. [Run the account status report](orgs_manage_policies_declarative_status-report.md).

1. [Create a declarative policy](orgs_policies_create.md).

1. [Attach the declarative policy to your organization's root, OU, or account](orgs_policies_attach.md).

1. [View the combined effective declarative policy that applies to an account](orgs_manage_policies_effective.md).

For all of these steps, you sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization's management account.

**Other information**
+ [Learn declarative policy syntax and see example policies](orgs_manage_policies_declarative_syntax.md)

# Best practices for using declarative policies
<a name="orgs_manage_policies_declarative_best-practices"></a>

AWS recommends the following best practices for using declarative policies.

## Leverage readiness assessments
<a name="bp-declarative-readiness"></a>

Use the declarative policy *account status report* to assess the current status of all attributes supported by declarative policies for the accounts in scope. You can choose the accounts and organizational units (OUs) to include in the report scope, or choose an entire organization by selecting the root.

This report helps you assess readiness by providing a Region breakdown and if the current state of an attribute is *uniform across accounts* (through the `numberOfMatchedAccounts`) or *inconsistent* (through the `numberOfUnmatchedAccounts`). You can also see the *most frequent value*, which is the configuration value that is most frequently observed for the attribute.

The choice to attach a declarative policy for enforcing a baseline configuration depends on your specific use case.

For more information and an illustrative example, see [Account status report for declarative policies](orgs_manage_policies_declarative.md#orgs_manage_policies_declarative-account-status-report).

## Start small and then scale
<a name="bp-declarative-rules"></a>

To simplify debugging, start with a test policy. Validate the behavior and impact of each change before making the next change. This approach reduces the number of variables you have to account for when an error or unexpected result occurs.

For example, you can start with a test policy attached to a single account in a noncritical test environment. After you have confirmed that it works to your specifications, you can then incrementally move the policy up the organization structure to more accounts and more organizational units (OUs).

## Establish review processes
<a name="bp-declarative-review"></a>

Implement processes to monitor for new declarative attributes, evaluate policy exceptions, and make adjustments to maintain alignment with your organizational security and operational requirements.

## Validate changes using `DescribeEffectivePolicy`
<a name="bp-declarative-workflow"></a>

After you make a change to a declarative policy, check the effective policies for representative accounts below the level where you made the change. You can [view the effective policy by using the AWS Management Console](orgs_manage_policies_effective.md), or by using the [DescribeEffectivePolicy](https://docs.aws.amazon.com/organizations/latest/APIReference/API_DescribeEffectivePolicy.html) API operation or one of its AWS CLI or AWS SDK variants. Ensure that the change you made had the intended impact on the effective policy.

## Communicate and train
<a name="bp-declarative-train"></a>

Ensure your organizations understand the purpose and impact of your declarative policies. Provide clear guidance on the expected behaviors and how to handle failures due to policy enforcement.

# Generating the account status report for declarative policies
<a name="orgs_manage_policies_declarative_status-report"></a>

The *account status report* allows you to review the current status of all attributes supported by declarative policies for the accounts in scope. You can choose the accounts and organizational units (OUs) to include in the report scope, or choose an entire organization by selecting the root.

This report helps you assess readiness by providing a Region breakdown and if the current state of an attribute is *uniform across accounts* (through the `numberOfMatchedAccounts`) or *inconsistent* (through the `numberOfUnmatchedAccounts`). You can also see the *most frequent value*, which is the configuration value that is most frequently observed for the attribute.

The choice to attach a declarative policy for enforcing a baseline configuration depends on your specific use case.

For more information and an illustrative example, see [Account status report for declarative policies](orgs_manage_policies_declarative.md#orgs_manage_policies_declarative-account-status-report).

## Prerequisites
<a name="orgs_manage_policies_declarative_accessing-status-report-prerequisites"></a>

Before you can generate an account status report, you must perform the following steps

1. The `StartDeclarativePoliciesReport` API can only be called by the management account or delegated administrators for an organization.

1. To run reports from a delegated administrator account, the account must be registered as a delegated administrator for the EC2 service.

1. You must have an S3 bucket before generating the report (create a new one or use an existing one), it must be in the same Region in which the request is made, and it must have an appropriate S3 bucket policy. For a sample S3 policy, see *Sample Amazon S3 policy* under [Examples ](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_StartDeclarativePoliciesReport.html#API_StartDeclarativePoliciesReport_Examples) in the *Amazon EC2 API Reference* 

1. You must enable trusted access for the service where the declarative policy will enforce a baseline configuration. This creates a read-only service-linked role that is used to generate the account status report of what the existing configuration is for accounts across your organization.

   **Using the console**

   For the Organizations console, this step is a part of the process for enabling declarative policies.

   **Using the AWS CLI**

   For the AWS CLI, use the [EnableAWSServiceAccess](https://docs.aws.amazon.com/organizations/latest/APIReference/API_EnableAWSServiceAccess.html) API.

   For more information on how to enable trusted access for a specific service with the AWS CLI see, [AWS services that you can use with AWS Organizations](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_integrate_services_list.html).

1. Only one report per organization can be generated at a time. Attempting to generate a report while another is in progress will result in an error.

## Access the compliance status report
<a name="orgs_manage_policies_declarative_accessing-status-report"></a>

**Minimum permissions**  
To generate a compliance status report, you need permission to run the following actions:  
`ec2:StartDeclarativePoliciesReport`
`ec2:DescribeDeclarativePoliciesReports`
`ec2:GetDeclarativePoliciesReportSummary`
`ec2:CancelDeclarativePoliciesReport`
`organizations:DescribeAccount`
`organizations:DescribeOrganization`
`organizations:DescribeOrganizationalUnit`
`organizations:ListAccounts`
`organizations:ListDelegatedAdministrators`
`organizations:ListAWSServiceAccessForOrganization`
`s3:PutObject`

**Note**  
If your Amazon S3 bucket uses SSE-KMS encryption, you must also include the `kms:GenerateDataKey` permission in the policy.

------
#### [ AWS Management Console ]

Use the following procedure to generate an account status report.

**To generate an account status report**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **Policies** page, choose **Declarative policies for EC2**.

1. On the **Declarative policies for EC2** page, choose **View account status report** from the **Actions** dropdown menu.

1. On the **View account status report** page, choose **Generate status report**.

1. In the **Organizational structure** widget, specify which organizational units (OUs) you want to include in the report.

1. Choose **Submit**.

------
#### [ AWS CLI & AWS SDKs ]

**To generate an account status report**

Use the following operations to generate a compliance status report, check on its status, and view the report:
+ `ec2:start-declarative-policies-report`: Generates an account status report. The report is generated asynchronously, and can take several hours to complete. For more information, see [StartDeclarativePoliciesReport](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_StartDeclarativePoliciesReport.html) in the *Amazon EC2 API Reference*.
+ `ec2:describe-declarative-policies-report`: Describes the metadata of an account status report, including the state of the report. For more information, see [DescribeDeclarativePoliciesReports](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeDeclarativePoliciesReports.html) in the *Amazon EC2 API Reference*.
+ `ec2:get-declarative-policies-report-summary`: Retrieves a summary of the account status report. For more information, see [GetDeclarativePoliciesReportSummary](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_GetDeclarativePoliciesReportSummary.html) in the *Amazon EC2 API Reference*.
+ `ec2:cancel-declarative-policies-report`: Cancels the generation of an account status report. For more information, see [CancelDeclarativePoliciesReport](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CancelDeclarativePoliciesReport.html) in the *Amazon EC2 API Reference*.

Before generating a report, grant the EC2 declarative policies principal access to the Amazon S3 bucket where the report will be stored. To do this, attach the following policy to the bucket. Replace `amzn-s3-demo-bucket` with your actual Amazon S3 bucket name, and `identity_ARN` with the IAM identity used to call the `StartDeclarativePoliciesReport` API.

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "DeclarativePoliciesReportDelivery",
            "Effect": "Allow",
            "Principal": {
                "AWS": "identity_ARN"
            },
            "Action": [
                "s3:PutObject"
            ],
            "Resource": "arn:aws:s3:::amzn-s3-demo-bucket/*",
            "Condition": {
                "StringEquals": {
                    "aws:CalledViaLast": "organizations.amazonaws.com"
                }
            }
        }
    ]
}
```

------

------

# Declarative policy syntax and examples
<a name="orgs_manage_policies_declarative_syntax"></a>

This page describes declarative policy syntax and provides examples.

## Considerations
<a name="declarative-policy-syntax-considerations"></a>
+ When you configure a service attribute using a declarative policy, it might impact multiple APIs. Any noncompliant actions will fail.
+ Account administrators will not be able to modify the value of the service attribute at the individual account level.

## Syntax for declarative policies
<a name="declarative-policy-syntax-reference"></a>

A declarative policy is a plaintext file that is structured according to the rules of [JSON](http://json.org). The syntax for declarative policies follows the syntax for all management policy types. For a complete discussion of that syntax, see [Policy syntax and inheritance for management policy types](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_inheritance_mgmt.html). This topic focuses on applying that general syntax to the specific requirements of the declarative policy type.

The following example shows basic declarative policy syntax:

```
{
  "ec2_attributes": {
    "exception_message": {
      "@@assign": "Your custom error message.https://myURL"
    }
  }
}
```
+ The `ec2_attributes` field key name. Declarative policies always start with a fixed key name for the given AWS service. It's the top line in the example policy above. Currently declarative policies only supported Amazon EC2 related services.
+ Under `ec2_attributes`, you can use `exception_message` to set a custom error message. For more information, see [Custom error messages for declarative policies](orgs_manage_policies_declarative.md#orgs_manage_policies_declarative-custom-message).
+ Under `ec2_attributes`, you can insert one or more of the supported declarative policies. For those schemas, see [Supported declarative policies](#declarative-policy-examples).

## Supported declarative policies
<a name="declarative-policy-examples"></a>

The following are the AWS services and attributes that declarative policies support. In some of the following examples, the JSON whitespace formatting might be compressed to save space.
+ VPC Block Public Access
+ Serial Console Access
+ Image Block Public Access
+ Allowed Images Settings
+ Instance Metadata
+ Snapshot Block Public Access

------
#### [ VPC Block Public Access ]

**Policy effect**

Controls if resources in Amazon VPCs and subnets can reach the internet through internet gateways (IGWs). For more information, see [Configuration for internet access](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-igw-internet-access.html) in the *Amazon Virtual Private Cloud User Guide*.

**Policy contents**

```
{
  "ec2_attributes": {
    "vpc_block_public_access": {
      "internet_gateway_block": {
        "mode": {
          "@@assign": "block_ingress"
        },
        "exclusions_allowed": {
          "@@assign": "enabled"
        }
      }
    }
  }
}
```

The following are the available fields for this attribute:
+ `"internet_gateway"`:
  + `"mode"`:
    + `"off"`: VPC BPA is not enabled.
    + `"block_ingress"`: All internet traffic to the VPCs (except for VPCs or subnets which are excluded) is blocked. Only traffic to and from NAT gateways and egress-only internet gateways is allowed because these gateways only allow outbound connections to be established.
    + `"block_bidirectional"`: All traffic to and from internet gateways and egress-only internet gateways (except for excluded VPCs and subnets) is blocked.
+ `"exclusions_allowed"`: An exclusion is a mode that can be applied to a single VPC or subnet that exempts it from the account’s VPC BPA mode and will allow bidirectional or egress-only access.
  + `"enabled"`: Exclusions can be created by the account.
  + `"disabled"`: Exclusions cannot be created by the account.
**Note**  
You can use the attribute to configure if exclusions are allowed, but you cannot create exclusions with this attribute itself. To create exclusions, you must create them in the account that owns the VPC. For more information about creating VPC BPA exclusions, see [Create and delete exclusions](https://docs.aws.amazon.com//vpc/latest/userguide/security-vpc-bpa.html#security-vpc-bpa-exclusions) in the *Amazon VPC User Guide*.

**Considerations**

If you use this attribute in a declarative policy, you cannot use the following operations to modify the enforced configuration for the accounts in scope. This list is not exhaustive:
+ `ModifyVpcBlockPublicAccessOptions`
+ `CreateVpcBlockPublicAccessExclusion`
+ `ModifyVpcBlockPublicAccessExclusion`

------
#### [ Serial Console Access ]

**Policy effect**

Controls if the EC2 serial console is accessible. For more information about the EC2 serial console, see [EC2 Serial Console](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-serial-console.html) in the *Amazon Elastic Compute Cloud User Guide*.

**Policy contents**

```
{
  "ec2_attributes": {
    "serial_console_access": {
      "status": {
        "@@assign": "enabled"
      }
    }
  }
}
```

The following are the available fields for this attribute:
+ `"status"`:
  + `"enabled"`: EC2 serial console access is allowed. 
  + `"disabled"`: EC2 serial console access is blocked. 

**Considerations**

If you use this attribute in a declarative policy, you cannot use the following operations to modify the enforced configuration for the accounts in scope. This list is not exhaustive:
+ `EnableSerialConsoleAccess`
+ `DisableSerialConsoleAccess`

------
#### [ Image Block Public Access ]

**Policy effect**

Controls if Amazon Machine Images (AMIs) are publicly sharable. For more information about AMIs, see [Amazon Machine Images (AMIs)](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html) in the *Amazon Elastic Compute Cloud User Guide*.

**Policy contents**

```
{
  "ec2_attributes": {
    "image_block_public_access": {
      "state": {
        "@@assign": "block_new_sharing"
      }
    }
  }
}
```

The following are the available fields for this attribute:
+ `"state"`:
  + `"unblocked"`: No restrictions on the public sharing of AMIs.
  + `"block_new_sharing"`: Blocks new public sharing of AMIs. AMIs that were already publicly shared remain publicly available. 

**Considerations**

If you use this attribute in a declarative policy, you cannot use the following operations to modify the enforced configuration for the accounts in scope. This list is not exhaustive:
+ `EnableImageBlockPublicAccess`
+ `DisableImageBlockPublicAccess`

------
#### [ Allowed Images Settings ]

**Policy effect**

Controls the discovery and use of Amazon Machine Images (AMI) in Amazon EC2 with Allowed AMIs. For more information about AMIs, see [Control the discovery and use of AMIs in Amazon EC2 with Allowed AMIs](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-allowed-amis.html) in the *Amazon Elastic Compute Cloud User Guide*.

**Policy contents**

The following are the available fields for this attribute:

```
{
  "ec2_attributes": {
    "allowed_images_settings": {
      "state": {
        "@@assign": "enabled"
      },
      "image_criteria": {
        "criteria_1": {
          "allowed_image_providers": {
            "@@append": [
              "amazon"
            ]
          }
        }
      }
    }
  }
}
```
+ `"state"`:
  + `"enabled"`: The attribute is active and enforced.
  + `"disabled"`: The attribute is inactive and not enforced.
  + `"audit_mode"`: The attribute is in audit mode. This means it will identify noncompliant images but not block their use.
+ `"image_criteria"`: A list of criteria. Support up to 10 criteria with the name from criteria\$11 to criteria\$110
  + `"allowed_image_providers"`: A comma-separated list of 12 digit account IDs or owner alias of amazon, aws\$1marketplace, aws\$1backup\$1vault.
  + `"image_names"`: The names of the allowed images. Names can include wildcards (? and \$1). Length: 1–128 characters. With ?, the minimum is 3 characters.
  + `"marketplace_product_codes"`: The AWS Marketplace product codes for allowed images. Length: 1-25 characters Valid characters: Letters (A–Z, a–z) and numbers (0–9)
  + `"creation_date_condition"`: The maximum age for allowed images.
    + `"maximum_days_since_created"`: The maximum number of days that have elapsed since the image was created. Valid Range: Minimum value of 0. Maximum value of 2147483647.
  + `"deprecation_time_condition"`: The maximum period since deprecation for allowed images.
    + `"maximum_days_since_deprecated"`: The maximum number of days that have elapsed since the image was deprecated. Valid Range: Minimum value of 0. Maximum value of 2147483647.

**Considerations**

If you use this attribute in a declarative policy, you cannot use the following operations to modify the enforced configuration for the accounts in scope. This list is not exhaustive:
+ `EnableAllowedImagesSettings`
+ `ReplaceImageCriteriaInAllowedImagesSettings`
+ `DisableAllowedImagesSettings`

------
#### [ Instance Metadata ]

**Policy effect**

Controls IMDS defaults and IMDSv2 enforcement for all new EC2 instance launches. For more information about IMDS defaults and IMDSv2 enforcement, see [Use instance metadata to manage your EC2 instance](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html) in the *Amazon EC2 User Guide*.

**Policy contents**

The following are the available fields for this attribute:

```
{
  "ec2_attributes": {
    "instance_metadata_defaults": {
      "http_tokens": {
        "@@assign": "required"
      },
      "http_put_response_hop_limit": {
        "@@assign": "4"
      },
      "http_endpoint": {
        "@@assign": "enabled"
      },
      "instance_metadata_tags": {
        "@@assign": "enabled"
      },
      "http_tokens_enforced": {
        "@@assign": "enabled"
      }
    }
  }
}
```
+ `"http_tokens"`:
  + `"no_preference"`: Other defaults apply. For example, AMI defaults if applicable. 
  + `"required"`: IMDSv2 must be used. IMDSv1 is not allowed. 
  + `"optional"`: Both IMDSv1 and IMDSv2 are allowed.
**Note**  
**Metadata version**  
Before setting `http_tokens` to `required` (IMDSv2 must be used), make sure that none of your instances are making IMDSv1 calls. For more information, see [Step 1: Identify instances with IMDSv2=optional and audit IMDSv1 usage](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-metadata-transition-to-version-2.html#path-step-1) in the *Amazon EC2 User Guide*.
+ `"http_put_response_hop_limit"`:
  + `"Integer"`: Integer value from -1 to 64, representing the maximum number of hops the metadata token can travel. To indicate no preference, specify -1.
**Note**  
**Hop limit**  
If `http_tokens` is set to `required`, it is recommended to set `http_put_response_hop_limit` to a minimum of 2. For more information, see [Instance metadata access considerations](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html#imds-considerations) in the *Amazon Elastic Compute Cloud User Guide*.
+ `"http_endpoint"`:
  + `"no_preference"`: Other defaults apply. For example, AMI defaults if applicable. 
  + `"enabled"`: The instance metadata service endpoint is accessible.
  + `"disabled"`: The instance metadata service endpoint is not accessible.
+ `"instance_metadata_tags"`:
  + `"no_preference"`: Other defaults apply. For example, AMI defaults if applicable. 
  + `"enabled"`: Instance tags can be accessed from instance metadata. 
  + `"disabled"`: Instance tags cannot be accessed from instance metadata.
+ `"http_tokens_enforced":`
  + `"no_preference"`: Other defaults apply. For example, AMI defaults if applicable.
  + `"enabled"`: IMDSv2 must be used. Attempts to launch an IMDSv1 instance or to enable IMDSv1 on existing instances will fail.
  + `"disabled"`: Both IMDSv1 and IMDSv2 are allowed.
**Warning**  
**IMDSv2 enforcement**  
Enabling IMDSv2 enforcement while allowing IMDSv1 and IMDSv2 (token optional) will cause launch failures, unless IMDSv1 is explicitly disabled, either through launch parameters or AMI defaults. For more information, see [Launching an IMDSv1-enabled instance fails](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/troubleshooting-launch.html#launching-an-imdsv1-enabled-instance-fails) in the *Amazon EC2 User Guide*.

------
#### [ Snapshot Block Public Access ]

**Policy effect**

Controls if Amazon EBS snapshots are publicly accessible. For more information about EBS snapshots, see [Amazon EBS snapshots](https://docs.aws.amazon.com/ebs/latest/userguide/ebs-snapshots.html) in the *Amazon Elastic Block Store User Guide*.

**Policy contents**

```
{
  "ec2_attributes": {
    "snapshot_block_public_access": {
      "state": {
        "@@assign": "block_new_sharing"
      }
    }
  }
}
```

The following are the available fields for this attribute:
+ `"state"`:
  + `"block_all_sharing"`: Blocks all public sharing of snapshots. Snapshots that were already publicly shared are treated as private and are no longer publicly available. 
  + `"block_new_sharing"`: Blocks new public sharing of snapshots. Snapshots that were already publicly shared remain publicly available. 
  + `"unblocked"`: No restrictions on the public sharing of snapshots. 

**Considerations**

If you use this attribute in a declarative policy, you cannot use the following operations to modify the enforced configuration for the accounts in scope. This list is not exhaustive:
+ `EnableSnapshotBlockPublicAccess`
+ `DisableSnapshotBlockPublicAccess`

------

# Backup policies
<a name="orgs_manage_policies_backup"></a>

Backup policies allow you to centrally manage and apply backup plans to the AWS resources across an organization's accounts.

[AWS Backup](https://docs.aws.amazon.com/aws-backup/latest/devguide/) enables you to create [backup plans](https://docs.aws.amazon.com/aws-backup/latest/devguide/about-backup-plans.html) that define how to back up your AWS resources. The rules in the plan include a variety of settings, such as the backup frequency, the time window during which the backup occurs, the AWS Region containing the resources to back up and the vault in which to store the backup. You can then apply a backup plan to groups of AWS resources identified by using tags. You must also identify an AWS Identity and Access Management (IAM) role that grants AWS Backup permission to perform the backup operation on your behalf.

Backup policies in AWS Organizations combine all of those pieces into [JSON](https://json.org) text documents. You can attach a backup policy to any of the elements in your organization's structure, such as the root, organizational units (OUs), and individual accounts. Organizations applies inheritance rules to combine the policies in the organization's root, any parent OUs, or attached to the account. This results in an [effective backup policy](orgs_manage_policies_effective.md) for each account. This effective policy instructs AWS Backup how to automatically back up your AWS resources.

## How backup policies work
<a name="orgs_manage_policies_backup_how_work"></a>

Backup policies give you granular control over backing up your resources at whatever level your organization requires. For example, you can specify in a policy attached to the organization's root that all Amazon DynamoDB tables must be backed up. That policy can include a default backup frequency. You can then attach a backup policy to OUs that override the backup frequency according to the requirements of each OU. For example, the `Developers` OU might specify a backup frequency of once per week, while the `Production` OU specifies once per day.

You can create partial backup policies that individually include only part of the required information to successfully back up your resources. You can attach these policies to different parts of the organization tree, such as the root or a parent OU, with the intention of those partial policies being inherited by lower-level OUs and accounts. When Organizations combines all of the policies for an account by using inheritance rules, the resulting effective policy must have all the required elements. Otherwise, AWS Backup considers the policy not valid and does not back up the affected resources.

**Important**  
AWS Backup can only perform a successful backup when it is invoked by a *complete* effective policy that has all of the required elements.  
Although a partial policy strategy as described earlier can work, if an effective policy for an account is incomplete, it results in errors or resources that are not successfully backed up. As an alternate strategy, consider requiring that all backup policies be complete and valid by themselves. Use default values supplied by policies attached higher in the hierarchy, and override them where needed in child policies by including [inheritance child control operators](policy-operators.md).

The effective backup plan for each AWS account in the organization appears in the AWS Backup console as an immutable plan for that account. You can view it, but not change it. You can, however, add or remove backup plan tags using [TagResource ](https://docs.aws.amazon.com/aws-backup/latest/devguide/API_TagResource.html) and [UntagResource ](https://docs.aws.amazon.com/aws-backup/latest/devguide/API_UntagResource.html) APIs.

When AWS Backup begins a backup based on a policy-created backup plan, you can see the status of the backup job in the AWS Backup console. A user in a member account can see the status and any errors for the backup jobs in that member account. If you also enable trusted service access with AWS Backup, a user in the organization's management account can see the status and errors for all backup jobs in the organization. For more information, see [Enabling cross-account management](https://docs.aws.amazon.com/aws-backup/latest/devguide/manage-cross-account.html#enable-cross-account) in the *AWS Backup Developer Guide*.

# Getting started with backup policies
<a name="orgs_manage_policies-backup_getting-started"></a>

Follow these steps to get started using backup policies.

1. [Learn about the permissions you must have to perform backup policy tasks](orgs_manage_policies_prereqs.md).

1. [Learn about some best practices we recommend when using backup policies](orgs_manage_policies_backup_best-practices.md).

1. [Enable backup policies for your organization](enable-policy-type.md).

1. [Create a backup policy](orgs_policies_create.md#create-backup-policy-procedure).

1. [Attach the backup policy to your organization's root, OU, or account](orgs_policies_attach.md).

1. [View the combined effective backup policy that applies to an account](orgs_manage_policies_effective.md).

For all of these steps, you sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization's management account.

**Other information**
+ [Learn backup policy syntax and see example policies](orgs_manage_policies_backup_syntax.md)

# Best practices for using backup policies
<a name="orgs_manage_policies_backup_best-practices"></a>

AWS recommends the following best practices for using backup policies.

## Decide on a backup policy strategy
<a name="bp-bkp-cap"></a>

You can create backup policies in incomplete pieces that are inherited and merged to make a complete policy for each member account. If you do this, you risk ending up with an effective policy that is not complete if you make a change at one level without carefully considering the change's impact on all accounts below that level. To prevent this, we recommend that you instead ensure that the backup policies you implement at all levels are complete by themselves. Treat the parent policies as default policies that can be overridden by settings specified in child policies. That way, even if a child policy doesn't exist, the inherited policy is complete and uses the default values. You can control which settings can be added to, changed, or removed by child policies by using the [child control inheritance operators](policy-operators.md#child-control-operators).

## Validate changes to your backup policies checking using `GetEffectivePolicy`
<a name="bp-bkp-workflow"></a>

After you make a change to a backup policy, check the effective policies for representative accounts below the level where you made the change. You can [view the effective policy by using the AWS Management Console](orgs_manage_policies_effective.md), or by using the [GetEffectivePolicy](https://docs.aws.amazon.com/organizations/latest/APIReference/API_GetEffectivePolicy.html) API operation or one of its AWS CLI or AWS SDK variants. Ensure that the change you made had the intended impact on the effective policy.

## Start simply and make small changes
<a name="bp-bkp-rules"></a>

To simplify debugging, start with simple policies and make changes one item at a time. Validate the behavior and impact of each change before making the next change. This approach reduces the number of variables you have to account for when an error or unexpected result does happen.

## Store copies of your backups in other AWS Regions and accounts in your organization
<a name="bp-bkp-cross-account"></a>

To improve your disaster recovery position, you can store copies of your backups. 
+ **A different region** – If you store copies of the backup in additional AWS Regions, you help protect the backup against accidental corruption or deletion in the original Region. Use the `copy_actions` section of the policy to specify a vault in one or more Regions of the same account in which the backup plan runs. To do this, identify the account by using the `$account` variable when you specify the ARN of the backup vault in which to store the copy of the backup. The `$account `variable is automatically replaced at run time with the account ID in which the backup policy is running.
+ **A different account** – If you store copies of the backup in additional AWS accounts, you add a security barrier that helps protect against a malicious actor who compromises one of your accounts. Use the `copy_actions` section of the policy to specify a vault in one or more accounts in your organization, separate from the account in which the backup plan runs . To do this, identify the account by using its actual account ID number when you specify the ARN of the backup vault in which to store the copy of the backup.

## Limit the number of plans per policy
<a name="bp-bkp-educate"></a>

Policies that contain multiple plans are more complicated to troubleshoot because of the larger number of outputs that must all be validated. Instead, have each policy contain one and only one backup plan to simplify debugging and troubleshooting. You can then add additional policies with other plans to meet other requirements. This approach helps keep any issues with a plan isolated to one policy, and it prevents those issues from complicating the troubleshooting of issues with other policies and their plans.

## Use stack sets to create the required backup vaults and IAM roles
<a name="bp-bkp-compliance"></a>

Use AWS CloudFormation stack sets integration with Organizations to automatically create the required backup vaults and AWS Identity and Access Management (IAM) roles in each of the member accounts in your organization. You can create a stack set that includes the resources you want automatically available in every AWS account in your organization. This approach enables you to run your backup plans with assurance that the dependencies are already met. For more information, see [Create a Stack Set with Self-Managed Permissions](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-getting-started-create.html#create-stack-set-service-managed-permissions) in the *AWS CloudFormation User Guide*.

## Check your results by reviewing the first backup created in each account
<a name="bp-bkp-guardrails"></a>

When you make a change to a policy, check the next backup created after that change to ensure the change had the desired impact. This step goes beyond looking at the effective policy and ensures that AWS Backup interprets your policies and implements the backup plans the way you intended. 

# Using AWS CloudTrail events to monitor backup policies in your organization
<a name="orgs_manage_policies_backup_cloudtrail"></a>

You can use AWS CloudTrail events to monitor when backup policies are created, updated, or deleted from any accounts in your organization, or when there is an invalid organizational backup plan. For more information, see [Logging cross-account management events ](https://docs.aws.amazon.com/aws-backup/latest/devguide/logging-using-cloudtrail.html#logging-cam-events) in the *AWS Backup Developer Guide*.

# Backup policy syntax and examples
<a name="orgs_manage_policies_backup_syntax"></a>

This page describes backup policy syntax and provides examples.

## Syntax for backup policies
<a name="backup-policy-syntax-reference"></a>

A backup policy is a plaintext file that is structured according to the rules of [JSON](http://json.org). The syntax for backup policies follows the syntax for all management policy types. For more information, see [Policy syntax and inheritance for management policy types](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_inheritance_mgmt.html). This topic focuses on applying that general syntax to the specific requirements of the backup policy type.

For more information about AWS Backup plans, see [CreateBackupPlan](https://docs.aws.amazon.com/aws-backup/latest/devguide/API_CreateBackupPlan.html) in the *AWS Backup Developer Guide*.

## Considerations
<a name="backup-policy-syntax-considerations"></a>

**Policy syntax**

Duplicate key names will be rejected in JSON.

Policies must specify the AWS Regions and resources to be backed up.

Policies must specify the IAM role that AWS Backup assumes.

Using `@@assign` operator at the same level can overwrite existing settings. For more information, see [A child policy overrides settings in a parent policy](#backup-policy-example-5).

Inheritance operators control how inherited policies and account policies merge into the account's effective policy. These operators include value-setting operators and child control operators.

For more information, see [Inheritance operators](policy-operators.md) and [Backup policy examples](#backup-policy-examples).

**IAM roles**

The IAM role must exist when creating a backup plan for the first time.

The IAM role must have permission to access resources identified by tag query.

The IAM role must have permission to perform the backup.

**Backup vaults**

Vaults must exist in each specified AWS Regions before a backup plan can run.

Vaults must exist for each AWS account that receives the effective policy. For more information, see [Backup vault creation and deletion](https://docs.aws.amazon.com/aws-backup/latest/devguide/create-a-vault.html) in the *AWS Backup Developer Guide*.

We recommend that you use AWS CloudFormation stack sets and its integration with Organizations to automatically create and configure backup vaults and IAM roles for each member account in the organization. For more information, see [Create a stack set with self-managed permissions](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-getting-started-create.html#create-stack-set-service-managed-permissions) in the *AWS CloudFormation User Guide*.

**Quotas**

For a list of quotas see, [AWS Backup quotas](https://docs.aws.amazon.com/aws-backup/latest/devguide/aws-backup-limits.html#aws-backup-policies-quotas-table) in the *AWS Backup Developer Guide*.

## Backup syntax: Overview
<a name="backup-policy-syntax-components"></a>

Backup policy syntax includes the following components: 

```
{
    "plans": {
        "PlanName": {
            "rules": { ... },
            "regions": { ... },
            "selections": { ... },
            "advanced_backup_settings": { ... },
            "backup_plan_tags": { ... },
            "scan_settings": { ... }
        }
    }
}
```


**Backup policy elements**  

| Element | Description | Required | 
| --- | --- | --- | 
| [rules](#backup-policy-rules) | List of backup rules. Each rule defines when backups start and the execution window for the resources specified in the regions and selections elements. | Yes | 
| [regions](#backup-plan-regions) | List of AWS Regions where a backup policy can protect resources. | Yes | 
| [selections](#backup-plan-selections) | One or more resource types within the specified regions that the backup rules protect. | Yes | 
| [advanced\$1backup\$1settings](#advanced-backup-settings) | Configuration options for specific backup scenarios. Currently, the only advanced backup setting that is supported is enabling Microsoft Volume Shadow Copy Service (VSS) backups for Windows or SQL Server running on an Amazon EC2 instance. | No | 
| [backup\$1plan\$1tags](#backup-plan-tags) | Tags you want to associate with a backup plan. Each tag is a label consisting of a user-defined key and value. Tags can help you manage, identify, organize, search for, and filter your backup plans. | No | 
| [scan\$1settings](#scan-settings) | Configuration options for scan settings. Currently the only scan settings that is support is enable Amazon GuardDuty Malware Protection for AWS Backup. | No | 

## Backup syntax: rules
<a name="backup-policy-rules"></a>

The `rules` policy key specifies the scheduled backup tasks that AWS Backup performs on the selected resources.


**Backup rule elements**  

| Element | Description | Required | 
| --- | --- | --- | 
| schedule\$1expression | Cron expression in UTC that specifies when AWS Backup initiates a backup job. For information about cron expression, see [Using cron and rate expressions to schedule rules](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-scheduled-rule-pattern.html) in the *Amazon EventBridge User Guide*. | Yes | 
| target\$1backup\$1vault\$1name | Backup vault where backups are stored. Backup vaults are identified by names that are unique to the account used to create them and the AWS Region where they are created. | Yes | 
| target\$1logically\$1air\$1gapped\$1backup\$1vault\$1arn | Logically air-gapped vault ARN where backups are stored. If provided, supported fully managed resources back up directly to logically air-gapped vault, while other supported resources create a temporary (billable) snapshot in backup vault, then copy it to logically air-gapped vault. Unsupported resources only back up to the specified backup vault. The ARN must use the special placeholders `$region` and `$account`. For example, for a vault named `AirGappedVault` the correct value is `arn:aws:backup:$region:$account:backup-vault:AirGappedVault`. | No | 
| start\$1backup\$1window\$1minutes | Number of minutes to wait before canceling a backup job will be canceled if it doesn't start successfully. If this value is included, it must be at least 60 minutes to avoid errors. | No | 
| complete\$1backup\$1window\$1minutes | Nnumber of minutes after a backup job is successfully started before it must be completed or it will be canceled by AWS Backup. | No | 
| enable\$1continuous\$1backup | Specifies whether AWS Backup creates continuous backups. `True` causes AWS Backup to create continuous backups capable of point-in-time restore (PITR). `False` (or not specified) causes AWS Backup to create snapshot backups. For more information about continuous backups, see [Point-in-time recovery](https://docs.aws.amazon.com/aws-backup/latest/devguide/point-in-time-recovery.html) in the *AWS Backup Developer Guide*. **Note:** PITR-enabled backups have 35-day maximum retention. | No | 
| lifecycle | Specifies when AWS Backup transitions a backup to cold storage and when it expires. Resource types that can transition to cold storage are listed in the Feature availability by resource table [Feature availability by resources](https://docs.aws.amazon.com/aws-backup/latest/devguide/backup-feature-availability.html#features-by-resource) in the *AWS Backup Developer Guide*. Each lifecycle contains the following elements: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_backup_syntax.html) **Note**: Backups transitioned to cold storage must be stored in cold storage for a minimum of 90 days. This means that the `delete_after_days` must be 90 days greater than `move_to_cold_storage_after_days`.  | No | 
| copy\$1actions | Specifies whether AWS Backup copies a backup to one or more additional locations. Each copy action contains the following elements: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_backup_syntax.html) **Note**: Backups transitioned to cold storage must be stored in cold storage for a minimum of 90 days. This means that the `delete_after_days` must be 90 days greater than `move_to_cold_storage_after_days`.  | No | 
| recovery\$1point\$1tags | Tags that you want to assigned to resources that are restored from backup. Each tag contains the following elements: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_backup_syntax.html) | No | 
| index\$1actions | Specifies whether AWS Backup creates a backup index of your Amazon EBS snapshots and/or Amazon S3 backups. Backup indexes are created in order to search the metadata of your backups. For more information about backup index creation and backup search, see [Backup search](https://docs.aws.amazon.com//aws-backup/latest/devguide/backup-search.html#backup-search-overview). **Note:** Additional [IAM role permissions](https://docs.aws.amazon.com//aws-backup/latest/devguide/backup-search.html#backup-search-access) are required for Amazon EBS snapshot backup index creation. Each index action contains the following element: `resource_types` where resource types supported for indexing are Amazon EBS and Amazon S3. This parameter specifies which resource type will be opted into indexing.  | No | 
| scan\$1actions | Specifies whether a scanning action is enabled for a given rule. You must specify a `ScanMode`. You must use `scan_settings` in the backup policy elements in conjunction with `scan_actions` in order for scanning jobs to start successfully. Please also ensure you have the right [IAM role permissions](https://docs.aws.amazon.com//aws-backup/latest/devguide/malware-protection.html#malware-access). [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_backup_syntax.html) | No | 

## Backup syntax: regions
<a name="backup-plan-regions"></a>

The `regions` policy key specifies which AWS Regions that AWS Backup looks in to find the resources that match the conditions in the `selections` key.


**Backup regions elements**  

| Element | Description | Required | 
| --- | --- | --- | 
| regions | Specifies the AWS Region codes. For example: `["us-east-1", "eu-north-1"]`. | Yes | 

## Backup syntax: selections
<a name="backup-plan-selections"></a>

The `selections` policy key specifies the resources that are backed up by the rules in a backup policy.

There are two mutually exclusive elements: `tags` and `resources`. An effective policy **must** `have` either tags or `resources` in the selection to be valid.

If you want a selection with both tag conditions and resource conditions, use the `resources` keys.


**Backup selection elements: Tags**  

| Element | Description | Required | 
| --- | --- | --- | 
| iam\$1role\$1arn | IAM role that AWS Backup assumes to query, discover, and backup resources across the specified Regions. The role must have sufficient permissions to query resources based on tag conditions and perform backup operations on the matched resources.  | Yes | 
| tag\$1key | Tag key name to search for. | Yes | 
| tag\$1value | Value that must be associated with the matching tag\$1key. AWS Backup includes the resource only if both tag\$1key and tag\$1value match (case sensitive). | Yes | 
| conditions | Tag keys and values you want to include or exclude Use string\$1equals or string\$1not\$1equals to include or exclude tags of an exact match. Use string\$1like and string\$1not\$1like to include or exclude tags that contains or do not contain specific characters **Note:** Limited to 30 conditions for each selection. | No | 


**Backup selection elements: Resources**  

| Element | Description | Required | 
| --- | --- | --- | 
| iam\$1role\$1arn | IAM role that AWS Backup assumes to query, discover, and backup resources across the specified Regions. The role must have sufficient permissions to query resources based on tag conditions and perform backup operations on the matched resources. **Note:** In AWS GovCloud (US) Regions, you must add the name of the partition to the ARN. For example, "`arn:aws:ec2:*:*:volume/*`" must be "`arn:aws-us-gov:ec2:*:*:volume/*`". | Yes | 
| resource\$1types | Resource types to include in a backup plan. | Yes | 
| not\$1resource\$1types | Resource types to exclude from a backup plan. | No | 
| conditions | Tag keys and values you want to include or exclude Use string\$1equals or string\$1not\$1equals to include or exclude tags of an exact match. Use string\$1like and string\$1not\$1like to include or exclude tags that contains or do not contain specific characters **Note:** Limited to 30 conditions for each selection. | No | 

**Supported resource types**

Organizations supports the following resource types for the `resource_types` and `not_resource_types` elements:
+ AWS Backup gateway virtual machines: `"arn:aws:backup-gateway:*:*:vm/*"` 
+ AWS CloudFormation stacks: `"arn:aws:cloudformation:*:*:stack/*"` 
+ Aurora DSQL clusters: `"arn:aws:dsql:*:*:cluster/*"` 
+ Amazon DynamoDB tables: `"arn:aws:dynamodb:*:*:table/*"` 
+ Amazon EC2 instances: `"arn:aws:ec2:*:*:instance/*"` 
+ Amazon EBS volumes: `"arn:aws:ec2:*:*:volume/*"` 
+ Amazon EFS file systems: `"arn:aws:elasticfilesystem:*:*:file-system/*"` 
+ Amazon Aurora/Amazon DocumentDB/Amazon Neptune clusters: `"arn:aws:rds:*:*:cluster:*"` 
+ Amazon RDS databases: `"arn:aws:rds:*:*:db:*"` 
+ Amazon Redshift clusters: `"arn:aws:redshift:*:*:cluster:*"` 
+ Amazon Redshift Serverless namespaces: `"arn:aws:redshift-serverless:*:*:namespace/*"` 
+ Amazon S3: `"arn:aws:s3:::*"` 
+ AWS Systems Manager for SAP HANA databases: `"arn:aws:ssm-sap:*:*:HANA/*"` 
+ AWS Storage Gateway gateways: `"arn:aws:storagegateway:*:*:gateway/*"` 
+ Amazon Timestream databases: `"arn:aws:timestream:*:*:database/*"` 
+ Amazon FSx file systems: `"arn:aws:fsx:*:*:file-system/*"` 
+ Amazon FSx volumes: `"arn:aws:fsx:*:*:volume/*"` 
+ Amazon Elastic Kubernetes Service volumes: `"arn:aws:eks:*:*:cluster/*"` 

**Code examples**

For more information, see [Specifying resources with the tags block](#backup-policy-example-6) and [Specifying resources with the resources block](#backup-policy-example-7).

## Backup syntax: advanced backup settings
<a name="advanced-backup-settings"></a>

The `advanced_backup_settings` key specifies the configuration options for specific backup scenarios. Each setting contains the following elements:


**Advanced backup settings elements**  

| Element | Description | Required | 
| --- | --- | --- | 
| advanced\$1backup\$1settings | Specifies settings for specific backup scenarios. This key contains one or more settings. Each setting is a JSON object string with the following elements: Currently the only advanced backup setting that is supported is enabling Microsoft Volume Shadow Copy Service (VSS) backups for Windows or SQL Server running on an Amazon EC2 instance. Each advanced backup setting the following elements: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_backup_syntax.html)  | No | 

**Example:**

```
"advanced_backup_settings": {
    "ec2": { 
        "windows_vss": {
            "@@assign": "enabled" 
        }
    }
},
```

## Backup syntax: backup plan tags
<a name="backup-plan-tags"></a>

The `backup_plan_tags` policy key specifies the tags that are attached to a backup plan itself. This does not impact the tags specified for `rules` or `selections`.


**Backup plan tag elements**  

| Element | Description | Required | 
| --- | --- | --- | 
| backup\$1plan\$1tags | Each tag is a label consisting of a user-defined key and value: [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_backup_syntax.html) | No | 

## Backup syntax: scan settings
<a name="scan-settings"></a>

The `scan_settings` policy key specifies the configuration for malware scanning using Amazon GuardDuty Malware Protection for AWS Backup. You must use `scan_settings` in conjunction with `scan_actions` in your backup rules for scanning jobs to start successfully.


**Scan settings elements**  

| Element | Description | Required | 
| --- | --- | --- | 
| scan\$1settings | Configuration options for scan settings. Currently the only scan settings that is supported is enabling Amazon GuardDuty Malware Protection for AWS Backup. You must specify the `ResourceTypes` and `ScannerRoleArn`.  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_backup_syntax.html) | No | 

**Example:**

The following shows how to configure `scan_actions` in a backup rule and `scan_settings` at the plan level to enable Amazon GuardDuty Malware Protection scanning.

`scan_actions` in a rule:

```
"scan_actions": {
    "GUARDDUTY": {
        "scan_mode": {
            "@@assign": "INCREMENTAL_SCAN"
        }
    }
}
```

`scan_settings` at the plan level:

```
"scan_settings": {
    "GUARDDUTY": {
        "resource_types": {
            "@@assign": ["EBS"]
        },
        "scanner_role_arn": {
            "@@assign": "arn:aws:iam::$account:role/MyGuardDutyScannerRole"
        }
    }
}
```

## Backup policy examples
<a name="backup-policy-examples"></a>

The example backup policies that follow are for information purposes only. In some of the following examples, the JSON whitespace formatting might be compressed to save space.
+ [Example 1: Policy assigned to a parent node](#backup-policy-example-1)
+ [Example 2: A parent policy is merged with a child policy](#backup-policy-example-2)
+ [Example 3: A parent policy prevents any changes by a child policy](#backup-policy-example-3)
+ [Example 4: A parent policy prevents changes to one backup plan by a child policy](#backup-policy-example-4)
+ [Example 5: A child policy overrides settings in a parent policy](#backup-policy-example-5)
+ [Example 6: Specifying resources with the tags block](#backup-policy-example-6)
+ [Example 7: Specifying resources with the resources block](#backup-policy-example-7)
+ [Example 8: Backup plan with Amazon GuardDuty Malware Protection scanning](#backup-policy-example-8)

### Example 1: Policy assigned to a parent node
<a name="backup-policy-example-1"></a>

The following example shows a backup policy that is assigned to one of the parent nodes of an account.

**Parent policy** – This policy can be attached to the organization's root, or to any OU that is a parent of all of the intended accounts.

```
{
    "plans": {
        "PII_Backup_Plan": {
            "regions": {
                "@@assign": [
                    "ap-northeast-2",
                    "us-east-1",
                    "eu-north-1"
                ]
            },
            "rules": {
                "Hourly": {
                    "schedule_expression": {
                        "@@assign": "cron(0 5/1 ? * * *)"
                    },
                    "start_backup_window_minutes": {
                        "@@assign": "480"
                    },
                    "complete_backup_window_minutes": {
                        "@@assign": "10080"
                    },
                    "lifecycle": {
                        "move_to_cold_storage_after_days": {
                            "@@assign": "180"
                        },
                        "delete_after_days": {
                            "@@assign": "270"
                        },
                        "opt_in_to_archive_for_supported_resources": {
                            "@@assign": "false"
                        }
                    },
                    "target_backup_vault_name": {
                        "@@assign": "FortKnox"
                    },
                    "target_logically_air_gapped_backup_vault_arn": {
                        "@@assign": "arn:aws:backup:$region:$account:backup-vault:AirGappedVault"
                    },
                    "index_actions": {
                        "resource_types": {
                            "@@assign": [
                                "EBS",
                                "S3"
                            ]
                        }
                     },
                    "copy_actions": {
                        "arn:aws:backup:us-east-1:$account:backup-vault:secondary_vault": {
                            "target_backup_vault_arn": {
                                "@@assign": "arn:aws:backup:us-east-1:$account:backup-vault:secondary_vault"
                            },
                            "lifecycle": {
                                "move_to_cold_storage_after_days": {
                                    "@@assign": "30"
                                },
                                "delete_after_days": {
                                    "@@assign": "120"
                                },
                                "opt_in_to_archive_for_supported_resources": {
                                    "@@assign": "false"
                                }
                            }
                        },
                        "arn:aws:backup:us-west-1:111111111111:backup-vault:tertiary_vault": {
                            "target_backup_vault_arn": {
                                "@@assign": "arn:aws:backup:us-west-1:111111111111:backup-vault:tertiary_vault"
                            },
                            "lifecycle": {
                                "move_to_cold_storage_after_days": {
                                    "@@assign": "30"
                                },
                                "delete_after_days": {
                                    "@@assign": "120"
                                },
                                "opt_in_to_archive_for_supported_resources": {
                                    "@@assign": "false"
                                }
                            }
                        } 
                    }
                }
            },
            "selections": {
                "tags": {
                    "datatype": {
                        "iam_role_arn": {
                            "@@assign": "arn:aws:iam::$account:role/MyIamRole"
                        },
                        "tag_key": {
                            "@@assign": "dataType"
                        },
                        "tag_value": {
                            "@@assign": [
                                "PII",
                                "RED"
                            ]
                        }
                    }
                }
            },
            "advanced_backup_settings": {
                "ec2": {
                    "windows_vss": {
                        "@@assign": "enabled"
                    }
                }
            }
        }
    }
}
```

If no other policies are inherited or attached to the accounts, the effective policy rendered in each applicable AWS account looks like the following example. The CRON expression causes the backup to run once an hour on the hour. The account ID 123456789012 will be the actual account ID for each account.

```
{
    "plans": {
        "PII_Backup_Plan": {
            "regions": [
                "us-east-1",
                "ap-northeast-3",
                "eu-north-1"
            ],
            "rules": {
                "hourly": {
                    "schedule_expression": "cron(0 0/1 ? * * *)",
                    "start_backup_window_minutes": "60",
                    "target_backup_vault_name": "FortKnox",
                    "target_logically_air_gapped_backup_vault_arn": "arn:aws:backup:$region:$account:backup-vault:AirGappedVault",
                    "index_actions": {
                        "resource_types": {
                            "@@assign": [
                                "EBS",
                                "S3"
                            ]
                        }
                     },
                    "lifecycle": {
                        "delete_after_days": "2",
                        "move_to_cold_storage_after_days": "180",
                        "opt_in_to_archive_for_supported_resources": "false"
                    },
                    "copy_actions": {
                        "arn:aws:backup:us-east-1:$account:backup-vault:secondary_vault": {
                            "target_backup_vault_arn": {
                                "@@assign": "arn:aws:backup:us-east-1:$account:backup-vault:secondary_vault"
                            },
                            "lifecycle": {
                                "delete_after_days": "28",
                                "move_to_cold_storage_after_days": "180",
                                "opt_in_to_archive_for_supported_resources": "false"
                            }
                        },
                        "arn:aws:backup:us-west-1:111111111111:backup-vault:tertiary_vault": {
                            "target_backup_vault_arn": {
                                "@@assign": "arn:aws:backup:us-west-1:111111111111:backup-vault:tertiary_vault"
                            },
                            "lifecycle": {
                                "delete_after_days": "28",
                                "move_to_cold_storage_after_days": "180",
                                "opt_in_to_archive_for_supported_resources": "false"
                            }
                        }
                    }
                }
            },
            "selections": {
                "tags": {
                    "datatype": {
                        "iam_role_arn": "arn:aws:iam::123456789012:role/MyIamRole",
                        "tag_key": "dataType",
                        "tag_value": [
                            "PII",
                            "RED"
                        ]
                    }
                }
            },
            "advanced_backup_settings": {
                "ec2": {
                    "windows_vss": "enabled"
                }
            }
        }
    }
}
```

### Example 2: A parent policy is merged with a child policy
<a name="backup-policy-example-2"></a>

In the following example, an inherited parent policy and a child policy either inherited or directly attached to an AWS account merge to form the effective policy. 

**Parent policy** – This policy can be attached to the organization's root or to any parent OU.

```
{
    "plans": {
       "PII_Backup_Plan": {
            "regions": { "@@append":[ "us-east-1", "ap-northeast-3", "eu-north-1" ] },
            "rules": {
                "Hourly": {
                    "schedule_expression": { "@@assign": "cron(0 0/1 ? * * *)" },
                    "start_backup_window_minutes": { "@@assign": "60" },
                    "target_backup_vault_name": { "@@assign": "FortKnox" },
                    "index_actions": {
                        "resource_types": {
                            "@@assign": [
                                "EBS",
                                "S3"
                            ]
                        }
                     },
                    "lifecycle": {
                        "move_to_cold_storage_after_days": { "@@assign": "28" },
                        "delete_after_days": { "@@assign": "180" },
                        "opt_in_to_archive_for_supported_resources": { "@@assign": "false" }
                    },
                    "copy_actions": {
                        "arn:aws:backup:us-east-1:$account:backup-vault:secondary_vault" : {
                            "target_backup_vault_arn" : {
                                "@@assign" : "arn:aws:backup:us-east-1:$account:backup-vault:secondary_vault"
                            },
                            "lifecycle": {
                                "move_to_cold_storage_after_days": { "@@assign": "28" },
                                "delete_after_days": { "@@assign": "180" },
                                "opt_in_to_archive_for_supported_resources": { "@@assign": "false" }
                            }
                        }
                    }
                }
            },
            "selections": {
                "tags": {
                    "datatype": {
                        "iam_role_arn": { "@@assign": "arn:aws:iam::$account:role/MyIamRole" },
                        "tag_key": { "@@assign": "dataType" },
                        "tag_value": { "@@assign": [ "PII", "RED" ] }
                    }
                }
            }
        }
    }
}
```

**Child policy** – This policy can be attached directly to the account or to an OU any level below the one the parent policy is attached to.

```
{
    "plans": {
       "Monthly_Backup_Plan": {
            "regions": {
                "@@append":[ "us-east-1", "eu-central-1" ] },
            "rules": {
                "Monthly": {
                    "schedule_expression": { "@@assign": "cron(0 5 1 * ? *)" },
                    "start_backup_window_minutes": { "@@assign": "480" },
                    "target_backup_vault_name": { "@@assign": "Default" },
                    "lifecycle": {
                        "move_to_cold_storage_after_days": { "@@assign": "30" },
                        "delete_after_days": { "@@assign": "365" },
                        "opt_in_to_archive_for_supported_resources": { "@@assign": "false" }
                    },
                    "copy_actions": {
                        "arn:aws:backup:us-east-1:$account:backup-vault:Default" : {
                            "target_backup_vault_arn" : {
                                "@@assign" : "arn:aws:backup:us-east-1:$account:backup-vault:Default"
                            },
                            "lifecycle": { 
                                "move_to_cold_storage_after_days": { "@@assign": "30" },
                                "delete_after_days": { "@@assign": "365" },
                                "opt_in_to_archive_for_supported_resources": { "@@assign": "false" }
                            }
                        }
                    }
                }
            },
            "selections": {
                "tags": {
                    "MonthlyDatatype": {
                        "iam_role_arn": { "@@assign": "arn:aws:iam::$account:role/MyMonthlyBackupIamRole" },
                        "tag_key": { "@@assign": "BackupType" },
                        "tag_value": { "@@assign": [ "MONTHLY", "RED" ] }
                    }
                }
            }
        }
    }
}
```

**Resulting effective policy** – The effective policy applied to the accounts contains two plans, each with its own set of rules and set of resources to apply the rules to. 

```
{
    "plans": {
       "PII_Backup_Plan": {
            "regions": [ "us-east-1", "ap-northeast-3", "eu-north-1" ],
            "rules": {
                "hourly": {
                    "schedule_expression": "cron(0 0/1 ? * * *)",
                    "start_backup_window_minutes": "60",
                    "target_backup_vault_name": "FortKnox",
                    "index_actions": {
                        "resource_types": {
                            "@@assign": [
                                "EBS",
                                "S3"
                            ]
                        }
                     },
                    "lifecycle": {
                        "delete_after_days": "2",
                        "move_to_cold_storage_after_days": "180",
                        "opt_in_to_archive_for_supported_resources": { "@@assign": "false" }
                    },
                    "copy_actions": {
                        "arn:aws:backup:us-east-1:$account:backup-vault:secondary_vault" : {
                            "target_backup_vault_arn" : {
                                "@@assign" : "arn:aws:backup:us-east-1:$account:backup-vault:secondary_vault"
                            },
                            "lifecycle": {
                                "move_to_cold_storage_after_days": "28",
                                "delete_after_days": "180",
                                "opt_in_to_archive_for_supported_resources": { "@@assign": "false" }
                            }
                        }
                    }
                }
            },
            "selections": {
                "tags": {
                    "datatype": {
                        "iam_role_arn": "arn:aws:iam::$account:role/MyIamRole",
                        "tag_key": "dataType",
                        "tag_value": [ "PII", "RED" ]
                    }
                }
            }
        },
        "Monthly_Backup_Plan": {
            "regions": [ "us-east-1", "eu-central-1" ],
            "rules": {
                "monthly": {
                    "schedule_expression": "cron(0 5 1 * ? *)",
                    "start_backup_window_minutes": "480",
                    "target_backup_vault_name": "Default",
                    "lifecycle": {
                        "delete_after_days": "365",
                        "move_to_cold_storage_after_days": "30",
                        "opt_in_to_archive_for_supported_resources": { "@@assign": "false" }
                    },
                    "copy_actions": {
                        "arn:aws:backup:us-east-1:$account:backup-vault:Default" : {
                            "target_backup_vault_arn": {
                                "@@assign" : "arn:aws:backup:us-east-1:$account:backup-vault:Default"
                            },
                            "lifecycle": {
                                "move_to_cold_storage_after_days": "30",
                                "delete_after_days": "365",
                                "opt_in_to_archive_for_supported_resources": { "@@assign": "false" }
                            }
                        }
                    }
                }
            },
            "selections": {
                "tags": {
                    "monthlydatatype": {
                        "iam_role_arn": "arn:aws:iam::&ExampleAWSAccountNo3;:role/MyMonthlyBackupIamRole",
                        "tag_key": "BackupType",
                        "tag_value": [ "MONTHLY", "RED" ]
                    }
                }
            }
        }
    }
}
```

### Example 3: A parent policy prevents any changes by a child policy
<a name="backup-policy-example-3"></a>

In the following example, an inherited parent policy uses the [child control operators](policy-operators.md#child-control-operators) to enforce all settings and prevents them from being changed or overridden by a child policy. 

**Parent policy** – This policy can be attached to the organization's root or to any parent OU. The presence of `"@@operators_allowed_for_child_policies": ["@@none"]` at every node of the policy means that a child policy can't make changes of any kind to the plan. Nor can a child policy add additional plans to the effective policy. This policy becomes the effective policy for every OU and account under the OU to which it is attached.

```
{
    "plans": {
        "@@operators_allowed_for_child_policies": ["@@none"],
        "PII_Backup_Plan": {
            "@@operators_allowed_for_child_policies": ["@@none"],
            "regions": {
                "@@operators_allowed_for_child_policies": ["@@none"],
                "@@append": [
                    "us-east-1",
                    "ap-northeast-3",
                    "eu-north-1"
                ]
            },
            "rules": {
                "@@operators_allowed_for_child_policies": ["@@none"],
                "Hourly": {
                    "@@operators_allowed_for_child_policies": ["@@none"],
                    "schedule_expression": {
                        "@@operators_allowed_for_child_policies": ["@@none"],
                        "@@assign": "cron(0 0/1 ? * * *)"
                    },
                    "start_backup_window_minutes": {
                        "@@operators_allowed_for_child_policies": ["@@none"],
                        "@@assign": "60"
                    },
                    "target_backup_vault_name": {
                        "@@operators_allowed_for_child_policies": ["@@none"],
                        "@@assign": "FortKnox"
                    },
                    "index_actions": {
                       "@@operators_allowed_for_child_policies": ["@@none"],
                        "resource_types": {
                            "@@assign": [
                                "EBS",
                                "S3"
                            ]
                        }
                     },
                    "lifecycle": {
                        "@@operators_allowed_for_child_policies": ["@@none"],
                        "move_to_cold_storage_after_days": {
                            "@@operators_allowed_for_child_policies": ["@@none"],
                            "@@assign": "28"
                        },
                        "delete_after_days": {
                            "@@operators_allowed_for_child_policies": ["@@none"],
                            "@@assign": "180"
                        },
                        "opt_in_to_archive_for_supported_resources": {
                            "@@operators_allowed_for_child_policies": ["@@none"],
                            "@@assign": "false"
                        }
                    },
                    "copy_actions": {
                        "@@operators_allowed_for_child_policies": ["@@none"],
                        "arn:aws:backup:us-east-1:$account:backup-vault:secondary_vault": {
                            "@@operators_allowed_for_child_policies": ["@@none"],
                            "target_backup_vault_arn": {
                                "@@assign": "arn:aws:backup:us-east-1:$account:backup-vault:secondary_vault",
                                "@@operators_allowed_for_child_policies": ["@@none"]
                            },
                            "lifecycle": {
                                "@@operators_allowed_for_child_policies": ["@@none"],
                                "delete_after_days": {
                                    "@@operators_allowed_for_child_policies": ["@@none"],
                                    "@@assign": "28"
                                },
                                "move_to_cold_storage_after_days": {
                                    "@@operators_allowed_for_child_policies": ["@@none"],
                                    "@@assign": "180"
                                },
                                 "opt_in_to_archive_for_supported_resources": {
                                    "@@operators_allowed_for_child_policies": ["@@none"],
                                    "@@assign": "false"
                                }
                            }
                        }
                    }
                }
            },
            "selections": {
                "@@operators_allowed_for_child_policies": ["@@none"],
                "tags": {
                    "@@operators_allowed_for_child_policies": ["@@none"],
                    "datatype": {
                        "@@operators_allowed_for_child_policies": ["@@none"],
                        "iam_role_arn": {
                            "@@operators_allowed_for_child_policies": ["@@none"],
                            "@@assign": "arn:aws:iam::$account:role/MyIamRole"
                        },
                        "tag_key": {
                            "@@operators_allowed_for_child_policies": ["@@none"],
                            "@@assign": "dataType"
                        },
                        "tag_value": {
                            "@@operators_allowed_for_child_policies": ["@@none"],
                            "@@assign": [
                                "PII",
                                "RED"
                            ]
                        }
                    }
                }
            },
            "advanced_backup_settings": {
                "@@operators_allowed_for_child_policies": ["@@none"],
                "ec2": {
                    "@@operators_allowed_for_child_policies": ["@@none"],
                    "windows_vss": {
                        "@@assign": "enabled",
                        "@@operators_allowed_for_child_policies": ["@@none"]
                    }
                }
            }
        }
    }
}
```

**Resulting effective policy** – If any child backup policies exist, they are ignored and the parent policy becomes the effective policy.

```
{
    "plans": {
        "PII_Backup_Plan": {
            "regions": [
                "us-east-1",
                "ap-northeast-3",
                "eu-north-1"
            ],
            "rules": {
                "hourly": {
                    "schedule_expression": "cron(0 0/1 ? * * *)",
                    "start_backup_window_minutes": "60",
                    "target_backup_vault_name": "FortKnox",
                    "index_actions": {
                        "resource_types": {
                            "@@assign": [
                                "EBS",
                                "S3"
                            ]
                        }
                     },
                    "lifecycle": {
                        "delete_after_days": "2",
                        "move_to_cold_storage_after_days": "180",
                        "opt_in_to_archive_for_supported_resources": "false"
                    },
                    "copy_actions": {
                        "target_backup_vault_arn": "arn:aws:backup:us-east-1:123456789012:backup-vault:secondary_vault",
                        "lifecycle": {
                            "move_to_cold_storage_after_days": "28",
                            "delete_after_days": "180",
                            "opt_in_to_archive_for_supported_resources": "false"
                        }
                    }
                }
            },
            "selections": {
                "tags": {
                    "datatype": {
                        "iam_role_arn": "arn:aws:iam::123456789012:role/MyIamRole",
                        "tag_key": "dataType",
                        "tag_value": [
                            "PII",
                            "RED"
                        ]
                    }
                }
            },
            "advanced_backup_settings": {
                "ec2": {"windows_vss": "enabled"}
            }
        }
    }
}
```

### Example 4: A parent policy prevents changes to one backup plan by a child policy
<a name="backup-policy-example-4"></a>

In the following example, an inherited parent policy uses the [child control operators](policy-operators.md#child-control-operators) to enforce the settings for a single plan and prevents them from being changed or overridden by a child policy. The child policy can still add additional plans.

**Parent policy** – This policy can be attached to the organization's root or to any parent OU. This example is similar to the previous example with all child inheritance operators blocked, except at the `plans` top level. The `@@append` setting at that level enables child policies to add other plans to the collection in the effective policy. Any changes to the inherited plan are still blocked.

The sections in the plan are truncated for clarity.

```
{
    "plans": {
        "@@operators_allowed_for_child_policies": ["@@append"],
        "PII_Backup_Plan": {
            "@@operators_allowed_for_child_policies": ["@@none"],
            "regions": { ... },
            "rules": { ... },
            "selections": { ... }
        }
    }
}
```

**Child policy** – This policy can be attached directly to the account or to an OU any level below the one the parent policy is attached to. This child policy defines a new plan.

The sections in the plan are truncated for clarity.

```
{
    "plans": {
        "MonthlyBackupPlan": {
            "regions": { ... },
            "rules": { ... },
            "selections": { … }
        }
    }
}
```

**Resulting effective policy** – The effective policy includes both plans.

```
{
    "plans": {
        "PII_Backup_Plan": {
            "regions": { ... },
            "rules": { ... },
            "selections": { ... }
        },
        "MonthlyBackupPlan": {
            "regions": { ... },
            "rules": { ... },
            "selections": { … }
        }
    }
}
```

### Example 5: A child policy overrides settings in a parent policy
<a name="backup-policy-example-5"></a>

In the following example, a child policy uses [value-setting operators](policy-operators.md#value-setting-operators) to override some of the settings inherited from a parent policy.

**Parent policy** – This policy can be attached to the organization's root or to any parent OU. Any of the settings can be overridden by a child policy because the default behavior, in the absence of a [child-control operator](policy-operators.md#child-control-operators) that prevents it, is to allow the child policy to `@@assign`, `@@append`, or `@@remove`. The parent policy contains all of the required elements for a valid backup plan, so it backs up your resources successfully if it is inherited as is.

```
{
    "plans": {
        "PII_Backup_Plan": {
            "regions": {
                "@@append": [
                    "us-east-1",
                    "ap-northeast-3",
                    "eu-north-1"
                ]
            },
            "rules": {
                "Hourly": {
                    "schedule_expression": {"@@assign": "cron(0 0/1 ? * * *)"},
                    "start_backup_window_minutes": {"@@assign": "60"},
                    "target_backup_vault_name": {"@@assign": "FortKnox"},
                    "index_actions": {
                        "resource_types": {
                            "@@assign": [
                                "EBS",
                                "S3"
                            ]
                        }
                     },
                    "lifecycle": {
                        "delete_after_days": {"@@assign": "2"},
                        "move_to_cold_storage_after_days": {"@@assign": "180"},
                        "opt_in_to_archive_for_supported_resources": {"@@assign": false}
                    },
                    "copy_actions": {
                        "arn:aws:backup:us-east-1:$account:backup-vault:t2": {
                            "target_backup_vault_arn": {"@@assign": "arn:aws:backup:us-east-1:$account:backup-vault:t2"},
                            "lifecycle": {
                                "move_to_cold_storage_after_days": {"@@assign": "28"},
                                "delete_after_days": {"@@assign": "180"},
                                "opt_in_to_archive_for_supported_resources": {"@@assign": false}
                            }
                        }
                    }
                }
            },
            "selections": {
                "tags": {
                    "datatype": {
                        "iam_role_arn": {"@@assign": "arn:aws:iam::$account:role/MyIamRole"},
                        "tag_key": {"@@assign": "dataType"},
                        "tag_value": {
                            "@@assign": [
                                "PII",
                                "RED"
                            ]
                        }
                    }
                }
            }
        }
    }
}
```

**Child policy** – The child policy includes only the settings that need to be different from the inherited parent policy. There must be an inherited parent policy that provides the other required settings when merged into an effective policy. Otherwise, the effective backup policy contains a backup plan that is not valid and doesn't back up your resources as expected.

```
{
    "plans": {
        "PII_Backup_Plan": {
            "regions": {
                "@@assign": [
                    "us-west-2",
                    "eu-central-1"
                ]
            },
            "rules": {
                "Hourly": {
                    "schedule_expression": {"@@assign": "cron(0 0/2 ? * * *)"},
                    "start_backup_window_minutes": {"@@assign": "80"},
                    "target_backup_vault_name": {"@@assign": "Default"},
                    "lifecycle": {
                        "move_to_cold_storage_after_days": {"@@assign": "30"},
                        "delete_after_days": {"@@assign": "365"},
                        "opt_in_to_archive_for_supported_resources": {"@@assign": false}
                    }
                }
            }
        }
    }
}
```

**Resulting effective policy** – The effective policy includes settings from both policies, with the settings provided by the child policy overriding the settings inherited from the parent. In this example, the following changes occur:
+ The list of Regions is replaced with a completely different list. If you wanted to add a Region to the inherited list, use `@@append` instead of `@@assign` in the child policy.
+ AWS Backup performs every other hour instead of hourly.
+ AWS Backup allows 80 minutes for the backup to start instead of 60 minutes. 
+ AWS Backup uses the `Default` vault instead of `FortKnox`.
+ The lifecycle is extended for both the transfer to cold storage and the eventual deletion of the backup.

```
{
    "plans": {
        "PII_Backup_Plan": {
            "regions": [
                "us-west-2",
                "eu-central-1"
            ],
            "rules": {
                "hourly": {
                    "schedule_expression": "cron(0 0/2 ? * * *)",
                    "start_backup_window_minutes": "80",
                    "target_backup_vault_name": "Default",
                     "index_actions": {
                        "resource_types": {
                            "@@assign": [
                                "EBS",
                                "S3"
                            ]
                        }
                     },
                    "lifecycle": {
                        "delete_after_days": "365",
                        "move_to_cold_storage_after_days": "30",
                        "opt_in_to_archive_for_supported_resources": "false"

                    },
                    "copy_actions": {
                        "arn:aws:backup:us-east-1:$account:backup-vault:secondary_vault": {
                            "target_backup_vault_arn": {"@@assign": "arn:aws:backup:us-east-1:$account:backup-vault:secondary_vault"},
                            "lifecycle": {
                                "move_to_cold_storage_after_days": "28",
                                "delete_after_days": "180",
                                "opt_in_to_archive_for_supported_resources": "false"
                            }
                        }
                    }
                }
            },
            "selections": {
                "tags": {
                    "datatype": {
                        "iam_role_arn": "arn:aws:iam::$account:role/MyIamRole",
                        "tag_key": "dataType",
                        "tag_value": [
                            "PII",
                            "RED"
                        ]
                    }
                }
            }
        }
    }
}
```

### Example 6: Specifying resources with the `tags` block
<a name="backup-policy-example-6"></a>

The following example includes all resources with the `tag_key` = `“env”` and `tag_value` = `"prod"` or `"gamma"`. This example excludes resources with the `tag_key` = `"backup"` and the `tag_value` = `"false"`.

```
...
"selections":{
    "tags":{
        "selection_name":{
            "iam_role_arn": {"@@assign": "arn:aws:iam::$account:role/IAMRole"},
            "tag_key":{"@@assign": "env"},
            "tag_value":{"@@assign": ["prod", "gamma"]},
            "conditions":{                       
                "string_not_equals":{
                    "condition_name1":{
                        "condition_key": { "@@assign": "aws:ResourceTag/backup"  },
                        "condition_value": {  "@@assign": "false" }
                    }
                }
            }
        }  
    }
},
...
```

### Example 7: Specifying resources with the `resources` block
<a name="backup-policy-example-7"></a>

The following are examples of using the `resources` block to specify resources.

------
#### [ Example: Select all resources in my account ]

The Boolean logic is similar to what you might use in IAM policies. The `"resource_types"` block uses a Boolean `AND` to combine the resource types.

```
...
"resources":{
    "resource_selection_name":{
        "iam_role_arn":{"@@assign": "arn:aws:iam::$account:role/IAMRole"},
        "resource_types":{
            "@@assign": [
                "*"
            ]
        }
    }
},
...
```

------
#### [ Example: Select all resources in my account, but exclude Amazon EBS volumes ]

The Boolean logic is similar to what you might use in IAM policies. The `"resource_types"` and `"not_resource_types"` blocks use a Boolean `AND` to combine the resource types.

```
...
"resources":{
    "resource_selection_name":{
        "iam_role_arn":{"@@assign": "arn:aws:iam::$account:role/IAMRole"},
        "resource_types":{
            "@@assign": [
                "*"
            ]
        },
        "not_resource_types":{
            "@@assign": [
                "arn:aws:ec2:*:*:volume/*"
            ]
        }
    }
},
...
```

------
#### [ Example: Select all resources tagged with "backup" : "true", but exclude Amazon EBS volumes ]

The Boolean logic is similar to what you might use in IAM policies. The `"resource_types"` and `"not_resource_types"` blocks use a Boolean `AND` to combine the resource types. The `"conditions"` block uses a Boolean `AND`. 

```
...
"resources":{
    "resource_selection_name":{
        "iam_role_arn":{"@@assign": "arn:aws:iam::$account:role/IAMRole"},
        "resource_types":{
            "@@assign": [
                "*"
            ]
        },
        "not_resource_types":{
            "@@assign": [
                "arn:aws:ec2:*:*:volume/*"
            ]
        },
        "conditions":{                       
            "string_equals":{
                "condition_name1":{
                    "condition_key": { "@@assign":"aws:ResourceTag/backup"},
                    "condition_value": {  "@@assign":"true" }
                }
            }
        }
    }
},
...
```

------
#### [ Example: Select all Amazon EBS volumes and Amazon RDS DB instances tagged with both "backup" : "true" and "stage" : "prod" ]

The Boolean logic is similar to what you might use in IAM policies. The `"resource_types"` block uses a Boolean `AND` to combine the resource types. The `"conditions"` block uses a Boolean `AND` to combine resource types and tag conditions.

```
...
"resources":{
    "resource_selection_name":{
        "iam_role_arn":{"@@assign": "arn:aws:iam::$account:role/IAMRole"},
        "resource_types":{
            "@@assign": [
                "arn:aws:ec2:*:*:volume/*",
                "arn:aws:rds:*:*:db:*"
            ]
        },
        "conditions":{
            "string_equals":{
                "condition_name1":{
                    "condition_key":{"@@assign":"aws:ResourceTag/backup"},
                    "condition_value":{"@@assign":"true"}
                },
                "condition_name2":{
                    "condition_key":{"@@assign":"aws:ResourceTag/stage"},
                    "condition_value":{"@@assign":"prod"}
                }     
            }
        }   
    }
},
...
```

------
#### [ Example: Select all Amazon EBS volumes and Amazon RDS instances tagged with "backup" : "true" but not "stage" : "test" ]

The Boolean logic is similar to what you might use in IAM policies. The `"resource_types"` block uses a Boolean `AND` to combine the resource types. The `"conditions"` block uses a Boolean `AND` to combine resource types and tag conditions.

```
...
"resources":{
    "resource_selection_name":{
        "iam_role_arn":{"@@assign": "arn:aws:iam::$account:role/IAMRole"},
        "resource_types":{
            "@@assign": [
                "arn:aws:ec2:*:*:volume/*",
                "arn:aws:rds:*:*:db:*"
            ]
        },
        "conditions":{
            "string_equals":{
                "condition_name1":{
                    "condition_key":{"@@assign":"aws:ResourceTag/backup"},
                    "condition_value":{"@@assign":"true"}
                  }
            },
            "string_not_equals":{
                "condition_name2":{
                    "condition_key":{"@@assign":"aws:ResourceTag/stage"},
                    "condition_value":{"@@assign":"test"}
                }
            }
        }
    }
},
...
```

------
#### [ Example: Select all resources tagged with "key1" and a value which begins with "include" but not with "key2" and value that contains the word "exclude" ]

The Boolean logic is similar to what you might use in IAM policies. The `"resource_types"` block uses a Boolean `AND` to combine the resource types. The `"conditions"` block uses a Boolean `AND` to combine resource types and tag conditions.

In this example, note the use of the wildcard character `(*)` in `include*`, `*exclude*`, and `arn:aws:rds:*:*:db:*`. You can use the wildcard character `(*)` at the start, end, and middle of a string.

```
...
"resources":{
    "resource_selection_name":{
        "iam_role_arn":{"@@assign": "arn:aws:iam::$account:role/IAMRole"},
        "resource_types":{
            "@@assign": [
                "*"
            ]
        },              
        "conditions":{
            "string_like":{
                "condition_name1":{
                    "condition_key":{"@@assign":"aws:ResourceTag/key1"},
                    "condition_value":{"@@assign":"include*"}
                }
            },
            "string_not_like":{
                "condition_name2":{
                    "condition_key":{"@@assign":"aws:ResourceTag/key2"},
                    "condition_value":{"@@assign":"*exclude*"}
                }
            }
        }
    }
},
...
```

------
#### [ Example: Select all resources tagged with "backup" : "true" except Amazon FSx file systems and Amazon RDS resources ]

The Boolean logic is similar to what you might use in IAM policies. The `"resource_types"` and `"not_resource_types"` blocks use a Boolean `AND` to combine the resource types. The `"conditions"` block uses a Boolean `AND` to combine resource types and tag conditions.

```
...
"resources":{
    "resource_selection_name":{
        "iam_role_arn":{"@@assign": "arn:aws:iam::$account:role/IAMRole"},
            "resource_types":{
                "@@assign": [
                    "*"
               ]
            },
            "not_resource_types":{
                "@@assign":[
                    "arn:aws:fsx:*:*:file-system/*",
                    "arn:aws:rds:*:*:db:*"
                ]
            },
        "conditions":{
            "string_equals":{
                "condition_name1":{
                    "condition_key":{"@@assign":"aws:ResourceTag/backup"},
                    "condition_value":{"@@assign":"true"}
                }
            }
        }
    }
},
...
```

------

### Example 8: Backup plan with Amazon GuardDuty Malware Protection scanning
<a name="backup-policy-example-8"></a>

The following example shows a backup policy that enables Amazon GuardDuty Malware Protection scanning on backup recovery points. The policy uses `scan_actions` in the rule to enable scanning and `scan_settings` at the plan level to configure the scanner.

To use this feature, you must have the appropriate IAM role permissions. For more information, see [Access](https://docs.aws.amazon.com//aws-backup/latest/devguide/malware-protection.html#malware-access) in the *AWS Backup Developer Guide*.

```
{
    "plans": {
        "Malware_Scan_Backup_Plan": {
            "regions": {
                "@@assign": [
                    "us-east-1",
                    "us-west-2"
                ]
            },
            "rules": {
                "Daily_With_Incremental_Scan": {
                    "schedule_expression": {
                        "@@assign": "cron(0 5 ? * * *)"
                    },
                    "start_backup_window_minutes": {
                        "@@assign": "60"
                    },
                    "target_backup_vault_name": {
                        "@@assign": "Default"
                    },
                    "lifecycle": {
                        "delete_after_days": {
                            "@@assign": "35"
                        }
                    },
                    "scan_actions": {
                        "GUARDDUTY": {
                            "scan_mode": {
                                "@@assign": "INCREMENTAL_SCAN"
                            }
                        }
                    }
                },
                "Monthly_With_Full_Scan": {
                    "schedule_expression": {
                        "@@assign": "cron(0 5 1 * ? *)"
                    },
                    "start_backup_window_minutes": {
                        "@@assign": "60"
                    },
                    "target_backup_vault_name": {
                        "@@assign": "Default"
                    },
                    "lifecycle": {
                        "delete_after_days": {
                            "@@assign": "365"
                        }
                    },
                    "scan_actions": {
                        "GUARDDUTY": {
                            "scan_mode": {
                                "@@assign": "FULL_SCAN"
                            }
                        }
                    }
                }
            },
            "selections": {
                "tags": {
                    "scan_selection": {
                        "iam_role_arn": {
                            "@@assign": "arn:aws:iam::$account:role/MyBackupRole"
                        },
                        "tag_key": {
                            "@@assign": "backup"
                        },
                        "tag_value": {
                            "@@assign": [
                                "true"
                            ]
                        }
                    }
                }
            },
            "scan_settings": {
                "GUARDDUTY": {
                    "resource_types": {
                        "@@assign": [
                            "EBS"
                        ]
                    },
                    "scanner_role_arn": {
                        "@@assign": "arn:aws:iam::$account:role/MyGuardDutyScannerRole"
                    }
                }
            }
        }
    }
}
```

The key points in this example are:
+ `scan_actions` is specified inside each rule. The scanner name `GUARDDUTY` is used as the key. The daily rule uses `INCREMENTAL_SCAN` and the monthly rule uses `FULL_SCAN`.
+ `scan_settings` is specified at the plan level (not inside a rule). It configures the scanner role and resource types to scan.
+ The `scanner_role_arn` must reference an IAM role with the `AWSBackupGuardDutyRolePolicyForScans` managed policy attached and a trust policy that allows the `malware-protection.guardduty.amazonaws.com` service principal to assume the role.

# Tag policies
<a name="orgs_manage_policies_tag-policies"></a>

Tag policies allow you to standardize the tags attached to the AWS resources in your organization's accounts.

You can use tag policies to maintain consistent tags, including the preferred case treatment of tag keys and tag values.

## What are tags?
<a name="what-are-tags"></a>

*Tags* are custom attribute labels that you assign or that AWS assigns to AWS resources. Each tag has two parts:
+ A *tag key* (for example, `CostCenter`, `Environment`, or `Project`). Tag keys are case sensitive.
+ An optional field known as a *tag value* (for example, `111122223333` or `Production`). Omitting the tag value is the same as using an empty string. Like tag keys, tag values are case sensitive.

The rest of this page describes tag policies. For more information about tags, see the following sources:
+ For general information about tagging, including naming and usage conventions, see the [https://docs.aws.amazon.com/tag-editor/latest/userguide/tagging.html](https://docs.aws.amazon.com/tag-editor/latest/userguide/tagging.html).
+ For a list of services that support using tags, see the [https://docs.aws.amazon.com/resourcegroupstagging/latest/APIReference/Welcome.html](https://docs.aws.amazon.com/resourcegroupstagging/latest/APIReference/Welcome.html).
+ For information about using tags to categorize resources, see the [https://docs.aws.amazon.com/whitepapers/latest/tagging-best-practices/tagging-best-practices.html](https://docs.aws.amazon.com/whitepapers/latest/tagging-best-practices/tagging-best-practices.html).
+ For information on tagging Organizations resources, see [Tagging AWS Organizations resourcesConsiderations](orgs_tagging.md).
+ For information on tagging resources in other AWS services, see the documentation for that service.

## What are tag policies?
<a name="what-are-tag-policies"></a>

*Tag policies* are a type of policy that can help you standardize tags across resources in your organization's accounts. In a tag policy, you specify tagging rules applicable to resources when they are tagged.

For example, a tag policy can specify that when the `CostCenter` tag is attached to a resource, it must use the case treatment and tag values that the tag policy defines. A tag policy can also specify that noncompliant tagging operations on specified resource types are *enforced*. In other words, noncompliant tagging requests on specified resource types are prevented from completing. Untagged resources or tags that aren't defined in the tag policy aren't evaluated for compliance with the tag policy.

Using tag policies involves working with multiple AWS services:
+ Use **AWS Organizations** to manage *tag policies*. When you sign in to the organization's management account, you use Organizations to enable the tag policies feature. You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization's management account. Then you can create tag policies and attach them to the organization entities to put those tagging rules in effect. 
+ Use **AWS Resource Groups** to manage *compliance* with tag policies. When you sign in to an account in your organization, you use Resource Groups to find noncompliant tags on resources in the account. You can correct noncompliant tags in the AWS service where you created the resource. You can also use the [Tag Editor](https://docs.aws.amazon.com/tag-editor/latest/userguide/tag-editor.html) and the [Resource Groups Tagging](https://docs.aws.amazon.com/resourcegroupstagging/latest/APIReference/overview.html) API to tag and untag resources from multiples services.

  If you sign in to the management account in your organization, you can view compliance information for all your organization's accounts.

Tag policies are available only in an organization that has [all features enabled](orgs_manage_org_support-all-features.md). For more information on what's required to use tag policies, see [Prerequisites and permissions for management policies for AWS Organizations](orgs_manage_policies_prereqs.md).

**Important**  
To get started with tag policies, AWS strongly recommends that you follow the example workflow described in [Getting started with tag policies](orgs_manage_policies_tag-policies-getting-started.md) before moving on to more advanced tag policies. It's best to understand the effects of attaching a simple tag policy to a single account before expanding tag policies to an entire OU or organization. It's especially important to understand a tag policy's effects before you *enforce* compliance with any tag policy. The tables on the [Getting started with tag policies](orgs_manage_policies_tag-policies-getting-started.md) page also provide links to instructions for more advanced policy-related tasks.

# Best practices for using tag policies
<a name="orgs_manage_policies_tag-policies-best-practices"></a>

AWS recommends the following best practices for using tag policies.

## Decide on a tag capitalization strategy
<a name="bp-tag-cap"></a>

Determine how you want to capitalize tags and consistently implement that strategy across all resource types. For example, decide whether to use `Costcenter`, `costcenter`, or `CostCenter`, and use the same convention for all tags. For consistent results in compliance reports, avoid using similar tags with inconsistent case treatment. This strategy will help you define tag policies for your organization. 

## Use the recommended workflow
<a name="bp-tag-workflow"></a>

Start small by creating a simple tag policy. Then attach it to a member account that you can use for testing purposes. Use the workflows described in [Getting started with tag policies](orgs_manage_policies_tag-policies-getting-started.md).

## Determine tagging rules
<a name="bp-tag-rules"></a>

This will depend on your organization's needs. For example, you may want to specify that when a `CostCenter` tag is attached to AWS Secrets Manager secrets, it must use the specified case treatment. Create tag policies that define compliant tags and attach them to the organization entities where you want those tagging rules to be in effect.

## Educate account administrators
<a name="bp-tag-educate"></a>

When you're ready to expand your use of tag policies, educate account administrators as follows:
+ Communicate your tagging strategy.
+ Emphasize that administrators need to use tags on specific resource types.

  This is important, as untagged resources don't show as noncompliant in compliance results.
+ Provide guidance on checking compliance with tag policies. Instruct administrators to find and correct noncompliant tags on resources in their account using the procedure described in [Evaluating Compliance for an Account](https://docs.aws.amazon.com/tag-editor/latest/userguide/tag-policies-orgs-finding-noncompliant-tags.html) in the *Tagging AWS Resource User Guide.* Let them know how often you want them to check for compliance.

## Use caution in enforcing compliance
<a name="bp-tag-compliance"></a>

 Enforcing compliance could prevent users in your organization's accounts from tagging the resources they need. Review the information in [Enforce tagging consistency](orgs_manage_policies_tag-policies-enforcement.md). Also see the workflows described in [Getting started with tag policies](orgs_manage_policies_tag-policies-getting-started.md).

## Be aware of tagging limits
<a name="bp-tag-limits"></a>

 AWS services generally have a limit of 50 user-defined tags that cannot be modified. When using features like Report Required Tags, ensure your organization's effective policies don't exceed 50 required tags for any given resource type. Exceeding this limit can cause two issues: resources may be unable to achieve compliance status in compliance summaries, and Infrastructure as Code (IaC) platforms may fail to create resources when more than 50 tags are defined as required. 

## Consider creating an SCP to set guardrails around resource creation requests
<a name="bp-tag-guardrails"></a>

Resources that have never had tags attached to them don't show as noncompliant in reports. Account administrators can still create untagged resources. In some cases, you can use a service control policy (SCP) to set guardrails around resource creation requests.

To learn whether an AWS service supports controlling access using tags, see [AWS services That Work with IAM](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-services-that-work-with-iam.html) in the *IAM User Guide*. Look for the services that have **Yes **in the **ABAC (authorization based on tags)** column. Choose the name of the service to view the authorization and access control documentation for that service.

# Getting started with tag policies
<a name="orgs_manage_policies_tag-policies-getting-started"></a>

Using tag policies involves working with multiple AWS services. To get started, review the following pages. Then follow the workflows on this page to get familiar with tag policies and their effects.
+ [Prerequisites and permissions for management policies for AWS Organizations](orgs_manage_policies_prereqs.md)
+ [Best practices for using tag policies](orgs_manage_policies_tag-policies-best-practices.md)

## Using tag policies for the first time
<a name="getting-started-first-time"></a>

Follow these steps to get started using tag policies for the first time.


| Task | Account to sign in to | AWS service console to use | 
| --- | --- | --- | 
|  Step 1: [Enable tag policies for your organization.](enable-policy-type.md)  |  The organization's management account.¹  |  [AWS Organizations](https://console.aws.amazon.com/organizations/)  | 
|  Step 2: [Create a tag policy](orgs_policies_create.md#create-tag-policy-procedure). Keep your first tag policy simple. Enter one tag key in the case treatment you want to use and leave all other options at their defaults.  |  The organization's management account.¹  |  [AWS Organizations](https://console.aws.amazon.com/organizations/)  | 
|  Step 3: [Attach a tag policy to a single member account that you can use for testing.](orgs_policies_attach.md) You'll need to sign in to this account in the next step.  |  The organization's management account.¹  |  [AWS Organizations](https://console.aws.amazon.com/organizations/)  | 
|  Step 4: Create some resources with compliant tags and some with noncompliant tags.  |  The member account that you're using for testing purposes.  |  Any AWS service that you are comfortable with. For example, you can use [AWS Secrets Manager](https://console.aws.amazon.com/secretsmanager/) and follow the procedure in [Creating a Basic Secret](https://docs.aws.amazon.com/secretsmanager/latest/userguide/manage_create-basic-secret.html) to create secrets with compliant and non-compliant secrets.  | 
|  Step 5: [View the effective tag policy and evaluate the compliance status of the account.](https://docs.aws.amazon.com/tag-editor/latest/userguide/tag-policies-orgs-finding-noncompliant-tags.html)  |  The member account that you're using for testing purposes.  |  [Resource Groups](https://console.aws.amazon.com/resource-groups/) and the AWS service where the resource was created. If you created resources with compliant and non-compliant tags, you should see the non-compliant tags in the results.  | 
|  Step 6: Repeat the process of finding and correcting compliance issues until the resources in the test account are compliant with your tag policy.  |  The member account that you're using for testing purposes.  |  [Resource Groups](https://console.aws.amazon.com/resource-groups/) and the AWS service where the resource was created.  | 
|  At any time, you can [ evaluate organization-wide compliance](https://docs.aws.amazon.com/ARG/latest/userguide/tag-policies-orgs-evaluating-org-wide-compliance.html).  |  The organization's management account.¹  |  [Resource Groups](https://console.aws.amazon.com/resource-groups/)  | 

¹ You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization's management account.

## Expanding use of tag policies
<a name="getting-started-more-advanced"></a>

You can perform the following tasks in any order to expand your use of tag policies.


| Advanced task | Account to sign in to | AWS service console to use | 
| --- | --- | --- | 
|  [Create more advanced tag policies](orgs_policies_create.md#create-tag-policy-procedure). Follow the same process as for first-time users, but try other tasks. For example, define additional keys or values or specify different case treatment for a tag key.  You can use the information in [Understanding management policy inheritance](orgs_manage_policies_inheritance_mgmt.md) and [Tag policy syntax](orgs_manage_policies_example-tag-policies.md#tag-policy-syntax-reference) to create more detailed tag policies.  |  The organization's management account.¹  |  [AWS Organizations](https://console.aws.amazon.com/organizations/)  | 
|  [Attach tag policies to additional accounts or OUs. ](orgs_policies_attach.md) Check the [effective tag policy for an account](orgs_manage_policies_effective.md) after you attach more policies to it or to any OU in which the account is a member.  |  The organization's management account.¹  |  [AWS Organizations](https://console.aws.amazon.com/organizations/)  | 
|  Create an SCP to require tags when anyone creates new resources.  |  The organization's management account.¹  |  [AWS Organizations](https://console.aws.amazon.com/organizations/)  | 
|  [ Continue to evaluate the compliance status of the account against the effective tag policy as it changes. Correct noncompliant tags. ](https://docs.aws.amazon.com/ARG/latest/userguide/tag-policies-orgs-finding-noncompliant-tags.html)  |  A member account with an effective tag policy.  |  [Resource Groups](https://console.aws.amazon.com/resource-groups/) and the AWS service where the resource was created.  | 
|  [ Evaluate organization-wide compliance](https://docs.aws.amazon.com/ARG/latest/userguide/tag-policies-orgs-evaluating-org-wide-compliance.html).  |  The organization's management account.¹  |  [Resource Groups](https://console.aws.amazon.com/resource-groups/)  | 

¹ You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization's management account.

## Enforcing tag policies for the first time
<a name="getting-started-enforcement"></a>

To enforce tag policies for the first time, follow a workflow similar to using tag policies for the first time and use a test account.

**Warning**  
Use caution in enforcing compliance. Make sure that you understand the effects of using tag policies and follow the recommended workflow. Test how enforcement works on a test account before expanding it to more accounts. Otherwise, you could prevent users in your organization's accounts from tagging the resources they need. For more information, see [Enforce tagging consistency](orgs_manage_policies_tag-policies-enforcement.md). 


| Enforcement tasks | Account to sign in to | AWS service console to use | 
| --- | --- | --- | 
|  Step 1: [Create a tag policy](orgs_policies_create.md#create-tag-policy-procedure).  Keep your first enforced tag policy simple. Enter one tag key in the case treatment you want to use, and choose the **Prevent noncompliant operations for this tag** option. Then specify one resource type to enforce it on. Continuing with our earlier example, you can choose to enforce it on Secrets Manager secrets.  |  The organization's management account.¹  |  [AWS Organizations](https://console.aws.amazon.com/organizations/)  | 
|  Step 2: [Attach a tag policy to a single, test account.](orgs_policies_attach.md)  |  The organization's management account.¹  |  [AWS Organizations](https://console.aws.amazon.com/organizations/)  | 
|  Step 3: Try creating some resources with compliant tags, and some with noncompliant tags. You shouldn't be allowed to create a tag on a resource of the type specified in the tag policy with a noncompliant tag.   |  The member account that you're using for testing purposes.  | Any AWS service that you are comfortable with. For example, you can use [AWS Secrets Manager](https://console.aws.amazon.com/secretsmanager/) and follow the procedure in [Creating a Basic Secret](https://docs.aws.amazon.com/secretsmanager/latest/userguide/manage_create-basic-secret.html) to create secrets with compliant and non-compliant secrets. | 
|  Step 4: [ Evaluate the compliance status of the account against the effective tag policy and correct noncompliant tags. ](https://docs.aws.amazon.com/ARG/latest/userguide/tag-policies-orgs-finding-noncompliant-tags.html)  |  The member account that you're using for testing purposes.  |  [Resource Groups](https://console.aws.amazon.com/resource-groups/) and the AWS service where the resource was created.  | 
|  Step 5: Repeat the process of finding and correcting compliance issues until the resources in the test account are compliant with your tag policy.  |  The member account that you're using for testing purposes.  |  [Resource Groups](https://console.aws.amazon.com/resource-groups/) and the AWS service where the resource was created.  | 
|  At any time, you can [ evaluate organization-wide compliance](https://docs.aws.amazon.com/ARG/latest/userguide/tag-policies-orgs-evaluating-org-wide-compliance.html).  |  The organization's management account.¹  |  [Resource Groups](https://console.aws.amazon.com/resource-groups/)  | 

¹ You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization's management account.

# Report tagging compliance
<a name="orgs_manage_policies_tag-policies-report-tagging-compliance"></a>

Tag policies provide reporting mode for "Basic compliance rules" and "Required tag key". You can use this mode to evaluate the compliance of an account in your organization with its effective tag policy. The generated report includes only resources that have had at least one user-defined tag at any point in their lifecycle.

**Important**  
Untagged resources don't appear as non-compliant in results.  
To find untagged resources in your account, use AWS Resource Explorer with a query that uses `tag:none`. For more information, see [Search for untagged resources](https://docs.aws.amazon.com/resource-explorer/latest/userguide/using-search-query-examples.html#example-1) in the *AWS Resource Explorer User Guide*.

**Topics**
+ [Reporting for "Basic compliance rules"](#reporting-basic-compliance-rules)
+ [Reporting for "Required tag key"](#reporting-required-tag-key)
+ [Generating an organization-wide compliance report](enforcement-report.md)

## Reporting for "Basic compliance rules"
<a name="reporting-basic-compliance-rules"></a>

With reporting for basic compliance rules, you can generate a tagging compliance report that checks for compliance against capitalization and allowed tag values.

**To report,**

From the Visual editor tab, enter the value for the tag key that you want to report compliance against. The screenshot below shows a customer compliance report for the "CostCenter" tag key. In this example, the report will highlight a tagged resource as compliant if it matches only a lowercase value of the "CostCenter" tag key, meaning the string is equal to "costcenter".

![\[Visual editor tab showing tag policy configuration for CostCenter tag with Legal and HR values\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/tag-policies-basic-compliance-reporting.png)


The JSON below generates a compliance report for resources against a lowercase value of the "CostCenter" tag key.

```
{
    "tags": {
        "CostCenter": {}
    }
}
```

**To report on capitalization,**

From the Visual editor tab, enter the value for the tag key that you want to report compliance against, and select the Capitalization option. The screenshot below shows a customer compliance report for the "CostCenter" tag key with capitalization. In this example, the report will highlight a tagged resource as compliant if it is an exact string match to the "CostCenter" tag key.

![\[Visual editor tab showing tag policy configuration for CostCenter tag with capitalization\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/tag-policies-basic-compliance-capitalization.png)


The JSON below generates a compliance report for resources against the "CostCenter" tag key with capitalization.

```
{
    "tags": {
        "CostCenter": {
            "tag_key": {
                "@@assign": "CostCenter"
            }
        }
    }
}
```

**To report on allowed tag values with capitalization,**

From the Visual editor tab, enter the value for the tag key that you want to report compliance against, select the Allowed values option, and enter values for allowed tag values. The screenshot below shows a customer compliance report for the "CostCenter" tag key with capitalization and allowed tag values. In this example, the report will highlight a tagged resource as compliant if it is an exact string match to the "CostCenter" tag key, and the tag value is either "HR" or "Legal".

![\[Visual editor tab showing tag policy configuration for CostCenter tag with capitalization and allowed tag values HR and Legal\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/tag-policies-basic-compliance-allowed-tag-values-with-capitalization.png)


The JSON below generates a compliance report for resources against the "CostCenter" tag key with capitalization and allowed tag values "HR" and "Legal".

```
{
    "tags": {
        "CostCenter": {
            "tag_key": {
                "@@assign": "CostCenter"
            },
            "tag_value": {
                "@@assign": [
                    "HR",
                    "Legal"
                ]
            }
        }
    }
}
```

## Reporting for "Required tag key"
<a name="reporting-required-tag-key"></a>

**Warning**  
The AWS Resource Groups console does not currently support reporting for required tag keys when evaluating compliance for an account. Noncompliant resources that are missing a required tag key will not appear in **Resources with noncompliant tags** section and will not mark the account as noncompliant. Use organization-wide compliance report instead to find noncompliant resources that are missing a required tag key.

With reporting for required tag keys, you can evaluate whether your resource creation operation is missing required or mandatory tag keys. Run the following command in your CLI to list required tag keys that are defined in the account's effective tag policy. You can use this information to manually verify that you are creating a resource with all required tags as defined by your account administrator.

```
$ aws resourcegroupstaggingapi list-required-tags
```

**To report required tag keys,**

From the Visual editor tab, enter the value for the tag key that you want to report compliance against, and select the **Mark tag as required for reporting** option. The screenshot below shows a customer compliance report for the "CostCenter" tag key with capitalization and reporting for required tag key. In this example, the report will highlight a tagged resource as compliant if it contains the exact string "CostCenter" as a tag key.

**Important**  
You need to select both Capitalization and Mark tags as required for reporting options to generate a report of selected resource types that are missing the exact required tags. For example, you will use both of these options when you are trying to check for an exact match to the "CostCenter" tag key.  
You can select only the Mark tags as required for reporting option to generate a report of selected resource types that are missing the required tags. In this scenario, the generated report will mark resources as compliant if they have "CostCenter", "costCenter", "Costcenter", "costcenter", or any similar variation. This feature allows you to generate compliance reports for selected resource types, instead of all tagged resources in your account.  
Selecting only Capitalization will generate a report for ALL tagged resources, and mark those resources as non-compliant if the tag key does not have an exact string match.

![\[Visual editor tab showing tag policy configuration for required tag reporting\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/tag-policies-basic-compliance-required-tag.png)


The JSON below generates a compliance report for resources against the "CostCenter" tag key with capitalization and mark tag as required for reporting.

```
{
    "tags": {
        "CostCenter": {
            "tag_key": {
                "@@assign": "CostCenter"
            },
            "report_required_tag_for": {
                "@@assign": [
                    "ec2:ALL_SUPPORTED"
                ]
            }
        }
    }
}
```

**To enforce,**

You can use reporting with IaC tools such as CloudFormation, Terraform, and Pulumi to warn your developers or block deployments with missing required tags. You can now use one effective tag policy that works across CloudFormation, Terraform, and Pulumi. See [Enforce "Required tag key" with IaC](enforce-required-tag-keys-iac.md) for more details.

# Generating an organization-wide compliance report
<a name="enforcement-report"></a>

At any time, you can generate a report that lists all tagged resources in the AWS accounts across your organization. The report shows whether each resource is compliant with the effective tag policy. Note that it can take up to 48 hours for changes you make to a tag policy or resources to be reflected in the organization-wide compliance report. For example, if you have a tag policy that defines a new standardized tag for a resource type, resources of that type that don't have this tag are shown as compliant in the report for up to 48 hours.

You can generate the report from your organization's management account in the `us-east-1` Region, provided that it has access to an Amazon S3 bucket. The bucket must have an attached bucket policy as shown in [Amazon S3 Bucket Policy for Storing Report](https://docs.aws.amazon.com/ARG/latest/userguide/tag-policies-prereqs.html#bucket-policy). To generate the report, run the following command:

```
$ aws resourcegroupstaggingapi start-report-creation --region us-east-1
```

You can generate one report at a time.

This report can take some time to complete. You can check the status by running the following command:

```
$ aws resourcegroupstaggingapi describe-report-creation --region us-east-1
{
    "Status": "SUCCEEDED"
}
```

After the above command returns `SUCCEEDED`, you can open the report from the Amazon S3 bucket.

# Enforce tagging consistency
<a name="orgs_manage_policies_tag-policies-enforcement"></a>

Tag policies provide two capabilities to help you enforce tagging consistency across your AWS environments: "Basic compliance rules" and "Required tag key". You can use these capabilities with two tag policy modes: enforcement and reporting. This section highlights enforcement mode for both capabilities. For details on reporting mode for both capabilities, see "Reporting tagging compliance".

**Topics**
+ [Enforce for "Basic compliance rules"](#basic-compliance-rules)
+ [Best practices](#best-practices)
+ [Enforce "Required tag key" with IaC](enforce-required-tag-keys-iac.md)
+ [Tag policy syntax and examples](orgs_manage_policies_example-tag-policies.md)

## Enforce for "Basic compliance rules"
<a name="basic-compliance-rules"></a>

With enforcement for basic compliance rules, you can prevent resource creation with tag values that do not meet the requirements specified in your tag policy. For example, you can define a policy that blocks Amazon EC2 create operations if the supplied 'CostCenter' tag key does not have a tag value of "Business" or "Legal". Basic compliance rules also allow you to apply enforcement based on capitalization of tag keys. Enabling capitalization ensures that tag keys are an exact string match. Capitalization treats "CostCenter", "costCenter", and "Costcenter" as unique tag keys, meaning tag key enforcement is case sensitive. Capitalization enforcement prevents teams from accidentally creating tag variations. Tagging consistency is critical for both cost tracking accuracy and attribute-based access control (ABAC) security policies that rely on precise tag matching to grant or deny resource access.

**Important**  
Basic compliance rules do not enforce tag compliance on resources that are created without tags. This capability does not enforce missing tag keys. You cannot use this capability to ensure that required or mandatory tag keys are configured at resource creation. Use reporting mode in "Required tag keys" to enforce required tag keys for resources created by IaC tools such as CloudFormation, Terraform, and Pulumi. Use SCPs to prevent IAM users and roles in target accounts from creating certain resource types if the request doesn't include the specified tags.

To enforce basic compliance rules with tag policies, do one of the following when you [create a tag policy](orgs_policies_create.md): 
+ From the **Visual editor** tab, select the option **Prevent noncompliant operations for this tag**. See [Create a tag policy](orgs_policies_create.md) section for steps on how to author and attach a tag policy. 
+ From the **JSON** tab, use the `enforced_for` field. For information on tag policy syntax, see [Tag policy syntax and examples](orgs_manage_policies_example-tag-policies.md). 

The image below shows the console experience of the Visual editor tab. In this example, the customer is defining a tag policy that will enforce tag value validation only for Amazon EC2 resource types that are supported by tag policies. This policy will check if the tag value is either "Legal" or "HR" when the supplied tag key is "CostCenter" for Amazon EC2 resource types. This policy also enforces capitalization, which means that the policy is looking for an exact string match to the "CostCenter" tag key.

![\[Visual editor tab showing tag policy configuration for CostCenter tag with Legal and HR values\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/tag-policies-basic-compliance.png)


The JSON below is the generated tag policy from the above "CostCenter" example.

**Important**  
We recommend that you use the Visual editor when you are defining your tag policy for the first time. The Visual editor ensures that your tag policy syntax is valid, with no additional steps, and gives you a simplified clickable experience to define your tag policy. You can use either the Visual editor or JSON tab to define your tag policy.

```
{  
    "tags": {  
        "CostCenter": {  
            "tag_key": {  
                "@@assign": "CostCenter"  
            },  
            "tag_value": {  
                "@@assign": [  
                    "HR",  
                    "Legal"  
                ]  
            },  
            "enforced_for": {  
                "@@assign": [  
                    "ec2:ALL_SUPPORTED"  
                ]  
            }  
        }  
    }  
}
```

## Best practices
<a name="best-practices"></a>

Follow these best practices for enforcement with "Basic compliance rules" and "Required tag keys for IaC" with tag policies:
+  **Use caution when enforcing compliance** – Make sure you understand the effects of using tag policies and follow the recommended workflows described in [Getting started with tag policies](orgs_manage_policies_tag-policies-getting-started.md). Test how enforcement works on a test account before expanding it to more accounts or organizational units. Otherwise, you could prevent users in your organization's accounts from creating the resources they need. 
+  **Be aware of what resource types you can enforce on** – You can only enforce compliance with tag policies on [supported resource types](orgs_manage_policies_supported-resources-enforcement.md). Resource types that support enforcing compliance are listed when you use the visual editor to build a tag policy. 
+  **Understand interactions with some services** – Some AWS services have container-like groupings of resources that automatically create resources for you and propagate tags from a resource in one service to another. For example, tags on Amazon EC2 groups and Amazon EMR clusters can automatically propagate to the contained Amazon EC2 instances. You may have tag policies for Amazon EC2 that are more strict than for groups or Amazon EMR clusters. If you enable enforcement, the tag policy prevents resources from being tagged and may block dynamic scaling and provisioning. 

The following sections show how you can find non-compliant resources, and correct them to be compliant.

**Topics**
+  [Identify and remediate tagging inconsistencies](orgs_manage_policies_tag-policies-identify-remediate.md) 

# Enforce "Required tag key" with IaC
<a name="enforce-required-tag-keys-iac"></a>

Tag policies help you maintain consistent tagging across your infrastructure as code (IaC) deployments. With "Required tag keys", you can ensure that all resources created through IaC tools like CloudFormation, Terraform, and Pulumi include the mandatory tags defined by your organization.

This capability checks your IaC deployments against your organization's tag policies before resources are created. When a deployment is missing required tags, you can configure your IaC settings to either warn your development teams or prevent the deployment entirely. This proactive approach maintains tagging compliance from the moment resources are created, rather than requiring manual remediation later. The enforcement works across multiple IaC tools using a single tag policy definition, eliminating the need to configure separate tagging rules for each tool your organization uses.

**Topics**
+ [Enforce with CloudFormation](#enforce-with-cloudformation)
+ [Enforce with Terraform](#enforce-with-terraform)
+ [Enforce with Pulumi](#enforce-with-pulumi)

## Enforce with CloudFormation
<a name="enforce-with-cloudformation"></a>

**Note**  
To enforce required tag keys with CloudFormation, you must specify required tags for your resource type in tag policies. See the [Reporting for "Required tag key"](orgs_manage_policies_tag-policies-report-tagging-compliance.md#reporting-required-tag-key) section for more details. 

 **Setup Execution Role for the AWS::TagPolicies::TaggingComplianceValidator Hook** 

Before activating the `AWS::TagPolicies::TaggingComplianceValidator` hook, you must create an execution role that the hook uses to access AWS services. The role must have the following Trust Policy attached to it: 

```
{
    "Version": "2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "Service": [
                    "resources.cloudformation.amazonaws.com",
                    "hooks.cloudformation.amazonaws.com"
                ]
            },
            "Action": [
                "sts:AssumeRole"
            ]
        }
    ]
}
```

The execution role must also have a Role Policy with at least the following permissions:

```
{
    "Version": "2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "tag:ListRequiredTags"
            ],
            "Resource": "*"
        }
    ]
}
```

For more information about setting up execution roles for public extensions, see [Configure an execution role with IAM permissions and a trust policy for public extension access](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/registry-public.html#registry-public-enable-execution-role) in the CloudFormation User Guide. 

 **Activate the AWS::TagPolicies::TaggingComplianceValidator Hook** 

**Important**  
Before you continue, verify that you have the permissions required to work with Hooks and view proactive controls from the CloudFormation console. For more information, see [Grant IAM permissions for CloudFormation Hooks](https://docs.aws.amazon.com/cloudformation-cli/latest/hooks-userguide/grant-iam-permissions-for-hooks.html). 

After updating your tag policy, you must activate the `AWS::TagPolicies::TaggingComplianceValidator` hook in every AWS account and Region where you want to enforce required tagging compliance. 

This AWS-managed hook can be configured in two modes:
+  **Warn mode**: Allows deployments to proceed but generates warnings when required tags are missing 
+  **Fail mode**: Blocks deployments that are missing required tags 

To activate the hook using the AWS CLI:

```
aws cloudformation activate-type \
    --type HOOK \
    --type-name AWS::TagPolicies::TaggingComplianceValidator \
    --execution-role-arn arn:aws:iam::123456789012:role/MyHookExecutionRole \
    --publisher-id aws-hooks \
    --region us-east-1
```

```
aws cloudformation set-type-configuration \
  --configuration '{"CloudFormationConfiguration":{"HookConfiguration":{"HookInvocationStatus": "ENABLED", "FailureMode": "WARN", "TargetOperations": ["STACK"], "Properties":{}}}}' \
  --type-arn "arn:aws:cloudformation:us-east-1:123456789012:type/hook/AWS-TagPolicies-TaggingComplianceValidator" \
  --region us-east-1
```

Replace `region` with your target AWS region, and change `"FailureMode":"FAIL"` to `"FailureMode":"WARN"` if you prefer warning mode. 

 **Activate the AWS::TagPolicies::TaggingComplianceValidator Hook across multiple accounts and Regions with CloudFormation StackSets** 

For organizations with multiple AWS accounts, you can use AWS CloudFormation StackSets to activate the tagging compliance hook across all your accounts and Regions simultaneously.

CloudFormation StackSets allow you to deploy the same CloudFormation template to multiple accounts and Regions with a single operation. This approach ensures consistent tagging enforcement across your entire AWS organization without requiring manual configuration in each account.

To use CloudFormation StackSets for this purpose:

1. Create a CloudFormation template that activates the tagging compliance hook

1. Deploy the template using CloudFormation StackSets to target your organizational units or specific accounts

1. Specify all Regions where you want enforcement enabled

The CloudFormation StackSets deployment will automatically handle the activation process across all specified accounts and Regions, ensuring uniform tagging compliance throughout your organization. To learn how to deploy CloudFormation Hooks to an Organization with service-managed CloudFormation StackSets, see this [AWS blog](https://aws.amazon.com/blogs/devops/deploy-cloudformation-hooks-to-an-organization-with-service-managed-stacksets/). 

 *Deploy the CloudFormation template below using CloudFormation StackSets to activate the AWS::TagPolicies::TaggingComplianceValidator Hook for accounts in your organization.* 

**Important**  
This hook only functions as a StackHook. It has no effect when used as a resource hook.

```
Resources:
  # Activate the AWS-managed hook type
  HookTypeActivation:
    Type: AWS::CloudFormation::TypeActivation
    Properties:
        AutoUpdate: True
        PublisherId: "AWS"
        TypeName: "AWS::TagPolicies::TaggingComplianceValidator"
  
  # Configure the hook
  HookTypeConfiguration:
    Type: AWS::CloudFormation::HookTypeConfig
    DependsOn: HookTypeActivation
    Properties:
      TypeName: "AWS::TagPolicies::TaggingComplianceValidator"
      TypeArn: !GetAtt HookTypeActivation.Arn
      Configuration: !Sub |
        {
          "CloudFormationConfiguration": {
            "HookConfiguration": {
              "TargetStacks": "ALL",
              "TargetOperations": ["STACK"],
              "Properties": {},
              "FailureMode": "Warn",
              "TargetFilters": {
                "Actions": [
                    "CREATE",
                    "UPDATE"
                ]}
            }
          }
        }
```

**Note**  
For more information on running CloudFormation hooks, see [Activate a proactive control-based Hook in your account](https://docs.aws.amazon.com/cloudformation-cli/latest/hooks-userguide/proactive-controls-hooks-activate-hooks.html). 

## Enforce with Terraform
<a name="enforce-with-terraform"></a>

To enforce required tag keys with Terraform, you need to update your Terraform AWS Provider to 6.22.0 or above and enable tag policy validation in your provider configuration. For implementation details and configuration examples, see the [ Terraform AWS Provider documentation on tag policy enforcement](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/guides/tag-policy-compliance). 

## Enforce with Pulumi
<a name="enforce-with-pulumi"></a>

To enforce required tag keys with Pulumi, you need to enable the Tag Policy Reporting policy pack in Pulumi Cloud and configure your IAM role with tag policy read permissions. For implementation details and configuration examples, see the [ Pulumi documentation on tag policy enforcement](https://www.pulumi.com/docs/insights/policy/integrations/aws-organizations-tag-policies/#aws-organizations-tag-policies). 

# Tag policy syntax and examples
<a name="orgs_manage_policies_example-tag-policies"></a>

This page describes tag policy syntax and provides examples.

**Topics**
+ [Tag policy syntax](#tag-policy-syntax-reference)
+ [Tag policy examples](#tag-policy-examples)
+ [Example 1: Define organization-wide tag key case](#tag-policy-example-key-case)
+ [Example 2: Prevent use of a tag key](#tag-policy-example-prevent-key)
+ [Example 3: Specify a tag policy for all supported resource types of a specific AWS service](#tag-policy-example-all-supported)
+ [Example 4: Enforce required tag keys for compliance](#tag-policy-example-required-tags)

## Tag policy syntax
<a name="tag-policy-syntax-reference"></a>

A tag policy is a plaintext file that is structured according to the rules of [JSON](http://json.org). The syntax for tag policies follows the syntax for management policy types. For a complete discussion of that syntax, see [Understanding management policy inheritance](orgs_manage_policies_inheritance_mgmt.md). This topic focuses on applying that general syntax to the specific requirements of the tag policy type.

The following tag policy shows basic tag policy syntax:

```
{
    "tags": {
        "costcenter": {
            "tag_key": {
                "@@assign": "CostCenter"
            },
            "tag_value": {
                "@@assign": [
                    "100",
                    "200",
                    "300*"
                ]
            },
            "enforced_for": {
                "@@assign": [
                    "secretsmanager:ALL_SUPPORTED"
                ]
            }
        }
    }
}
```

Tag policy syntax includes the following elements: 
+ The `tags` field key name. Tag policies always start with this fixed key name. It's the top line in the example policy above.
+ A *policy key* that uniquely identifies the policy statement. It must match the value for the *tag key*, except for the case treatment. The policy value is case sensitive.

  In this example, `costcenter` is the policy key.
+ At least one *tag key* that specifies the allowed tag key with the capitalization that you want resources to be compliant with. If case treatment isn't defined, lowercase is the default case treatment for tag keys. The value for the tag key must match the value for the policy key. But since the policy key value is case insensitive, the capitalization can be different. 

  In this example, `CostCenter` is the tag key. This is the case treatment that is required for compliance with the tag policy. Resources with alternate case treatment for this tag key are noncompliant with the tag policy. 

  You can define multiple tag keys in a tag policy.
+ (Optional) A list of one or more acceptable *tag values* for the tag key. If the tag policy doesn't specify a tag value for a tag key, any value (including no value at all) is considered compliant.

  In this example, acceptable values for the `CostCenter` tag key are `100`, `200`, and `300*`. 
+ (Optional) An `enforced_for` option that indicates whether to prevent any noncompliant tagging operations on specified services and resources. In the console, this is the **Prevent noncompliant operations for this tag** option in the visual editor for creating tag policies. The default setting for this option is null.

  The example tag policy specifies that the `CostCenter` tag applied to all AWS Secrets Manager resources must be compliant with this policy.
**Warning**  
You should only change this option from the default if you are experienced with using tag policies. Otherwise, you could prevent users in your organization's accounts from creating the resources they need. 
+ *Operators* that specify how the tag policy merges with other tag policies within the organization tree to create an account's [effective tag policy](orgs_manage_policies_effective.md). In this example, `@@assign` is used to assign strings to `tag_key`, `tag_value`, and `enforced_for`. For more information about operators, see [Inheritance operators](policy-operators.md).
+ You can use the `*` wildcard in tag values.
  + You can use only one wildcard per tag value. For example, `*@example.com` is allowed, but `*@*.com` is not. 
  + You can use the `ALL_SUPPORTED` wildcard in the `enforced_for` field with some services to enable enforcement for all supported resources for that service. For a list of services and resource types that support `enforced_for`, see [Services and resource types that support enforcement](orgs_manage_policies_supported-resources-enforcement.md). 
  + You can't use a wildcard to specify all services or to specify a resource for all services.

## Tag policy examples
<a name="tag-policy-examples"></a>

The example [tag policies](orgs_manage_policies_tag-policies.md) that follow are for information purposes only.

**Note**  
Before you attempt to use these example tag policies in your organization, note the following:  
Make sure that you've followed the [recommended workflow](orgs_manage_policies_tag-policies-getting-started.md) for getting started with tag policies.
You should carefully review and customize these tag policies for your unique requirements.
All characters in your tag policy are subject to a [maximum size](orgs_reference_limits.md#min-max-values). The examples in this guide show tag policies formatted with extra white space to improve their readability. However, to save space if your policy size approaches the maximum size, you can delete any white space. Examples of white space include space characters and line breaks that are outside quotation marks.
Untagged resources don't appear as noncompliant in results.

## Example 1: Define organization-wide tag key case
<a name="tag-policy-example-key-case"></a>

The following example shows a tag policy that only defines two tag keys and the capitalization that you want accounts in your organization to standardize on. 

**Policy A – organization root tag policy**

```
{
    "tags": {
        "CostCenter": {
            "tag_key": {
                "@@assign": "CostCenter",
                "@@operators_allowed_for_child_policies": ["@@none"]
            }
        },
        "Project": {
            "tag_key": {
                "@@assign": "Project",
                "@@operators_allowed_for_child_policies": ["@@none"]
            }
        }
    }
}
```

This tag policy defines two tag keys: `CostCenter` and `Project`. Attaching this tag policy to the organization root has the following effects:
+ All accounts in your organization inherit this tag policy.
+ All accounts in your organization must use the defined case treatment for compliance. Resources with `CostCenter` and `Project` tags are compliant. Resources with alternate case treatment for the tag key (for example, `costcenter`, `Costcenter`, or `COSTCENTER`) are noncompliant. 
+ The `@@operators_allowed_for_child_policies": ["@@none"]` lines lock down the tag keys. Tag policies that are attached lower in the organization tree (child policies) can't use value-setting operators to change the tag key, including its case treatment.
+ As with all tag policies, untagged resources or tags that aren't defined in the tag policy aren't evaluated for compliance with the tag policy.

AWS recommends that you use this example as a guide in creating a similar tag policy for tag keys that you want to use. Attach it to the organization root. Then create a tag policy similar to the next example, which only defines the acceptable values for the defined tag keys. 

### Next step: Define values
<a name="tag-policy-example-add-values"></a>

Assume that you attached the previous tag policy to the organization root. Next, you can create a tag policy like the following and attach it to an account. This policy defines acceptable values for the `CostCenter` and `Project` tag keys. 

**Policy B – account tag policy**

```
{
    "tags": {
        "CostCenter": {
            "tag_value": {
                "@@assign": [
                    "Production",
                    "Test"
                ]
            }
        },
        "Project": {
            "tag_value": {
                "@@assign": [
                    "A",
                    "B"
                ]
            }
        }
    }
}
```

If you attach Policy A to the organization root and Policy B to an account, the policies combine to create the following effective tag policy for the account:

**Policy A \$1 Policy B = effective tag policy for account**

```
{
    "tags": {
        "Project": {
            "tag_value": [
                "A",
                "B"
            ],
            "tag_key": "Project"
        },
        "CostCenter": {
            "tag_value": [
                "Production",
                "Test"
            ],
            "tag_key": "CostCenter"
        }
    }
}
```

For more information about policy inheritance, including examples of how the inheritance operators work and example effective tag policies, see [Understanding management policy inheritance](orgs_manage_policies_inheritance_mgmt.md).

## Example 2: Prevent use of a tag key
<a name="tag-policy-example-prevent-key"></a>

To prevent the use of a tag key, you can attach a tag policy like the following to an organization entity.

This example policy specifies that no values are acceptable for the `Color` tag key. It also specifies that no [operators](policy-operators.md) are allowed in child tag policies. Therefore, any `Color` tags on resources in affected accounts are considered non-compliant. However, the `enforced_for` option actually prevents affected accounts from tagging ***only*** Amazon DynamoDB tables with the `Color` tag.

```
{
    "tags": {
        "Color": {
            "tag_key": {
                "@@operators_allowed_for_child_policies": [
                    "@@none"
                ],
                "@@assign": "Color"
            },
            "tag_value": {
                "@@operators_allowed_for_child_policies": [
                    "@@none"
                ],
                "@@assign": []
            },
            "enforced_for": {
                "@@assign": [
                    "dynamodb:table"
                ]
            }
        }
    }
}
```

## Example 3: Specify a tag policy for all supported resource types of a specific AWS service
<a name="tag-policy-example-all-supported"></a>

To specify a tag policy for all supported resource types of a specific AWS service, you use the `ALL_SUPPORTED` wildcard.

This policy uses the `ALL_SUPPORTED` wildcard to specify that all Amazon EC2 instances with the tag key `Environment` can only have a tag value of `Prod` or `Non-prod`. This wildcard provides an effective, single-line alternative to listing each Amazon EC2 instance individually. For a list of services and resource types that support the `ALL_SUPPORTED` wildcard, see [Services and resource types that support enforcement](orgs_manage_policies_supported-resources-enforcement.md). 

```
{
    "tags": {
        "Environment": {
            "tag_key": {
                "@@assign": "Environment",
                "@@operators_allowed_for_child_policies": ["@@none"]
            },
            "tag_value": {
                "@@assign": [
                    "Prod",
                    "Non-prod"
                ],
                "@@operators_allowed_for_child_policies": ["@@none"]
            },
            "enforced_for": {
                "@@assign": [
                    "ec2:ALL_SUPPORTED"
                ]
            }
        }
    }
}
```

## Example 4: Enforce required tag keys for compliance
<a name="tag-policy-example-required-tags"></a>

This example demonstrates how to define a tag policy that requires all resources to include mandatory compliance tags. Organizations commonly use this pattern to ensure proper cost allocation, ownership tracking, and environment identification.

```
{
    "tags": {
        "CostCenter": {
            "report_required_tag_for": {
                "@@assign": [
                    "ec2:instance",
                    "s3:bucket",
                    "rds:db",
                    "lambda:function"
                ]
            },
            "tag_key": {
                "@@assign": "CostCenter"
            }
        },
        "Environment": {
            "report_required_tag_for": {
                "@@assign": [
                    "ec2:ALL_SUPPORTED",
                    "rds:ALL_SUPPORTED",
                    "s3:ALL_SUPPORTED"
                ]
            },
            "tag_key": {
                "@@assign": "Environment"
            },
            "tag_value": {
                "@@assign": [
                    "Production",
                    "Staging",
                    "Development",
                    "Test"
                ]
            }
        },
        "Owner": {
            "report_required_tag_for": {
                "@@assign": [
                    "ec2:ALL_SUPPORTED"
                ]
            },
            "tag_key": {
                "@@assign": "Owner"
            }
        }
    }
}
```

When you apply this policy and configure your IaC tool with tag policy enforcement:
+ CostCenter: Required for EC2 instances, S3 buckets, RDS databases, and Lambda functions
+ Environment: Required for all EC2, RDS, and S3 resources, with allowed values restricted to Production, Staging, Development, or Test
+ Owner: Required for all EC2 resources in your organization

Example infrastructure code that complies with this policy:

```
EC2Instance:
    Type: AWS::EC2::Instance
    Properties:
      ImageId: ami-0c02fb55956c7d316
      InstanceType: t2.micro
      Tags:
        - Key: CostCenter
          Value: CC-12345
        - Key: Environment
          Value: Test
        - Key: Owner
          Value: john.doe@company.com
```

If you attempt to create a resource without the required tags, your IaC deployment will fail or generate a warning during the planning phase, depending on your configuration. When configured in fail mode, the deployment is blocked before any resources are created. When configured in warn mode, the deployment proceeds but alerts your team to the missing tags. The validation error message identifies exactly which required tags are missing and which resources need them.

For specific configuration instructions for your IaC tool:
+  **CloudFormation**: See [Enforce with CloudFormation](enforce-required-tag-keys-iac.md#enforce-with-cloudformation) to activate the tagging compliance hook 
+  **Terraform**: See [Enforce with Terraform](enforce-required-tag-keys-iac.md#enforce-with-terraform) to enable tag policy validation in the AWS Provider 
+  **Pulumi**: See [Enforce with Pulumi](enforce-required-tag-keys-iac.md#enforce-with-pulumi) to enable the Tag Policy Reporting policy pack 

# Identify and remediate tagging inconsistencies
<a name="orgs_manage_policies_tag-policies-identify-remediate"></a>

After implementing tag policies in your organization, you can identify resources with non-compliant tags and remediate them to ensure consistency across your AWS environment. This section provides guidance on finding and correcting tagging inconsistencies.

**Topics**
+ [Finding untagged and mistagged resources for your organization with Resource Explorer](finding-untagged-mistagged-resources.md)
+ [Correcting non-compliant tags in resources](enforcement-correcting.md)
+ [Using Amazon EventBridge to monitor noncompliant tags](orgs_manage_policies_tag-policies-cwe.md)

# Finding untagged and mistagged resources for your organization with Resource Explorer
<a name="finding-untagged-mistagged-resources"></a>

To find untagged resources in your account, use AWS Resource Explorer with a query that uses `tag:none`. Resource Explorer provides comprehensive search capabilities to identify resources that lack proper tagging or have inconsistent tag values across your organization. 

For detailed instructions on using Resource Explorer to find untagged and mistagged resources, see [Search for untagged resources](https://docs.aws.amazon.com/resource-explorer/latest/userguide/using-search-query-examples.html#example-1) in the *AWS Resource Explorer User Guide*. 

# Correcting non-compliant tags in resources
<a name="enforcement-correcting"></a>

After finding non-compliant tags, make corrections using any of the following methods. You must be signed in to the account that has the resource with non-compliant tags:
+ Use the console or tagging API operations of the AWS service that created the non-compliant resources.
+ Use the AWS Resource Groups [TagResources](https://docs.aws.amazon.com/resourcegroupstagging/latest/APIReference/API_TagResources.html) and [UntagResources](https://docs.aws.amazon.com/resourcegroupstagging/latest/APIReference/API_UntagResources.html) operations to add tags that are compliant with the effective policy or to remove non-compliant tags. 

# Using Amazon EventBridge to monitor noncompliant tags
<a name="orgs_manage_policies_tag-policies-cwe"></a>

You can use Amazon EventBridge, formerly Amazon CloudWatch Events, to monitor when noncompliant tags are introduced. In the following example event, the `"false"` value for `tag-policy-compliant` indicates that a new tag is noncompliant with the effective tag policy.

```
{
  "detail-type": "Tag Change on Resource",
  "region": "us-east-1",
  "resources": [
    "arn:aws:ec2:us-east-1:123456789012:instance/i-0000000aaaaaaaaaa"
  ],
  "detail": {
    "changed-tag-keys": [
      "a-new-key"
    ],
    "service": "ec2",
    "resource-type": "instance",
    "version": 3,
    "tag-policy-compliant": "false",
    "tags": {
      "a-new-key": "tag-value-on-new-key-just-added"
    }
  }
}
```

You can subscribe to events and specify strings or patterns to monitor. For more information on EventBridge, see the *[Amazon EventBridge User Guide](https://docs.aws.amazon.com/eventbridge/latest/userguide/)*.

# Services and resource types that support enforcement
<a name="orgs_manage_policies_supported-resources-enforcement"></a>

The following services and resource types support enforcement with tag policies:

[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_supported-resources-enforcement.html)
+ See [Terraform documentation](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/guides/tag-policy-compliance) for resource type support in Terraform AWS Provider. 
+ See [Pulumi documentation](https://www.pulumi.com/docs/insights/policy/integrations/aws-organizations-tag-policies/#aws-provider-types) for resource type support in Pulumi Cloud. 

# Supported Regions
<a name="orgs_manage_policies_tag-policies-supported-regions"></a>

Tag policy features are available in the following Regions: 


| Region name | Region parameter | 
| --- | --- | 
| US East (N. Virginia) Region¹ |  **`us-east-1`**  | 
|  US East (Ohio) Region  |  `us-east-2`  | 
|  US West (N. California) Region  |  `us-west-1`  | 
|  US West (Oregon) Region  |  `us-west-2`  | 
|  Africa (Cape Town) Region²  |  `af-south-1`  | 
|  Asia Pacific (Hong Kong) Region²  |  `ap-east-1`  | 
|  Asia Pacific (Taipei)²  |  `ap-east-2`  | 
|  Asia Pacific (Mumbai) Region  |  `ap-south-1`  | 
|  Asia Pacific (Hyderabad)²  |  `ap-south-2`  | 
|  Asia Pacific (Tokyo) Region  |  `ap-northeast-1`  | 
|  Asia Pacific (Seoul) Region  |  `ap-northeast-2`  | 
|  Asia Pacific (Osaka) Region  |  `ap-northeast-3`  | 
|  Asia Pacific (Singapore) Region  |  `ap-southeast-1`  | 
|  Asia Pacific (Sydney) Region  |  `ap-southeast-2`  | 
|  Asia Pacific (Jakarta) Region²  |  `ap-southeast-3`  | 
|  Asia Pacific (Melbourne)²  |  `ap-southeast-4`  | 
|  Asia Pacific (Malaysia) Region  |  `ap-southeast-5`  | 
|  Asia Pacific (New Zealand)²  |  `ap-southeast-6`  | 
|  Asia Pacific (Thailand)  |  `ap-southeast-7`  | 
|  Canada (Central) Region  |  `ca-central-1`  | 
|  Canada West (Calgary)²  |  `ca-west-1`  | 
|  China (Beijing) Region  |  `cn-north-1`  | 
|  China (Ningxia) Region  |  `cn-northwest-1`  | 
|  Europe (Frankfurt) Region  |  `eu-central-1`  | 
|  Europe (Zurich) Region²  |  `eu-central-2`  | 
|  Europe (Milan) Region²  |  `eu-south-1`  | 
|  Europe (Spain)²  |  `eu-south-2`  | 
|  Europe (Ireland) Region  |  `eu-west-1`  | 
|  Europe (London) Region  |  `eu-west-2`  | 
|  Europe (Paris) Region  |  `eu-west-3`  | 
|  Europe (Stockholm) Region  |  `eu-north-1`  | 
|  Mexico (Central) Region  |  `mx-central-1`  | 
|  Middle East (UAE) Region²  |  `me-central-1`  | 
|  Middle East (Bahrain) Region²  |  `me-south-1`  | 
|  South America (São Paulo) Region  |  `sa-east-1`  | 
|  Israel (Tel Aviv)²  |  `il-central-1`  | 
|  AWS GovCloud (US-East)  |  `us-gov-east-1`  | 
|  AWS GovCloud (US-West)  |  `us-gov-west-1`  | 

**¹You must specify the `us-east-1` Region when calling the following Organizations operations:**
+ [DeletePolicy](https://docs.aws.amazon.com/organizations/latest/APIReference/API_DeletePolicy.html)
+ [DisablePolicyType](https://docs.aws.amazon.com/organizations/latest/APIReference/API_DisablePolicyType.html)
+ [EnablePolicyType](https://docs.aws.amazon.com/organizations/latest/APIReference/API_EnablePolicyType.html)
+ Any other operations on an organization root, such as [ListRoots](https://docs.aws.amazon.com/organizations/latest/APIReference/API_ListRoots.html).

**You must also specify the `us-east-1` Region when calling the following Resource Groups Tagging API operations that are part of the tag policies feature:**
+ [DescribeReportCreation](https://docs.aws.amazon.com/resourcegroupstagging/latest/APIReference/API_DescribeReportCreation.html)
+ [GetComplianceSummary](https://docs.aws.amazon.com/resourcegroupstagging/latest/APIReference/API_GetComplianceSummary.html)
+ [StartReportCreation](https://docs.aws.amazon.com/resourcegroupstagging/latest/APIReference/API_StartReportCreation.html)

**Note**  
To evaluate organization-wide compliance with tag policies, you must also have access to an Amazon S3 bucket in the US East (N. Virginia) Region for report storage. For more information, see [Amazon S3 bucket policy for report storage](https://docs.aws.amazon.com/ARG/latest/userguide/tag-policies-prereqs.html#bucket-policy) in the *Tagging AWS Resources User Guide*.

²These Regions must be manually enabled. To learn more about enabling and disabling AWS Regions, see [Specify which AWS Regions your account can use](https://docs.aws.amazon.com/accounts/latest/reference/manage-acct-regions.html) in the *AWS Account Management Reference Guide*. The Resource Groups console isn't available in these Regions.

# Chat applications policies
<a name="orgs_manage_policies_chatbot"></a>

Chat applications policies in AWS Organizations enable you to control access to your organization's accounts from chat applications such as Slack and Microsoft Teams.

[Amazon Q Developer in chat applications](https://docs.aws.amazon.com/chatbot/latest/adminguide/what-is.html) is an AWS service that enables DevOps and software development teams to use messaging program chat rooms to monitor and respond to operational events in their AWS Cloud. Amazon Q Developer in chat applications processes AWS service notifications from Amazon Simple Notification Service (Amazon SNS), and forwards them to chat rooms so teams can analyze and act on them immediately, regardless of location.

## How chat applications policies work
<a name="orgs_manage_policies_chatbot_how_work"></a>

Using chat applications policies, the management account or delegated administrator of an organization can do the following across an organization:
+ Enforce which supported chat applications (Amazon Chime, Microsoft Teams, and Slack) can be used.
+ Restrict chat client access to specific workspaces (Slack) and teams (Microsoft Teams).
+ Restrict Slack channel visibility to either public or private channels.
+ Set and enforce specific [role settings](https://docs.aws.amazon.com/chatbot/latest/adminguide/understanding-permissions.html#role-settings).

Chat applications policies restrict and take precedence over account level settings such as [role settings](https://docs.aws.amazon.com/chatbot/latest/adminguide/understanding-permissions.html#role-settings) and [channel guardrail policies](https://docs.aws.amazon.com/chatbot/latest/adminguide/understanding-permissions.html#channel-guardrails). You can access and modify chat applications policies from the Amazon Q Developer in chat applications or the Organizations console.

After the policies are attached to accounts and organizational units (OU), any current and future Amazon Q Developer in chat applications configurations for the accounts in scope will automatically comply with the governance and permissions settings. For more information, see [Understanding management policy inheritance](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_inheritance_mgmt.html).

If you try to perform an action restricted by a chat applications policy, an error message will notify you that the action is not allowed due to the chat applications policy with the recommendation to contact the management account or delegated administrator of your organization.

**Note**  
Chat applications policies are validated at runtime. This means that existing resources are continuously checked for compliance. There is no overlap with existing IAM permissions since runtime-based IAM permissions for sending notifications or interacting with Amazon Q Developer in chat applications are not currently supported.

# Getting started with chat applications policies
<a name="orgs_manage_policies-chatbot_getting-started"></a>

Follow these steps to get started using chat applications policies.

1. [Learn about the permissions you must have to perform chat applications policy tasks](orgs_manage_policies_prereqs.md).

1. [Enable chat applications policies for your organization](enable-policy-type.md).

1. [Create a chat applications policy](orgs_policies_create.md).

1. [Attach the chat applications policy to your organization's root, OU, or account](orgs_policies_attach.md).

1. [View the combined effective chat applications policy that applies to an account](orgs_manage_policies_effective.md).

For all of these steps, you sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization's management account.

**Other information**
+ [Learn chat applications policy syntax and see example policies](orgs_manage_policies_chatbot_syntax.md)

# Chat applications policy syntax and examples
<a name="orgs_manage_policies_chatbot_syntax"></a>

This topic describes chat applications policy syntax and provides examples.

## Syntax for chat applications policies
<a name="chatbot-policy-syntax-reference"></a>

A chat applications policy is a plaintext file that is structured according to the rules of [JSON](http://json.org). The syntax for chat applications policies follows the syntax for management policy types. For a complete discussion of that syntax, see [Understanding management policy inheritance](orgs_manage_policies_inheritance_mgmt.md). This topic focuses on applying that general syntax to the specific requirements of the chat applications policy type.

The following example shows the basic syntax for a chat applications policy:

```
{
    "chatbot":{
       "platforms":{
          "slack":{
             "client":{
                "@@assign":"enabled" // enabled | disabled
             },
             "workspaces": { // limit 255
                   "@@assign":[
                      "Slack-Workspace-Id"
                   ]
             },
             "default":{
                "supported_channel_types":{
                   "@@assign":[
                      "private" // public | private
                   ]
                },
                "supported_role_settings":{
                   "@@assign":[
                      "user_role" // user_role | channel_role
                   ]
                }
             },
             "overrides":{ // limit 255
                "Slack-Workspace-Id":{
                   "supported_channel_types":{
                      "@@assign":[
                         "public" // public | private
                      ]
                   },
                   "supported_role_settings":{
                      "@@assign":[
                         "user_role" // user_role | channel_role
                      ]
                   }
                }
             }
          },
          "microsoft_teams":{
             "client":{
                "@@assign":"enabled"
             },
             "tenants":{ // limit 36
                "Microsoft-Teams-Tenant-Id":{ // limit 36
                   "@@assign":[
                      "Microsoft-Teams-Team-Id"
                   ]
                }
             },
             "default":{
                "supported_role_settings":{
                   "@@assign":[
                      "user_role" // user_role | channel_role
                   ]
                }
             },
             "overrides":{ // limit 36
                "Microsoft-Teams-Tenant-Id":{ // limit 36
                   "Microsoft-Teams-Team-Id":{
                      "supported_role_settings":{
                         "@@assign":[
                            "user_role" // user_role | channel_role
                         ]
                      }
                   }
                }
             }
          },
          "chime":{
            "client":{
               "@@assign":"disabled" // enabled | disabled
            }
         } 
       },
       "default":{
          "client":{
             "@@assign":"disabled" // enabled | disabled
          }
       }
    }
 }
```

This chat applications policy includes the following elements:
+ The `chatbot` field key name. Chat applications policies always start with this fixed key name. It's the top line in this example policy.
+ Under `chatbot`, there is a `platforms` block, which contains the configuration for the different supported chat applications: Slack, Microsoft Teams, and Amazon Chime.
  + For Slack, the following fields are available:
    + `"client"`:
      + `"enabled"`: The Slack client is enabled. Slack integrations are allowed.
      + `"disabled"`: The Slack client is disabled. Slack integrations are not allowed.
    + `"workspaces"`: Comma-separated listed of allowed Slack workspaces. In this example, the allowed Slack workspaces are *Slack-Workspace-Id1* and *Slack-Workspace-Id2*.
    + `"default"`: The default settings for Slack workspaces.
      + `"supported_channel_types"`:
        + `"public"`: Slack workspaces in scope allow public Slack channels by default.
        + `"private"`: Slack workspaces in scope allow private Slack channels by default.
      + `supported_role_settings`:
        + `"user_role"`: Slack workspaces in scope allow User level IAM roles by default.
        + `"channel_role"`: Slack workspaces in scope allow Channel level IAM roles by default.
    + `"overrides"`: The override settings for the Slack workspaces.
      + `Slack-Workspace-Id2`: Comma-separated listed of Slack workspaces where the override setting apply. In this example, the Slack workspace is *Slack-Workspace-Id2*.
        + `"supported_channel_types"`:
          + `"public"`: Override setting whether Slack workspaces in scope allow public Slack channels.
          + `"private"`: Override setting whether Slack workspaces in scope allow private Slack channels.
        + `supported_role_settings`:
          + `"user_role"`: Override setting whether Slack workspaces in scope allow User level IAM roles.
          + `"channel_role"`: Override setting whether Slack workspaces in scope allow Channel level IAM roles.
  + For Microsoft Teams, the following fields are available:
    + `"client"`:
      + `"enabled"`: The Microsoft Teams client is enabled. Microsoft Teams integrations are allowed.
      + `"disabled"`: The Microsoft Teams client is disabled. Microsoft Teams integrations are not allowed.
    + `"tenants"`: Comma-separated listed of allowed Microsoft Teams tenants. In this example, the allowed tenant is *Microsoft-Teams-Tenant-Id*.
      + `Microsoft-Teams-Tenant-Id`: Comma-separated list of allowed teams within the tenant. In this example, the allowed team is *Microsoft-Teams-Team-Id*.
    + `"default"`: The default settings for the teams within the tenant.
      + `supported_role_settings`:
        + `"user_role"`: Teams in scope allow User level IAM roles by default.
        + `"channel_role"`: Teams in scope allow Channel level IAM roles by default.
    + `"overrides"`: The override settings for the Microsoft Teams tenants.
      + `Microsoft-Teams-Tenant-Id`: Comma-separated listed of tenants where the override setting apply. In this example, the tenant is *Microsoft-Teams-Tenant-Id*.
        + `Microsoft-Teams-Team-Id`: Comma-separate listed of teams within the tenant. In this example, the allowed team is *Microsoft-Teams-Team-Id*.
          + `supported_role_settings`:
            + `"user_role"`: Override setting whether the teams in scope allow User level IAM roles.
            + `"channel_role"`: Override setting whether the teams in scope allow Channel level IAM roles.
  + For Amazon Chime, the following fields are available:
    + `"client"`:
      + `"enabled"`: The Amazon Chime client is enabled. Amazon Chime integrations are allowed.
      + `"disabled"`: The Amazon Chime client is disabled. Amazon Chime integrations are not allowed.
+ Under `chatbot`, there is a `default` block which disables Amazon Q Developer in chat applications across the organization unless overridden at a lower level. This default also disables any new chat application that Amazon Q Developer in chat applications supports. For example, if Amazon Q Developer in chat applications supports a new chat application, this default disables that newly supported chat application as well.

**Note**  
For more information about Channel level IAM roles and User level IAM roles, see [Understanding Amazon Q Developer in chat applications permissions](https://docs.aws.amazon.com/chatbot/latest/adminguide/understanding-permissions.html) in the *Amazon Q Developer in chat applications Administrator Guide*.

## Chat applications policy examples
<a name="chatbot-policy-examples"></a>

The example policies that follow are for information purposes only.

### Example 1: Allow only private Slack Channels in a specific workspace, disable Microsoft Teams, all authentication modes supported
<a name="chatbot-policy-example-1"></a>

The following policy is focused on controlling the allowed configurations for Slack and Microsoft Teams chatbot integrations.

```
{
   "chatbot": {
      "platforms": {
         "slack": {
            "client": {
               "@@assign": "enabled"
            },
            "workspaces": {
               "@@assign": [
                  "Slack-Workspace-Id"
               ]
            },
            "default": {
               "supported_channel_types": {
                  "@@assign": [
                     "private"
                  ]
               },
               "supported_role_settings": {
                  "@@assign": [
                     "channel_role",
                     "user_role"
                  ]
               }
            }
         },
         "microsoft_teams": {
            "client": {
               "@@assign": "disabled"
            }
         },
         "chime":{
            "client":{
               "@@assign":"disabled"
            }
         },
         "default":{
            "client":{
               "@@assign":"disabled"
            }
         }
      }
   }
}
```

**For Slack**
+ The Slack client is enabled.
+ Only the specific Slack workspace *Slack-Workspace-Id* is allowed.
+ The default settings are to allow only private Slack channels, Channel level IAM roles, and User level IAM roles.

**For Microsoft Team**
+ The Microsoft Teams client is disabled.

**For Amazon Chime**
+ The Amazon Chime client is disabled.

**Additional details**
+ The `default` block at the bottom sets the client to be disabled, which disables Amazon Q Developer in chat applications across the organization unless overridden at a lower level. This default also disables any new chat application that Amazon Q Developer in chat applications supports. For example, if Amazon Q Developer in chat applications supports a new chat application, this default disables that newly supported chat application as well.

### Example 2: Allow only Slack integrations with User Level IAM roles
<a name="chatbot-policy-example-2"></a>

The following policy takes a more permissive approach to Slack, allowing all Slack workspaces but restricting the authentication mode to only User level IAM roles.

```
{
   "chatbot":{
      "platforms":{
         "slack":{
            "client":{
               "@@assign":"enabled"
            },
            "workspaces":
               {
                  "@@assign":[
                     "*"
                  ]
               },
            "default":{
               "supported_role_settings":{
                  "@@assign":[
                     "user_role"
                  ]
               }
            }
         },
         "microsoft_teams":{
            "client":{
               "@@assign":"disabled"
            }
         },
         "chime":{
            "client":{
               "@@assign":"disabled"
            }
         }
      },
      "default":{
         "client":{
            "@@assign":"disabled"
         }
      }
   }
}
```

**For Slack**
+ The Slack client is enabled.
+ No specific Slack workspaces are defined using the wildcard `"*"`, so all workspaces are permitted.
+ The default settings are to allow only User level IAM roles.

**For Microsoft Team**
+ The Microsoft Teams client is disabled.

**For Amazon Chime**
+ The Amazon Chime client is disabled.

**Additional details**
+ The `default` block at the bottom sets the client to be disabled, which disables Amazon Q Developer in chat applications across the organization unless overridden at a lower level. This default also disables any new chat application that Amazon Q Developer in chat applications supports. For example, if Amazon Q Developer in chat applications supports a new chat application, this default disables that newly supported chat application as well.

### Example 3: Allow only Microsoft Teams integrations in a specific Tenants
<a name="chatbot-policy-example-3"></a>

The following example policy locks down the organization to only allow Microsoft Teams chatbot integrations within the specified tenant, while completely blocking Slack integrations.

```
{
   "chatbot":{
      "platforms":{
         "slack":{
            "client": {
               "@@assign": "disabled"
            },
         },
         "microsoft_teams":{
            "client": {
               "@@assign": "enabled"
            },
            "tenants":{
               "Microsoft-Teams-Tenant-Id":{
                  "@@assign":[
                     "*"
                  ]
               }
            }
         },
         "chime": {
            "client":{
               "@@assign": "disabled"
            }
         }  
      }
   }
}
```

**For Slack**
+ The Slack client is disabled.

**For Microsoft Team**
+ Only the specific tenant *Microsoft-Teams-Tenant-Id* is permitted, using the wildcard `"*"` to allow all teams within that tenant.

**For Amazon Chime**
+ The Amazon Chime client is disabled.

**Additional details**
+ The `default` block at the bottom sets the client to be disabled, which disables Amazon Q Developer in chat applications across the organization unless overridden at a lower level. This default also disables any new chat application that Amazon Q Developer in chat applications supports. For example, if Amazon Q Developer in chat applications supports a new chat application, this default disables that newly supported chat application as well.

### Example 4: Allows restricted Amazon Q Developer in chat applications access for Slack workspaces and a Microsoft Teams tenant
<a name="chatbot-policy-example-4"></a>

The following policy allows restricted Amazon Q Developer in chat applications access for selected Slack workspaces and a Microsoft Teams tenant.

```
{
    "chatbot":{
       "platforms":{
          "slack":{
             "client":{
                "@@assign":"enabled"
             },
             "workspaces": { 
                   "@@assign":[
                      "Slack-Workspace-Id1",
                      "Slack-Workspace-Id2"
                   ]
             },
             "default":{
                "supported_channel_types":{
                   "@@assign":[
                      "private"
                   ]
                },
                "supported_role_settings":{
                   "@@assign":[
                      "user_role"
                   ]
                }
             },
             "overrides":{
                "Slack-Workspace-Id2":{
                   "supported_channel_types":{
                      "@@assign":[
                         "public",
                         "private"
                      ]
                   },
                   "supported_role_settings":{
                      "@@assign":[
                         "channel_role",
                         "user_role"
                      ]
                   }
                }
             }
          },
          "microsoft_teams":{
             "client":{
                "@@assign":"enabled"
             },
             "tenants":{
                "Microsoft-Teams-Tenant-Id":{
                   "@@assign":[
                      "Microsoft-Teams-Team-Id"
                   ]
                }
             },
             "default":{
                "supported_role_settings":{
                   "@@assign":[
                      "user_role"
                   ]
                }
             },
             "overrides":{
                "Microsoft-Teams-Tenant-Id":{
                   "Microsoft-Teams-Team-Id":{
                      "supported_role_settings":{
                         "@@assign":[
                            "channel_role",
                            "user_role"
                         ]
                      }
                   }
                }
             }
          }
       },
       "default":{
          "client":{
             "@@assign":"disabled"
          }
       }
    }
 }
```

**For Slack**
+ The Slack client is enabled.
+ The allowed Slack workspaces are *Slack-Workspace-Id1* and *Slack-Workspace-Id2*.
+ The default settings for Slack are to only allow private channels and User level IAM roles.
+ There is an override for the workspace *Slack-Workspace-Id2* that allows both public and private channels as well as both Channel level IAM roles and User level IAM roles.

**For Microsoft Team**
+ The Microsoft Teams is enabled.
+ The allowed Teams tenants are *Microsoft-Teams-Tenant-Id* with the team *Microsoft-Teams-Team-Id*.
+ The default settings are to only allow User level IAM roles.
+ There is an override for the tenant *Microsoft-Teams-Tenant-Id* that allows both Channel level IAM roles and User level IAM roles for the team *Microsoft-Teams-Team-Id*.

**Additional details**
+ The `default` block at the bottom sets the client to be disabled, which disables Amazon Q Developer in chat applications across the organization unless overridden at a lower level. This means Amazon Chime is disabled in this example. This default also disables any new chat application that Amazon Q Developer in chat applications supports. For example, if Amazon Q Developer in chat applications supports a new chat application, this default disables that newly supported chat application as well.

# AI services opt-out policies
<a name="orgs_manage_policies_ai-opt-out"></a>

AWS AI services may use and store customer content for service improvement, such as fixing operational issues, evaluating service performance, debugging, or model training. For this purpose, we might store such content in an AWS Region outside of the AWS Region where you are using the service. You can opt out of use of your content for service improvement by using the AWS Organizations opt-out policy.

You can create opt-out policies for an individual AI service, or for all services supported by AI services opt-out policies. You can also query the effective policy applicable to each account to see the effects of your setting choices.

For more detailed information, see [AWS Machine Learning and Artificial Intelligence Services](https://aws.amazon.com/service-terms) in the AWS Service Terms. For a list of services supported by AI services opt-out policies, see [List of supported AI services](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_ai-opt-out_all.html#ai-opt-out-all-list).

**Topics**
+ [Considerations](#orgs_manage_policies-ai-opt-out-considerations)
+ [Getting started](orgs_manage_policies-ai-opt-out_getting-started.md)
+ [Opt out from all AI services](orgs_manage_policies_ai-opt-out_all.md)
+ [AI services opt-out policy syntax and examples](orgs_manage_policies_ai-opt-out_syntax.md)

## Considerations when using AI services opt-out policies
<a name="orgs_manage_policies-ai-opt-out-considerations"></a>

**Opting out deletes all of the associated historical content**

When you opt out of content use by an AWS AI service, that service deletes all of the associated historical content that was shared with AWS before you set the option. This deletion is limited to content stored that is not required to provide service functions.

For example, when you use a service while opted in, that service might store copies of your content for service improvement. When you opt out, any copies that have been stored by the service for that purpose are deleted, but any content that is used to provide the service to you is not deleted.

# Getting started with AI services opt-out policies
<a name="orgs_manage_policies-ai-opt-out_getting-started"></a>

Follow these steps to get started using Artificial Intelligence (AI) services opt-out policies.

1. [Learn about the permissions you must have to perform backup policy tasks](orgs_manage_policies_prereqs.md).

1. [Enable AI services opt-out policies for your organization](enable-policy-type.md).

1. [Create an AI services opt-out policy](orgs_policies_create.md#create-ai-opt-out-policy-procedure).

1. [Attach the AI services opt-out policy to your organization's root, OU, or account](orgs_policies_attach.md).

1. [View the combined effective AI services opt-out policy that applies to an account](orgs_manage_policies_effective.md).

For all of these steps, you sign in as an AWS Identity and Access Management (IAM) user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization's management account.

**Other information**
+ [Learn policy syntax for AI services opt-out policies and see policy examples](orgs_manage_policies_ai-opt-out_syntax.md)

# Opt out from all supported AWS AI services
<a name="orgs_manage_policies_ai-opt-out_all"></a>

**In this topic:**
+ You can opt out with a one button selection in the AWS Organizations console.
+ You can opt out by attaching the provided example policy using the AWS CLI & AWS SDKs.
+ You can view a list of AWS services supported by the AI services opt-out policy.

## Opt out from all supported AI services
<a name="ai-opt-out-all-procedure"></a>

You can opt your organization out of having its content used for service improvement by creating and attaching an AI services opt-out policy. This policy applies to all current and future supported AWS AI services. Member accounts cannot update the policy.

------
#### [ AWS Management Console ]

**To opt out from all AI services**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[AI services opt-out policies](https://console.aws.amazon.com/organizations/v2/home/policies/aiservices-opt-out-policy)** page, choose **Opt out from all services**. 

1. On the **Opt out from all services** confirmation page, choose **Opt out from all services**.

------
#### [ AWS CLI & AWS SDKs ]

**To opt out from all AI services**

1. Copy "Example 1: Opt out of all AI services for all accounts in the organization" in [AI services opt-out examples](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_ai-opt-out_syntax.html#ai-opt-out-policy-examples).

1. Follow the instruction in [Attaching and detaching AI services opt-out](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_ai-opt-out_attach.html).

------

**Note**  
Additional steps are required to opt out from Amazon Monitron. For more information, see [AWS Service Terms](https://aws.amazon.com/service-terms/#81._Industrial_AI_Services).

## List of services supported by the AI services opt-out policy
<a name="ai-opt-out-all-list"></a>

The following is a list of AWS services supported by the AI services opt-out policy:
+ [Amazon AI Operations](https://aws.amazon.com/what-is/aiops)
+ [Amazon Chime SDK voice analytics](https://docs.aws.amazon.com/chime-sdk/latest/dg/voice-analytics.html)
+ [Amazon CloudWatch](https://docs.aws.amazon.com/cloudwatch)
+ [Amazon CodeGuru Profiler](https://docs.aws.amazon.com/codeguru)
+ [Amazon CodeWhisperer](https://docs.aws.amazon.com/codewhisperer) (now part of [Amazon Q Developer](https://docs.aws.amazon.com/amazonq))
+ [Amazon Comprehend](https://docs.aws.amazon.com/comprehend)
+ [Amazon Connect](https://docs.aws.amazon.com/connect)
+ [Amazon Connect Optimization](https://docs.aws.amazon.com/connect)
+ [Amazon Connect Contact Lens](https://docs.aws.amazon.com/connect/latest/adminguide/contact-lens.html)
+ [AWS Database Migration Service](https://docs.aws.amazon.com/dms)
+ [Amazon DataZone](https://docs.aws.amazon.com/datazone) (and [Amazon SageMaker Data Agent](https://docs.aws.amazon.com/sagemaker-unified-studio/latest/userguide/sagemaker-data-agent.html))
+ [AWS DevOps Agent](https://docs.aws.amazon.com/devopsagent/latest/userguide/about-aws-devops-agent.html)
+ [AWS Entity Resolution](https://docs.aws.amazon.com/entityresolution)
+ [Amazon Fraud Detector](https://docs.aws.amazon.com/frauddetector)
+ [AWS Glue](https://docs.aws.amazon.com/glue)
+ [Amazon GuardDuty](https://docs.aws.amazon.com/guardduty)
+ [Amazon Lex](https://docs.aws.amazon.com/lex)
+ [Amazon Polly](https://docs.aws.amazon.com/polly)
+ [Amazon Q](https://docs.aws.amazon.com/amazonq)
+ [Amazon Quick](https://docs.aws.amazon.com/quicksight)
+ [Amazon Rekognition](https://docs.aws.amazon.com/rekognition)
+ [Amazon Security Lake](https://docs.aws.amazon.com/security-lake/)
+ [AWS Supply Chain](https://docs.aws.amazon.com/aws-supply-chain)
+ [Amazon Textract](https://docs.aws.amazon.com/textract)
+ [Amazon Transcribe](https://docs.aws.amazon.com/transcribe)
+ [AWS Transform](https://docs.aws.amazon.com/transform/latest/userguide/what-is.html)
+ [Amazon Translate](https://docs.aws.amazon.com/translate)
+ [Amazon WorkSpaces](https://docs.aws.amazon.com/workspaces)
+ [AWS Security Hub](https://docs.aws.amazon.com/securityhub)

# AI services opt-out policy syntax and examples
<a name="orgs_manage_policies_ai-opt-out_syntax"></a>

This topic describes Artificial Intelligence (AI) services opt-out policy syntax and provides examples.

## Syntax for AI services opt-out policies
<a name="ai-opt-out-policy-syntax-reference"></a>

An AI services opt-out policy is a plaintext file that is structured according to the rules of [JSON](http://json.org). The syntax for AI services opt-out policies follows the syntax for management policy types. For a complete discussion of that syntax, see [Understanding management policy inheritance](orgs_manage_policies_inheritance_mgmt.md). This topic focuses on applying that general syntax to the specific requirements of the AI services opt-out policy type.

**Important**  
The capitalization of the values discussed in this section are important. Enter the values with upper and lower case letters as shown in this topic. The policies do not work if you use unexpected capitalization.

The following policy shows the basic AI services opt-out policy syntax. If this example was attached directly to an account, that account would be explicitly opted out of one service and opted in to another. Other services could be opted in or opted out by policies inherited from higher levels (OU or root policies).

```
{
    "services": {
        "rekognition": {
            "opt_out_policy": {
                "@@assign": "optOut"
            }
        },
        "lex": {
            "opt_out_policy": {
                "@@assign": "optIn"
            }
        }
    }
}
```

Imagine the following example policy attached to the organization's root. It sets the default for the organization to opt out of all AI services. This automatically includes any AI services not otherwise explicitly exempted, including any AI services that AWS might deploy in the future. You can attach child policies to OUs or directly to accounts to override this setting for any AI service except Amazon Comprehend. The second entry in the following example uses `@@operators_allowed_for_child_policies` set to `none` to prevent it from being overridden. The third entry in the example makes an organization-wide exemption for Amazon Rekognition. It opts in the entire organization for that service, but the policy does allow child policies to override where appropriate.

```
{
    "services": {
        "default": {
            "opt_out_policy": {
                "@@assign": "optOut"
            }
        },
        "comprehend": {
            "opt_out_policy": {
                "@@operators_allowed_for_child_policies": ["@@none"],
                "@@assign": "optOut"
            }
        },
        "rekognition": {
            "opt_out_policy": {
                "@@assign": "optIn"
            }
        }
    }
}
```

AI services opt-out policy syntax includes the following elements: 
+ The `services` element. An AI services opt-out policy is identified by this fixed name as the outermost JSON containing element.

  An AI services opt-out policy can have one or more statements under the `services` element. Each statement contains the following elements: 
  + A *service name key* that identifies an AWS AI service. The following key names are valid values for this field:
    + **`default`** – represents **all** currently available AI services and implicitly and automatically includes any AI services that might be added in the future.
    + `aiops`
    + `aidevops`
    + `awssupplychain`
    + `chimesdkvoiceanalytics`
    + `cloudwatch`
    + `codeguruprofiler`
    + `codewhisperer`
    + `comprehend`
    + `connect`
    + `connectamd`
    + `connectoptimization`
    + `contactlens`
    + `datazone`
    + `dms`
    + `entityresolution`
    + `frauddetector`
    + `glue`
    + `guardduty`
    + `lex`
    + `polly`
    + `q`
    + `quicksightq`
    + `rekognition`
    + `securitylake`
    + `textract`
    + `transcribe`
    + `transform`
    + `translate`
    + `workspaces`
    + `securityhub`

    Each policy statement identified by a service name key can contain the following elements:
    + The `opt_out_policy` key. This key must be present. This is the only key you can place under a service name key.

      The `opt_out_policy` key can contain ***only*** the `@@assign` operator with one of the following values:
      + `optOut` – you choose to opt out of content use for the specified AI service.
      + `optIn` – you choose to opt in to content use for the specified AI service.
**Notes**  
You can't use the `@@append` and `@@remove` inheritance operators in AI services opt-out policies.
You can't use the `@@enforced_for` operator in AI services opt-out policies.
  + At any level, you can specify the `@@operators_allowed_for_child_policies` operator to control what child policies can do to override settings imposed by parent policies. You can specify one of the following values:
    + `@@assign` – child policies of this policy can use the `@@assign` operator to override the inherited value with a different value.
    + `@@none` – child policies of this policy can't change the value.

    The behavior of the `@@operators_allowed_for_child_policies` depends on where you place it. You can use the following locations:
    + Under the `services` key – controls whether a child policy can add to or change the list of services in the effective policy.
    + Under the key for a specific AI service or the `default` key - controls whether a child policy can add to or change the list of keys under this specific entry.
    + Under the `opt_out_policies` key for a specific service – controls whether a child policy can change only the setting for this specific service.

## AI services opt-out policy examples
<a name="ai-opt-out-policy-examples"></a>

The example policies that follow are for information purposes only.

### Example 1: Opt out of all AI services for all accounts in the organization
<a name="ai-opt-out-policy-example-1"></a>

The following example shows a policy that you could attach to your organization's root to opt out of AI services for accounts in your organization. 

**Tip**  
If you copy the following example using the copy button in the example's upper-right corner, the copy doesn't include the line numbers. It's ready to paste.

```
    | {
    |     "services": {
[1] |         "@@operators_allowed_for_child_policies": ["@@none"],
    |         "default": {
[2] |             "@@operators_allowed_for_child_policies": ["@@none"],
    |             "opt_out_policy": {
[3] |                 "@@operators_allowed_for_child_policies": ["@@none"],
    |                 "@@assign": "optOut"
    |             }
    |         }
    |     }
    | }
```
+ [1] – The `"@@operators_allowed_for_child_policies": ["@@none"]` that is under `services` prevents any child policy from adding any new sections for individual services other than the `default` section that is already there. `Default` is the placeholder that represents "all AI services".
+ [2] – The `"@@operators_allowed_for_child_policies": ["@@none"]` that is under `default` prevents any child policy from adding any new sections other than the `opt_out_policy` section that is already there.
+ [3] – The `"@@operators_allowed_for_child_policies": ["@@none"]` that is under `opt_out_policy` prevents child policies from changing the value of the `optOut` setting or adding any additional settings. 

### Example 2: Set an organization default setting for all services, but allow child policies to override the setting for individual services
<a name="ai-opt-out-policy-example-2"></a>

The following example policy sets an organization-wide default for all AI services. The value for `default` prevents a child policy from change the `optOut` value for service `default`, the placeholder for all AI services. If this policy is applied as a parent policy by attaching it to the root or to an OU, child policies can still change the opt-out setting for individual services, as shown in the second policy.
+ Because there is no `"@@operators_allowed_for_child_policies": ["@@none"]` under the `services` key, child policies can add new sections for individual services.
+ The `"@@operators_allowed_for_child_policies": ["@@none"]` that is under `default` prevents any child policy from adding any new sections other than the `opt_out_policy` section that is already there.
+ The `"@@operators_allowed_for_child_policies": ["@@none"]` that is under `opt_out_policy` prevents child policies from changing the value of the `optOut` setting or adding any additional settings. 

**Organization root userAI services opt-out parent policy**

```
{
    "services": {
        "default": {
            "@@operators_allowed_for_child_policies": ["@@none"],
            "opt_out_policy": {
                "@@operators_allowed_for_child_policies": ["@@none"],
                "@@assign": "optOut"
            }
        }
    }
}
```

The following example policy assumes that the previous example policy is attached to either the organization root or to a parent OU, and that you attach this example to an account affected by the parent policy. It overrides the default opt-out setting and explicitly opts in to only the Amazon Lex service.

**AI services opt-out child policy**

```
{
    "services": {
        "lex": {
            "opt_out_policy": {
                "@@assign": "optIn"
            }
        }
    }
}
```

The resulting effective policy for the AWS account is that the account opts in to only Amazon Lex, and opts out of all other AWS AI services because of the inherited `default` opt-out setting from the parent policy.

### Example 3: Define an organization-wide AI services opt-out policy for a single service
<a name="ai-opt-out-policy-example-3"></a>

The following example shows an AI services opt-out policy that defines an `optOut` setting for a single AI service. If this policy is attached to the organization's root, it prevents any child policy from overriding the `optOut` setting for this one service. Other services are not addressed by this policy, but could be affected by child policies in other OUs or accounts.

```
{
    "services": {
        "rekognition": {
            "opt_out_policy": {
                "@@assign": "optOut",
                "@@operators_allowed_for_child_policies": ["@@none"]
            }
        }
    }
}
```

# Security Hub policies
<a name="orgs_manage_policies_security_hub"></a>

AWS Security Hub policies provide security teams with a centralized approach to managing security configurations across their AWS Organizations. By leveraging these policies, you can establish and maintain consistent security controls through a central configuration mechanism. This integration allows you to address security coverage gaps by creating policies that align with your organization's security requirements and centrally applying them across accounts and organizational units (OUs).

Security Hub policies are fully integrated with AWS Organizations, allowing management accounts or delegated administrators to define and enforce security configurations. When accounts join your organization, they automatically inherit the applicable policies based on their location in the organizational hierarchy. This ensures that your security standards are consistently applied as your organization grows. The policies respect existing organizational structures and provide flexibility in how security configurations are distributed, while maintaining central control over critical security settings.

## Key features and benefits
<a name="security-hub-policies-features"></a>

Security Hub policies provide a comprehensive set of capabilities that help you manage and enforce security configurations across your AWS organization. These features streamline security management while ensuring consistent control over your multi-account environment.
+ Centrally [enable Security Hub](https://docs.aws.amazon.com/securityhub/latest/userguide/security-hub-adv-getting-started-enable.html#security-hub-adv-getting-started-enable-org-account) across accounts and Regions in your organization
+ Create security policies that define your security configuration across accounts and OUs
+ Automatically apply security configurations to new accounts when they join your organization
+ Ensure consistent security settings across your organization
+ Prevent member accounts from modifying organization-level security configurations

## What are Security Hub policies?
<a name="security-hub-policies-what-are"></a>

Security Hub policies are AWS Organizations policies that provide centralized control over security configurations across your organization's accounts. These policies work seamlessly with AWS Organizations to help you establish and maintain consistent security standards throughout your multi-account environment.

When you implement Security Hub policies, you gain the ability to define specific security configurations that automatically propagate across your organization. This ensures that all accounts, including newly created ones, align with your organization's security requirements and best practices.

These policies also help you maintain compliance by enforcing consistent security controls and preventing individual accounts from modifying organization-level security settings. This centralized approach significantly reduces the administrative overhead of managing security configurations across large, complex AWS environments.

## How Security Hub policies work
<a name="security-hub-policies-how-works"></a>

When you attach an Security Hub policy to your organization or organizational unit, AWS Organizations automatically evaluates the policy and applies it based on the scope you define. The policy enforcement process follows specific conflict resolution rules:

When regions appear in both enable and disable lists, the disable configuration takes precedence. For example, if a region is listed in both enable and disable configurations, Security Hub will be disabled in that region.

When `ALL_SUPPORTED` is specified for enablement, Security Hub is enabled in all current and future regions unless explicitly disabled. This allows you to maintain comprehensive security coverage as AWS expands into new regions.

Child policies can modify parent policy settings using inheritance operators, allowing for granular control at different organizational levels. This hierarchical approach ensures that specific organizational units can customize their security settings while maintaining baseline controls.

## Terminology
<a name="security-hub-policies-terminology"></a>

This topic uses the following terms when discussing Security Hub policies.


**Security Hub policy terminology**  

| Term | Definition | 
| --- | --- | 
| Effective policy | The final policy that applies to an account after combining all inherited policies. | 
| Policy inheritance | The process by which accounts inherit policies from parent organizational units. | 
| Delegated administrator | An account designated to manage Security Hub policies on behalf of the organization. | 
| Service-linked role | An IAM role that allows Security Hub to interact with other AWS services. | 

## Use cases for Security Hub policies
<a name="security-hub-policies-use-cases"></a>

Security Hub policies address common security management challenges in multi-account environments. The following use cases demonstrate how organizations typically implement these policies to enhance their security posture.

### Example use case: Regional compliance requirements
<a name="security-hub-policies-use-case-1"></a>

A multinational corporation needs different Security Hub configurations for different geographical regions. They create a parent policy enabling Security Hub in all regions using `ALL_SUPPORTED`, then use child policies to disable specific regions where different security controls are required. This allows them to maintain compliance with regional regulations while ensuring comprehensive security coverage.

### Example use case: Development team security standards
<a name="security-hub-policies-use-case-2"></a>

A software development organization implements Security Hub policies that enable monitoring in production regions while keeping development regions unmanaged. They use explicit region lists in their policies rather than `ALL_SUPPORTED` to maintain precise control over security monitoring coverage. This approach allows them to enforce stricter security controls in production environments while maintaining flexibility in development areas.

## Policy inheritance and enforcement
<a name="security-hub-policies-inheritance"></a>

Understanding how policies are inherited and enforced is crucial for effective security management across your organization. The inheritance model follows the AWS Organizations hierarchy, ensuring predictable and consistent policy application.
+ Policies attached at the root level apply to all accounts
+ Accounts inherit policies from their parent organizational units
+ Multiple policies can apply to a single account
+ More specific policies (closer to the account in the hierarchy) take precedence

## Policy validation
<a name="security-hub-policies-validation"></a>

When creating Security Hub policies, the following validations occur:
+ Region names must be valid AWS region identifiers
+ Regions must be supported by Security Hub
+ Policy structure must follow AWS Organizations policy syntax rules
+ Both `enable_in_regions` and `disable_in_regions` lists must be present, though they can be empty

## Regional considerations and supported Regions
<a name="security-hub-policies-regions"></a>

Security Hub policies operate across multiple Regions, requiring careful consideration of your global security requirements. Understanding regional behavior helps you implement effective security controls across your organization's global footprint.
+ Policy enforcement occurs in each Region independently
+ You can specify which Regions to include or exclude in your policies
+ New Regions are automatically included when using the `ALL_SUPPORTED` option
+ Policies only apply to Regions where Security Hub is available

## Next steps
<a name="security-hub-policies-next-steps"></a>

To get started with Security Hub policies:

1. Review the prerequisites in Getting started with Security Hub policies

1. Plan your policy strategy using our best practices guide

1. Learn about policy syntax and view example policies

# Getting started with Security Hub policies
<a name="orgs_manage_policies_security_hub_getting_started"></a>

Before you configure Security Hub policies, ensure you understand the prerequisites and implementation requirements. This topic guides you through the process of setting up and managing these policies in your organization.

## Before you begin
<a name="security_hub_getting_started-before-begin"></a>

Review the following requirements before implementing Security Hub policies:
+ Your account must be part of an AWS Organizations organization
+ You must be signed in as either:
  + The management account for the organization
  + A delegated administrator account with permissions to manage Security Hub policies
+ You must enable trusted access for Security Hub in your organization
+ You must enable the Security Hub policy type in the root of your organization

Additionally, verify that:
+ Security Hub is supported in the Regions where you want to apply policies
+ You have the `AWSServiceRoleForSecurityHubV2` service-linked role configured in your management account. To verify this role exists, run `aws iam get-role --role-name AWSServiceRoleForSecurityHubV2`. If you need to create this role, you can either run `aws securityhub enable-security-hub-v2` in any Region from your management account, or create it directly by running `aws iam create-service-linked-role --aws-service-name securityhubv2.amazonaws.com`.

## Implementation steps
<a name="security_hub_getting_started-implementation"></a>

To implement Security Hub policies effectively, follow these steps in sequence. Each step ensures proper configuration and helps prevent common issues during setup. The management account or delegated administrator can perform these steps through the AWS Organizations console, AWS Command Line Interface (AWS CLI), or AWS SDKs.

1. [Enable trusted access for Security Hub](orgs_integrate_services.md#orgs_how-to-enable-disable-trusted-access).

1. [Enable Security Hub policies for your organization](enable-policy-type.md).

1. [Create a Security Hub policy](orgs_policies_create.md#create-security-hub-policy-procedure).

1. [Attach the Security Hub policy to your organization's root, OU, or account](orgs_policies_attach.md).

1. [View the combined effective Security Hub policy that applies to an account](orgs_manage_policies_effective.md).

For all of these steps, you sign in as an AWS Identity and Access Management (IAM) user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization's management account.

**Other information**
+ [Learn policy syntax for Security Hub policies and see policy examples](orgs_manage_policies_security_hub_syntax.md)

# Best practices for using Security Hub policies
<a name="orgs_manage_policies_security_hub_best_practices"></a>

When implementing Security Hub policies across your organization, following established best practices helps ensure successful deployment and maintenance of your security configurations. These guidelines specifically address the unique aspects of Security Hub policy management and enforcement within AWS Organizations.

## Policy design principles
<a name="policy-design-principles"></a>

Before creating Security Hub policies, establish clear principles for your policy structure. Keep policies simple and avoid complex cross-attribute or nested rules that make it difficult to determine the final outcome. Start with broad policies at the organization root level and refine them through child policies where needed.

Consider using empty region lists strategically. You can leave `enable_in_regions` empty when you only need to disable Security Hub in specific regions, or leave `disable_in_regions` empty to keep regions unmanaged by policy. This flexibility helps you maintain precise control over your security monitoring coverage.

## Region management strategies
<a name="region-management-strategies"></a>

When managing regions through Security Hub policies, consider these proven approaches. Use `ALL_SUPPORTED` when you want to automatically include future regions in your security coverage. For more granular control, explicitly list regions rather than relying on `ALL_SUPPORTED`, especially when different regions require different security configurations.

Document your region-specific requirements, particularly for:
+ Compliance-mandated regions that require specific configurations
+ Development versus production environment differences
+ Opt-in regions with special considerations
+ Regions where Security Hub must remain disabled

## Policy inheritance planning
<a name="policy-inheritance-planning"></a>

Carefully plan your policy inheritance structure to maintain effective security control while allowing necessary flexibility. Document which organizational units can modify inherited policies and what modifications are allowed. Consider restricting inheritance operators (@@assign, @@append, @@remove) at parent levels when you need to enforce strict security controls.

## Monitoring and validation
<a name="monitoring-validation"></a>

Implement regular monitoring practices to ensure your policies remain effective. Review policy attachments periodically, especially after organizational changes. Validate that region configurations match your intended security coverage, particularly when using `ALL_SUPPORTED` or when managing multiple region lists.

## Troubleshooting strategies
<a name="troubleshooting-strategies"></a>

When troubleshooting Security Hub policies, focus first on policy precedence and inheritance. Remember that disable configurations take precedence over enable configurations when regions appear in both lists. Check policy inheritance chains to understand how parent and child policies combine to create the effective policy for each account.

# Security Hub policy syntax and examples
<a name="orgs_manage_policies_security_hub_syntax"></a>

Security Hub policies follow a standardized JSON syntax that defines how Security Hub is enabled and configured across your organization. Understanding the policy structure helps you create effective policies for your security requirements.

## Considerations
<a name="security-hub-policy-considerations"></a>

Before creating Security Hub policies, understand these key points about policy syntax:
+ Both `enable_in_regions` and `disable_in_regions` lists are required in the policy, though they can be empty
+ When processing effective policies, `disable_in_regions` takes precedence over `enable_in_regions`
+ Child policies can modify parent policies using inheritance operators unless explicitly restricted
+ The `ALL_SUPPORTED` designation includes both current and future regions
+ Region names must be valid and available in Security Hub

## Basic policy structure
<a name="security-hub-basic-structure"></a>

A Security Hub policy uses this basic structure:

```
{
  "securityhub": {
    "enable_in_regions": {
      "@@append": ["ALL_SUPPORTED"],
      "@@operators_allowed_for_child_policies": ["@@all"]
    },
    "disable_in_regions": {
      "@@append": [],
      "@@operators_allowed_for_child_policies": ["@@all"]
    }
  }
}
```

## Policy components
<a name="security-hub-policy-components"></a>

Security Hub policies contain these key components:

`securityhub`  
The top-level container for policy settings  
Required for all Security Hub policies

`enable_in_regions`  
List of regions where Security Hub should be enabled  
Can contain specific region names or `ALL_SUPPORTED`  
Required field but can be empty  
When using `ALL_SUPPORTED`, includes future regions

`disable_in_regions`  
List of regions where Security Hub should be disabled  
Can contain specific region names or `ALL_SUPPORTED`  
Required field but can be empty  
Takes precedence over `enable_in_regions` when regions appear in both lists

Inheritance operators  
@@assign - Overwrites inherited values  
@@append - Adds new values to existing ones  
@@remove - Removes specific values from inherited settings

## Security Hub policy examples
<a name="security-hub-policy-examples"></a>

The following examples demonstrate common Security Hub policy configurations. 

The example below enables Security Hub in all current and future regions. By using `ALL_SUPPORTED` in the `enable_in_regions` list and leaving `disable_in_regions` empty, this policy ensures comprehensive security coverage as new regions become available.

```
{
   "securityhub":{
      "enable_in_regions":{
         "@@assign":[
            "ALL_SUPPORTED"
         ]
      },
      "disable_in_regions":{
         "@@assign":[
            
         ]
      }
   }
}
```

This example disables Security Hub in all regions including any future regions since `disable_in_regions` list takes precedence over `enable_in_regions`.

```
{
   "securityhub":{
      "enable_in_regions":{
         "@@assign":[
            "us-east-1",
            "us-west-2"
         ]
      },
      "disable_in_regions":{
         "@@assign":[
            "ALL_SUPPORTED"
         ]
      }
   }
}
```

The following example demonstrates how child policies can modify parent policy settings using inheritance operators. This approach allows for granular control while maintaining the overall policy structure. The child policy adds a new region to `enable_in_regions` and removes a region from `disable_in_regions`.

```
{
   "securityhub":{
      "enable_in_regions":{
         "@@append":[
            "eu-central-1"
         ]
      },
      "disable_in_regions":{
         "@@remove":[
            "us-west-2"
         ]
      }
   }
}
```

This example shows how to enable Security Hub in multiple specific regions without using `ALL_SUPPORTED`. This provides precise control over which regions have Security Hub enabled, while leaving unspecified regions unmanaged by the policy.

```
{
   "securityhub":{
      "enable_in_regions":{
         "@@assign":[
            "us-east-1",
            "us-west-2",
            "eu-west-1",
            "ap-southeast-1"
         ]
      },
      "disable_in_regions":{
         "@@assign":[
            
         ]
      }
   }
}
```

The following example demonstrates how to handle regional compliance requirements by enabling Security Hub in most regions while explicitly disabling it in specific locations. The `disable_in_regions` list takes precedence, ensuring Security Hub remains disabled in those regions regardless of other policy settings.

```
{
   "securityhub":{
      "enable_in_regions":{
         "@@assign":[
            "ALL_SUPPORTED"
         ]
      },
      "disable_in_regions":{
         "@@assign":[
            "ap-east-1",
            "me-south-1"
         ]
      }
   }
}
```

# Amazon Bedrock policies
<a name="orgs_manage_policies_bedrock"></a>

Amazon Bedrock policies allow you to enforce safeguards configured in Amazon Bedrock Guardrails automatically across any element in your organization structure for all model inference calls to Amazon Bedrock. This eliminates the need to configure an individual guardail for each account. Amazon Bedrock Guardrails provides configurable safeguards to help safely build generative AI applications at scale, with a standard approach for a wide range of foundation models including: models supported in Amazon Bedrock, fine-tuned models, and models hosted outside of Amazon Bedrock.

Amazon Bedrock policies in AWS Organizations allow you to reference a guardrail created in your management account in a JSON format. You can attach any policy into the required element of your organization structure, such as the root, organizational units (OUs), and individual accounts. AWS Organizations applies inheritance rules to combine the policies, which results in an effective policy for each account that dictates how safeguards are enforced for your generative AI application.

## How it works
<a name="bedrock-policies-how-it-works"></a>

Amazon Bedrock policies give you control over automatic enforcement of safeguards within guardrails across multiple accounts, allowing you to enforce guardrails on all or a subset of models for inference calls to Amazon Bedrock. You need to reference a specific version of the appropriate guardrail within your policy, adhering to your organization's responsible AI requirements. This is specific to the AWS region where your guardrail exists, and you need to have different guardrails for each AWS region where you want the enforcement of safety controls. You can then attach this policy to any node of the organization, and accounts beneath that node will then automatically inherit those safeguards and apply them for every model invocation to Amazon Bedrock.

Amazon Bedrock policies help you ensure consistent safety controls throughout your organization, and provide a centralized approach to safely build generative AI applications at scale.

# Getting started with Amazon Bedrock policies
<a name="orgs_manage_policies_bedrock_getting_started"></a>

Before you configure Amazon Bedrock policies, ensure you understand the prerequisites and implementation requirements. This topic guides you through the process of setting up and managing these policies in your organization.

## Before you begin
<a name="bedrock_getting_started-before-begin"></a>

Review the following requirements before implementing Amazon Bedrock policies:
+ Your account must be part of an AWS organization
+ You must be signed in as either:
  + The management account for the organization
  + A delegated administrator account with permissions to manage Amazon Bedrock policies
+ You must enable the Amazon Bedrock policy type in the root of your organization

## Implementation steps
<a name="bedrock_getting_started-implementation"></a>

To implement Amazon Bedrock policies effectively, follow these steps in sequence. Each step ensures proper configuration and helps prevent common issues during setup. The management account or delegated administrator can perform these steps through the AWS Organizations console, AWS Command Line Interface (AWS CLI), or AWS SDKs.

1. [Enable Amazon Bedrock policies for your organization](enable-policy-type.md).

1. [Create an Amazon Bedrock policy](orgs_manage_policies_bedrock_syntax.md).

1. [Attach the Amazon Bedrock policy to your organization's root, OU, or account](orgs_policies_attach.md).

1. [View the combined effective Amazon Bedrock policy that applies to an account](orgs_manage_policies_effective.md).

# Best practices for using Amazon Bedrock policies
<a name="orgs_manage_policies_bedrock_best_practices"></a>

## Use a valid guardrail identifier
<a name="use-valid-guardrail-identifier"></a>

An incorrect or malformed identifier will cause all Amazon Bedrock API calls across the target organization to fail. [Monitor CloudTrail for invalid effective policy alerts to detect misconfigurations quickly](https://docs.aws.amazon.com/organizations/latest/userguide/invalid-policy-alerts.html).

## Exclude automated reasoning policies
<a name="exclude-automated-reasoning-policies"></a>

Guardrails that include an automated reasoning policy are not supported for organization-level enforcement. Verify that your selected Amazon Bedrock Guardrail does not contain one.

## Grant the necessary IAM permissions
<a name="grant-necessary-iam-permissions"></a>

Use [Amazon Bedrock Guardrails resource-based policies](https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails-resource-based-policies.html) to grant the organization and its member accounts permissions to evaluate the enforced guardrail at runtime.

## Review Amazon Bedrock Service Limits for Guardrails
<a name="review-service-limits"></a>

Member account calls using the Amazon Bedrock Policy will count towards the Service Quotas for the member. Review the Service Quotas Console and be sure that your Guardrails runtime limits are sufficient for your call volume.

## Start small, then scale
<a name="start-small-scale"></a>

Attach your policy to a few accounts to start, making sure the policy is being applied in the way you expect. Make sure to test that the Guardrail permissions are configured to allow cross-account access.

## Validate changes to your Amazon Bedrock policies using DescribeEffectivePolicy
<a name="validate-policy-changes-bedrock"></a>

After you make a change to an Amazon Bedrock policy, check the effective policies for representative accounts below the level where you made the change. You can view the effective policy by using the AWS Management Console, or by using the `DescribeEffectivePolicy` API operation or one of its AWS CLI or AWS SDK variants. Ensure that the change you made had the intended impact on the effective policy.

## Communicate and train
<a name="communicate-and-train-bedrock"></a>

Ensure your organizations understand the purpose and impact of your Amazon Bedrock policies. Provide clear guidance on Amazon Bedrock Guardrails behavior and what to expect.

# Amazon Bedrock policy syntax and examples
<a name="orgs_manage_policies_bedrock_syntax"></a>

An Amazon Bedrock policy is a plaintext file that is structured according to the rules of JSON. The syntax for Amazon Bedrock policies follows the syntax for all management policy types. For more information, see [Policy syntax and inheritance for management policy types](orgs_manage_policies_inheritance_mgmt.md). This topic focuses on applying that general syntax to the specific requirements of the Amazon Bedrock policy type.

The following Amazon Bedrock policy example shows the basic Amazon Bedrock policy syntax:

```
{
    "bedrock": {
        "guardrail_inference": {
            "us-east-1": {
                "config_1": {
                    "identifier": {
                        "@@assign": "arn:aws:bedrock:us-east-1:123456789012:guardrail/hu1dlsv9wy1d:1"
                    },
                    "selective_content_guarding": {
                        "system": {
                            "@@assign": "selective"
                        },
                        "messages": {
                            "@@assign": "comprehensive"
                        }
                    },
                    "model_enforcement": {
                        "included_models": {
                            "@@assign": ["ALL"]
                        },
                        "excluded_models": {
                            "@@assign": ["amazon.titan-embed-text-v2:0", "cohere.embed-english-v3"]
                        }
                    }
                }
            }
        }
    }
}
```

## The Amazon Bedrock policy syntax includes the following elements
<a name="bedrock-policy-components"></a>

`"bedrock"`  
The top-level key for Amazon Bedrock policy documents.

`"guardrail_inference"`  
Defines guardrail enforcement configuration.

`<region>`  
The region where the policy will be enforced. For example, `"us-east-1"`.

`"config_1"`  
Configuration identifier for the guardrail settings.

`"identifier"` (Required)  
Guardrail ARN, followed by `:version`, the Guardrail version.  
+ The Guardrail must be owned by the Management account. You cannot create a policy using a Guardrail from another account.
+ The Guardrail must have a version, and that version cannot be DRAFT. To create a version of your guardrail, see [Create a version of a guardrail](https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails-versions-create.html) in the Amazon Bedrock user guide.
+ The Guardrail must have a Resource Based Policy that allows organization members to call `ApplyGuardrail`.
+ The Guardrail must be created and used in the specified region.

`"selective_content_guarding"` (Optional)  
Amazon Bedrock APIs allow marking specific content within the input that the caller wants guardrails to process. These settings let enforcers control whether or not to respect content tagging decisions made by the caller. When specified, one of `"system"` or `"messages"` is required.

`"system"` (Optional)  
Choose how system prompts will be processed by guardrails. Defaults to `comprehensive` when not specified.  
+ `"comprehensive"`: Evaluate all content regardless of guard content tags.
+ `"selective"`: Only evaluate content within guard content tags. Does not evaluate any content when no tags are specified.

`"messages"` (Optional)  
Choose how message content with user and assistant conversation will be processed by guardrails. Defaults to `comprehensive` when not specified.  
+ `"comprehensive"`: Evaluate all content regardless of guard content tags.
+ `"selective"`: Only evaluate content within guard content tags. Evaluates all content within messages when no tags are specified.

`"model_enforcement"` (Optional)  
Model-specific information for the enforced guardrail configuration. If not present, the configuration is enforced on all models.

`"included_models"` (Required)  
List of models to enforce the guardrail on. When empty, applies enforcement to all models. Also accepts the keyword “ALL” to explicitly include all models.

`"excluded_models"` (Required)  
Models to exclude from enforcement of the guardrail. When empty, does not exclude any models from enforcement. If a model is present in both the included and excluded models lists, it is excluded.

# Amazon Inspector policies
<a name="orgs_manage_policies_inspector"></a>

Amazon Inspector policies allow you to centrally enable and manage Amazon Inspector across accounts in your AWS organization. With an Amazon Inspector policy, you specify which organizational entities (root, OUs, or accounts) have Amazon Inspector automatically enabled and linked to the Amazon Inspector delegated administrator account. You can use Amazon Inspector policies to simplify service-wide onboarding and ensure consistent enablement of Amazon Inspector in all existing and newly created accounts.

## Key Features and Benefits
<a name="inspector-policies-key-features"></a>

Amazon Inspector policies let you define which scan types should be enabled for your organization or subsets of it, ensuring consistent coverage and reducing manual effort. When implemented, they help you onboard new accounts automatically and maintain your scanning baseline as your organization scales.

## How it works
<a name="inspector-policies-how-it-works"></a>

When you attach an Amazon Inspector policy to an organizational entity, the policy automatically enables Amazon Inspector for all member accounts within that scope. Also, if you have finalized Amazon Inspector setup by registering a delegated administrator for Amazon Inspector, that account will have centralized vulnerability visibility over accounts in the organization that have Amazon Inspector enabled.

Amazon Inspector policies can be applied to the entire organization, to specific organizational units (OUs), or to individual accounts. Accounts that join the organization—or move into an OU with an attached Amazon Inspector policy—automatically inherit the policy and have Amazon Inspector enabled and linked to the Amazon Inspector delegated administrator. Amazon Inspector policies allow you to enable Amazon EC2 scanning, Amazon ECR scanning, or Lambda Standard and code scanning, as well as Code Security. Specific configuration settings and suppression rules can be managed via the delegated administrator account for the organization.

When you attach an Amazon Inspector policy to your organization or organizational unit, AWS Organizations automatically evaluates the policy and applies it based on the scope you define. The policy enforcement process follows specific conflict resolution rules:
+ When regions appear in both enable and disable lists, the disable configuration takes precedence. For example, if a region is listed in both enable and disable configurations, Amazon Inspector will be disabled in that region.
+ When `ALL_SUPPORTED` is specified for enablement, Amazon Inspector is enabled in all current and future regions unless explicitly disabled. This allows you to maintain comprehensive coverage as AWS expands into new regions.
+ Child policies can modify parent policy settings using inheritance operators, allowing for granular control at different organizational levels. This hierarchical approach ensures that specific organizational units can customize their security settings while maintaining baseline controls.

### Terminology
<a name="inspector-policies-terminology"></a>

This topic uses the following terms when discussing Amazon Inspector policies.


| Term | Definition | 
| --- | --- | 
| Effective policy | The final policy that applies to an account after combining all inherited policies. | 
| Policy inheritance | The process by which accounts inherit policies from parent organizational units. | 
| Delegated administrator | An account designated to manage Amazon Inspector policies on behalf of the organization. | 
| Service-linked role | An IAM role that allows Amazon Inspector to interact with other AWS services. | 

### Use cases for Amazon Inspector policies
<a name="inspector-policies-use-cases"></a>

Organizations launching large-scale workloads across multiple accounts can use this policy to ensure all accounts immediately enable the correct scan types and avoid gaps. Regulatory or compliance-driven environments can use child policies to override or limit scan-types by OU. Rapid growth environments can automate enablement for newly created accounts so they're always compliant with the baseline.

### Policy inheritance and enforcement
<a name="inspector-policies-inheritance"></a>

Understanding how policies are inherited and enforced is crucial for effective security management across your organization. The inheritance model follows the AWS Organizations hierarchy, ensuring predictable and consistent policy application.
+ Policies attached at the root level apply to all accounts
+ Accounts inherit policies from their parent organizational units
+ Multiple policies can apply to a single account
+ More specific policies (closer to the account in the hierarchy) take precedence

### Policy validation
<a name="inspector-policies-validation"></a>

When creating Amazon Inspector policies, the following validations occur:
+ Region names must be valid AWS region identifiers
+ Regions must be supported by Amazon Inspector
+ Policy structure must follow AWS Organizations policy syntax rules
+ Both `enable_in_regions` and `disable_in_regions` lists must be present, though they can be empty

### Regional considerations and supported Regions
<a name="inspector-policies-regional"></a>

Amazon Inspector policies apply only in Regions where Amazon Inspector and AWS Organizations trusted access are available. Understanding regional behavior helps you implement effective security controls across your organization's global footprint.
+ Policy enforcement occurs in each Region independently
+ You can specify which Regions to include or exclude in your policies
+ New Regions are automatically included when using the `ALL_SUPPORTED` option
+ Policies only apply to Regions where Amazon Inspector is available

### Detachment behavior
<a name="inspector-policies-detachment-behavior"></a>

If you detach an Amazon Inspector policy, Amazon Inspector remains enabled in previously covered accounts. However, future changes to the organizational structure (such as new accounts joining or existing accounts moving into the OU) will no longer automatically enable Amazon Inspector. Any further enablement must be performed manually or through re-attaching a policy.

## Additional details
<a name="inspector-policies-additional-details"></a>

### Delegated Administrator
<a name="inspector-policies-delegated-admin"></a>

Only one delegated administrator can be registered for Amazon Inspector in an organization. You must configure this in the Amazon Inspector console or via APIs before attaching Amazon Inspector policies.

### Prerequisites
<a name="inspector-policies-prerequisites"></a>

You must enable trusted access for AWS Organizations, have a delegated administrator for Amazon Inspector registered, and have service-linked roles available in all accounts.

### Supported Regions
<a name="inspector-policies-supported-regions"></a>

All Regions where Amazon Inspector is available.

# Getting started with Amazon Inspector policies
<a name="orgs_manage_policies_inspector_getting_started"></a>

Before you configure Amazon Inspector policies, ensure you understand the prerequisites and implementation requirements. This topic guides you through the process of setting up and managing these policies in your organization.

## Learn about required permissions
<a name="inspector_getting_started-permissions"></a>

To enable or attach Amazon Inspector policies, you must have the following permissions in the management account:
+ `organizations:EnableAWSServiceAccess` for `inspector2.amazonaws.com`
+ `organizations:RegisterDelegatedAdministrator` for `inspector2.amazonaws.com`
+ `organizations:AttachPolicy`, `organizations:CreatePolicy`, `organizations:DescribeEffectivePolicy`
+ `inspector2:Enable` (for management account and delegated admin)

## Before you begin
<a name="inspector_getting_started-before-begin"></a>

Review the following requirements before implementing Amazon Inspector policies:
+ Your account must be part of an AWS organization
+ You must be signed in as either:
  + The management account for the organization
  + An AWS Organizations delegated administrator with permissions to manage Amazon Inspector policies
+ You must enable trusted access for Amazon Inspector in your organization
+ You must enable the Amazon Inspector policy type in the root of your organization

Additionally, verify that:
+ Amazon Inspector is supported in the Regions where you want to apply policies
+ You have the `AWSServiceRoleForInspectorV2` service-linked role configured in your management account. To verify this role exists, run `aws iam get-role --role-name AWSServiceRoleForInspectorV2`. If you need to create this role, you can either run `aws inspector2 enable` in any Region from your management account, or create it directly by running `aws iam create-service-linked-role --aws-service-name inspector2.amazonaws.com`.

## Implementation steps
<a name="inspector_getting_started-implementation"></a>

To implement Amazon Inspector policies effectively, follow these steps in sequence. Each step ensures proper configuration and helps prevent common issues during setup. The management account or delegated administrator can perform these steps through the AWS Organizations console, AWS Command Line Interface (AWS CLI), or AWS SDKs.

1. [Enable trusted access for Amazon Inspector](orgs_integrate_services.md#orgs_how-to-enable-disable-trusted-access).

1. [Enable Amazon Inspector policies for your organization](enable-policy-type.md).

1. [Create an Amazon Inspector policy](orgs_manage_policies_inspector_syntax.md).

1. [Attach the Amazon Inspector policy to your organization's root, OU, or account](orgs_policies_attach.md).

1. [View the combined effective Amazon Inspector policy that applies to an account](orgs_manage_policies_effective.md).

## Create an Amazon Inspector policy
<a name="inspector_getting_started-create-policy"></a>

### Minimum permissions
<a name="inspector_getting_started-create-policy-permissions"></a>

To create an Amazon Inspector policy, you need the following permission:
+ `organizations:CreatePolicy`

### AWS Management Console
<a name="inspector_getting_started-create-policy-console"></a>

**To create an Amazon Inspector policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. Set a delegated administrator for the service in use within Amazon Inspector console.

1. Once the delegated administrator has been set up for Amazon Inspector, visit AWS organization console to set up the policies. On AWS organization console, visit the Amazon Inspector Policies page, choose **Create policy**.

1. On the **Create new Amazon Inspector policy** page, enter a **Policy name** and an optional **Policy description**.

1. (Optional) You can add one or more tags to the policy by choosing **Add tag** and then entering a key and an optional value. Leaving the value blank sets it to an empty string; it isn't `null`. You can attach up to 50 tags to a policy. For more information, see [Tagging AWS Organizations resourcesConsiderations](orgs_tagging.md).

1. Enter or paste the policy text in the JSON code box. For information about the Amazon Inspector policy syntax, and example policies you can use as a starting point, see [Amazon Inspector policy syntax and examples](orgs_manage_policies_inspector_syntax.md).

1. When you're finished editing your policy, choose **Create policy** at the lower-right corner of the page.

# Best practices for using Amazon Inspector policies
<a name="orgs_manage_policies_inspector_best_practices"></a>

When implementing Amazon Inspector policies across your organization, following established best practices helps ensure successful deployment and maintenance.

## Start simply and make small changes
<a name="start-simple-incremental-changes"></a>

Begin by enabling Amazon Inspector policies at a limited organizational unit (for example, "Security Pilot") to validate expected behavior before rolling out to all accounts. This incremental approach allows you to identify and resolve potential issues in a controlled environment before broader deployment.

## Establish review processes
<a name="establish-review-processes"></a>

Regularly monitor for new accounts joining your organization and confirm they inherit Amazon Inspector enablement automatically. Review policy attachment scopes quarterly to ensure your security coverage remains aligned with your organizational structure and security requirements.

## Validate changes using DescribeEffectivePolicy
<a name="validate-policy-changes"></a>

After attaching or modifying a policy, run `DescribeEffectivePolicy` for representative accounts to ensure that Amazon Inspector enablement is reflected properly. This validation step helps you confirm that your policy changes have the intended effect across your organization.

## Communicate and train
<a name="communicate-and-train"></a>

Educate account owners that Amazon Inspector will be enabled automatically and findings may appear in their Security Hub or Amazon Inspector dashboards once they are linked to the Amazon Inspector delegated administrator. Clear communication helps ensure that account owners understand the security monitoring in place and can respond appropriately to findings.

## Plan your delegated administrator strategy
<a name="delegated-admin-strategy"></a>

Designate a security or compliance account as the delegated administrator for Amazon Inspector. Set the delegated administrator from the Amazon Inspector console or via AWS Organizations APIs. This approach enables consistent security monitoring and management across your organization.

## Handle regional considerations
<a name="regional-considerations"></a>

Enable Amazon Inspector in Regions where your workloads run. Consider your compliance requirements and operational needs when determining which Regions require Amazon Inspector coverage. Document your region-specific requirements to maintain consistent security monitoring across your infrastructure.

# Amazon Inspector policy syntax and examples
<a name="orgs_manage_policies_inspector_syntax"></a>

Amazon Inspector policies follow a standardized JSON syntax that defines how Amazon Inspector is enabled and configured across your organization. An Amazon Inspector policy is a JSON document structured according to the AWS Organizations management-policy syntax. It defines which organizational entities will have Amazon Inspector automatically enabled.

## Basic policy structure
<a name="inspector-basic-structure"></a>

An Amazon Inspector policy uses this basic structure:

```
{
    "inspector": {
        "enablement": {
            "ec2_scanning": {
                "enable_in_regions": {
                    "@@assign": ["us-east-1", "us-west-2"]
                },
                "disable_in_regions": {
                    "@@assign": ["eu-west-1"]
                }
            }
        }
    }
}
```

## Policy components
<a name="inspector-policy-components"></a>

Amazon Inspector policies contain these key components:

`inspector`  
The top-level key for Amazon Inspector policy documents, which is required for all Amazon Inspector policies.

`enablement`  
Defines how Amazon Inspector is enabled across the organization, and contains scan type configurations.

`Regions (Array of Strings)`  
Specifies the Regions where Amazon Inspector should be auto-enabled.

## Amazon Inspector policy examples
<a name="inspector-policy-examples"></a>

The following examples demonstrate common Amazon Inspector policy configurations.

### Example 1 – Enable Amazon Inspector organization-wide
<a name="inspector-example-org-wide"></a>

The following example enables Amazon Inspector in `us-east-1` and `us-west-2` for all accounts in the organization root.

Create a file `inspector-policy-enable.json`:

```
{
  "inspector": {
    "enablement": {
      "lambda_standard_scanning": {
        "enable_in_regions": {
          "@@assign": [
            "us-east-1",
            "us-west-2"
          ]
        },
        "disable_in_regions": {
          "@@assign": [
            "eu-west-1"
          ]
        },
        "lambda_code_scanning": {
          "enable_in_regions": {
            "@@assign": [
              "us-east-1",
              "us-west-2"
            ]
          },
          "disable_in_regions": {
            "@@assign": [
              "eu-west-1"
            ]
          }
        }
      },
      "ec2_scanning": {
        "enable_in_regions": {
          "@@assign": [
            "us-east-1",
            "us-west-2"
          ]
        },
        "disable_in_regions": {
          "@@assign": [
            "eu-west-1"
          ]
        }
      },
      "ecr_scanning": {
        "enable_in_regions": {
          "@@assign": [
            "us-east-1",
            "us-west-2"
          ]
        },
        "disable_in_regions": {
          "@@assign": [
            "eu-west-1"
          ]
        }
      },
      "code_repository_scanning": {
        "enable_in_regions": {
          "@@assign": [
            "us-east-1",
            "us-west-2"
          ]
        },
        "disable_in_regions": {
          "@@assign": [
            "eu-west-1"
          ]
        }
      }
    }
  }
}
```

When attached to the root, all accounts in the organization automatically enable Amazon Inspector, and their scan findings are available to the Amazon Inspector delegated administrator.

Create and attach the policy:

```
POLICY_ID=$(aws organizations create-policy \
  --content file://inspector-policy-enable.json \
  --name InspectorOrgPolicy \
  --type INSPECTOR_POLICY \
  --description "Inspector organization policy to enable all resources in IAD and PDX." \
  --query 'Policy.PolicySummary.Id' \
  --output text)
aws organizations attach-policy --policy-id $POLICY_ID --target-id <root-id>
```

Any new account joining the organization automatically inherits enablement.

If detached, existing accounts remain enabled, but future accounts are not auto-enabled:

```
aws organizations detach-policy --policy-id $POLICY_ID --target-id <root-id>
```

### Example 2 – Enable Amazon Inspector for a specific OU
<a name="inspector-example-specific-ou"></a>

Create a file `inspector-policy-eu-west-1.json`:

```
{
  "inspector": {
    "enablement": {
      "lambda_standard_scanning": {
        "enable_in_regions": {
          "@@assign": [
            "eu-west-1"
          ]
        },
        "disable_in_regions": {
          "@@assign": [
            "eu-west-2"
          ]
        },
        "lambda_code_scanning": {
          "enable_in_regions": {
            "@@assign": [
              "eu-west-1"
            ]
          },
          "disable_in_regions": {
            "@@assign": [
              "eu-west-2"
            ]
          }
        }
      },
      "ec2_scanning": {
        "enable_in_regions": {
          "@@assign": [
            "eu-west-1"
          ]
        },
        "disable_in_regions": {
          "@@assign": [
            "eu-west-2"
          ]
        }
      },
      "ecr_scanning": {
        "enable_in_regions": {
          "@@assign": [
            "eu-west-1"
          ]
        },
        "disable_in_regions": {
          "@@assign": [
            "eu-west-2"
          ]
        }
      },
      "code_repository_scanning": {
        "enable_in_regions": {
          "@@assign": [
            "eu-west-1"
          ]
        },
        "disable_in_regions": {
          "@@assign": [
            "eu-west-2"
          ]
        }
      }
    }
  }
}
```

Attach this to an OU to ensure all production accounts in `eu-west-1` will have Amazon Inspector enabled and linked to the Amazon Inspector delegated administrator:

```
aws organizations update-policy --policy-id $POLICY_ID --content file://inspector-policy-eu-west-1.json --description "Inspector organization policy - Enable all (eu-west-1)"
aws organizations attach-policy --policy-id $POLICY_ID --target-id ou-aaaa-12345678
```

Accounts outside the OU are unaffected.

# Upgrade rollout policies
<a name="orgs_manage_policies_upgrade_rollout"></a>

AWS Organizations upgrade rollout policies allow you to centrally manage and stagger automatic upgrades across multiple AWS resources and accounts in your organization. With these policies, you can define the order in which resources receive upgrades, ensuring changes are validated in less critical environments before reaching production.

In today's complex cloud environments, managing upgrades across numerous resources and accounts can be challenging. Upgrade rollout policies address this challenge by providing a systematic approach to implementing upgrades. By using these policies, you can align your upgrade process with your organization's change management practices, reducing risk and improving operational efficiency.

Upgrade rollout policies leverage the hierarchical structure of AWS Organizations to apply policies across your entire organization or specific organizational units (OUs). This integration allows you to manage upgrades at scale, eliminating the need for manual coordination or custom automation scripts.

## Key features and benefits
<a name="orgs_manage_policies_upgrade_features_benefits"></a>

Upgrade rollout policies provide comprehensive capabilities for managing upgrades while offering significant advantages for organizations managing resources across multiple accounts and environments. The following table outlines the key features and their associated benefits:


**Features and benefits of upgrade rollout policies**  
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_upgrade_rollout.html)

For more information about policy inheritance, see [Understanding management policy inheritance](orgs_manage_policies_inheritance_mgmt.md).

## What are upgrade rollout policies?
<a name="orgs_manage_policies_upgrade_rollout_what_are"></a>

Upgrade rollout policies are a set of rules that determine how and when automatic upgrades are applied to your AWS resources. These policies allow you to designate different upgrade orders for your resources, typically aligning with your development, testing, and production environments. By doing so, you can ensure that upgrades are first applied to less critical systems, allowing you to identify and address any issues before they affect your production workloads.

The policies support three upgrade orders: First, Second, and Last. These orders create a staged approach to upgrades, with resources designated as "First" receiving upgrades initially, followed by "Second" after a waiting period, and finally "Last" after another waiting period. This staggered approach gives you time to validate upgrades at each stage before they progress to more critical systems.

Upgrade rollout policies are particularly valuable for organizations with complex, multi-account structures or those with strict change management requirements. They provide a balance between maintaining up-to-date systems and minimizing the risk of upgrade-related disruptions to critical services.

## How upgrade rollout policies work
<a name="orgs_manage_policies_upgrade_rollout_how_work"></a>

Upgrade rollout policies integrate seamlessly with your existing AWS infrastructure and processes. When you create and attach an upgrade rollout policy to an organizational unit, it applies to all accounts within that OU. You can then use resource tags or patch orders to specify which resources should be upgraded in which order.

When a supported AWS service releases an upgrade, it consults the upgrade rollout policies to determine the order in which resources should receive the upgrade. The service first applies the upgrade to resources marked as "First" during their configured maintenance windows. After a service-specific waiting period, typically around one week, resources marked as "Second" become eligible for the upgrade. Finally, after another waiting period, resources marked as "Last" receive the upgrade.

This process ensures that upgrades are applied in a controlled, predictable manner across your organization. It allows you to monitor the impact of upgrades at each stage and take corrective action if needed before the changes reach your most critical environments. The automated nature of this process reduces the operational overhead of managing upgrades, while still providing you with the control and visibility you need to maintain the stability and security of your AWS resources.

## Terminology
<a name="orgs_manage_policies_upgrade_syntax_terminology"></a>

Here are the key terms you should understand when working with upgrade rollout policies:


**Upgrade rollout policy terms**  

| Term | Definition | 
| --- | --- | 
| Active Date | The date when the AmVU becomes visible in the Describe Pending Maintenance Actions API and available for application. | 
| AmVU (Auto minor version upgrade) | The automatic upgrade process for minor versions of database engines. | 
| Effective policy | The final set of rules that apply to an account or resource after considering all inherited and directly attached policies. | 
| Maintenance window | A recurring time period during which automatic upgrades can be applied to a resource. Upgrade rollout policies work within these configured maintenance windows. | 
| Organizational unit (OU) | A container for AWS accounts in your organization. Upgrade rollout policies can be attached at the OU level to affect all accounts within it. | 
| Patch order | The sequence in which resources receive upgrades (First, Second, Last). | 
| Policy target | The scope to which an upgrade rollout policy applies, which can be an entire organization, specific OUs, or individual accounts. | 
| Resource tags | Key-value pairs that can be used to identify which resources should follow specific upgrade orders within a policy. | 
| Scheduling window | The time frame during which resources of a specific patch order receive upgrades. | 
| Service-specific waiting period | The designated time interval between upgrading resources of different upgrade orders. This period varies by AWS service and upgrade type. | 
| Upgrade order | A designation that determines when a resource receives upgrades relative to other resources. Can be set to First, Second, or Last. | 
| Upgrade rollout policy | The AWS Organizations policy type used to manage upgrade schedules across resources. | 

## Use cases for upgrade rollout policies
<a name="orgs_manage_policies_upgrade_rollout_use_cases"></a>

Organizations of different sizes and industries can benefit from upgrade rollout policies. The following fictitious scenarios demonstrate common upgrade management challenges and how upgrade rollout policies provide efficient solutions. These examples are based on typical customer experiences but have been simplified to highlight key benefits and implementation patterns.

Many organizations face similar challenges: they need to keep their resources up-to-date with the latest versions while minimizing risk to their production environments. Without a centralized policy-based approach, teams often resort to manual processes or complex automation scripts. The following examples demonstrate how two different organizations might solve similar challenges using upgrade rollout policies:

### Example use case: Global Financial Services Company
<a name="orgs_manage_policies_upgrade_rollout_use_case_financial"></a>

A financial services company operates hundreds of Aurora PostgreSQL databases across multiple AWS accounts. Before upgrade rollout policies, their DevOps team spent several days each month manually coordinating database upgrades, ensuring changes were tested in development environments before reaching production systems. By implementing upgrade rollout policies, they:
+ Tagged development databases with upgrade order "First"
+ Assigned QA databases to upgrade order "Second"
+ Designated production databases as upgrade order "Last"
+ Reduced upgrade coordination from days to minutes
+ Automatically validated changes in lower environments first
+ Maintained compliance with their change management requirements

### Example use case: IoT Device Platform Provider
<a name="orgs_manage_policies_upgrade_rollout_use_case_iot"></a>

An IoT company processes millions of device events daily using multiple Amazon RDS databases. They needed to ensure automatic minor version upgrades wouldn't disrupt their production services. Using upgrade rollout policies, they:
+ Created a policy that applies across their organizational structure
+ Configured canary environments to receive upgrades first
+ Set up monitoring in early-upgrade environments
+ Gained time to detect and respond to any issues before production upgrades
+ Replaced complex custom upgrade automation with a simple policy
+ Maintained high availability for their production workloads while staying current with database versions

## Supported AWS services
<a name="orgs_manage_policies_upgrade_services"></a>

Upgrade rollout policies integrate with the following AWS services while supporting automatic minor version upgrades:


**Supported services for upgrade rollout policies**  

| Service name | Purpose | 
| --- | --- | 
| Amazon Aurora PostgreSQL-Compatible Edition | [ Automatic minor version upgrades](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_UpgradeDBInstance.Maintenance.html#Aurora.Maintenance.AMVU) | 
| Amazon Aurora MySQL-Compatible Edition | [ Automatic minor version upgrades](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_UpgradeDBInstance.Maintenance.html#Aurora.Maintenance.AMVU) | 
| Amazon Relational Database Service for PostgreSQL | [ Automatic minor version upgrades](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_UpgradeDBInstance.PostgreSQL.Minor.html) | 
| Amazon Relational Database Service for SQL Server | [Automatic minor version upgrades](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_UpgradeDBInstance.SQLServer.html) | 
| Amazon Relational Database Service for Oracle | [ Automatic minor version upgrades](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_UpgradeDBInstance.Oracle.Minor.html#oracle-minor-version-upgrade-tuning-on) | 
| Amazon Relational Database Service for MariaDB | [ Automatic minor version upgrades](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_UpgradeDBInstance.MariaDB.Minor.html) | 
| Amazon Relational Database Service for MySQL | [ Automatic minor version upgrades](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_UpgradeDBInstance.MySQL.Minor.html) | 
| Amazon Relational Database Service for Db2 | [Automatic minor version upgrades](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Db2.Concepts.VersionMgmt.html) | 

## Prerequisites
<a name="orgs_manage_policies_upgrade_rollout_prerequisites"></a>

The following are prerequisites and required permissions necessary for managing upgrade rollout policies in AWS Organizations:
+ AWS Organizations management account or delegated administrator access
+ Resources in supported services (currently Amazon Aurora and Amazon Relational Database Service database engines)
+ Proper IAM permissions to manage upgrade rollout policies

## Next steps
<a name="orgs_manage_policies_upgrade_rollout_next_steps"></a>

To begin using upgrade rollout policies:

1. Review the [Getting started with upgrade rollout policies](orgs_manage_policies_upgrade_getting_started.md) to learn how to create and manage policies

1. Explore [Best practices for using upgrade rollout policies](orgs_manage_policies_upgrade_best_practices.md) for implementing upgrade rollout policies

1. Understand [Upgrade rollout policy syntax and examples](orgs_manage_policies_upgrade_syntax.md)

# Getting started with upgrade rollout policies
<a name="orgs_manage_policies_upgrade_getting_started"></a>

Follow these steps to implement upgrade rollout policies in your organization. Each step links to detailed information to help you complete the implementation successfully.

## Before you begin
<a name="orgs_manage_policies_upgrade_getting_started_prerequisites"></a>

Ensure you have the following:
+ Administrative access to AWS Organizations
+ Resources in supported AWS services (such as Aurora or Amazon Relational Database Service)
+ Necessary IAM permissions configured

## Implementation steps
<a name="orgs_manage_policies_upgrade_getting_started_steps"></a>

1. [Enable upgrade rollout policies for your organization.](enable-policy-type.md)

1. [Understand how upgrade rollout policies work.](orgs_manage_policies_upgrade_rollout.md#orgs_manage_policies_upgrade_rollout_how_work)
   + Identify development, testing, and production environments
   + Determine which resources should be upgraded first, second, and last
   + Document your tagging strategy for resource identification

1.  [Create a upgrade rollout policy](orgs_policies_create.md#create-upgrade-rollout-policy-procedure): 
   + Define the default rollout order (organizational unit or account level)
   + Specify resource targeting using tags
   + Configure any policy exclusions

1. [Attach an upgrade rollout policy to a single member account that you can use for testing.](orgs_policies_attach.md): 
   + Start with a test organizational unit
   + Verify policy inheritance
   + Confirm policy attachment status

1. Tag your resources according to your upgrade order strategy:
   + Apply tags to development resources for first upgrades
   + Tag testing resources for second-order upgrades
   + Designate production resources for last-order upgrades

1. Monitor and validate the policy:
   + Review upgrade order assignments
   + Verify policy effects on test resources

1. Test the upgrade process:
   + Wait for a service upgrade to become available
   + Monitor the upgrade progression through your environments
   + Verify that upgrades follow your specified order

1. Enable upgrade rollout policies for additional organizational units as needed

**Other information**
+ [Learn upgrade rollout policy syntax and see example policies](orgs_manage_policies_upgrade_syntax.md)

# Best practices for using upgrade rollout policies
<a name="orgs_manage_policies_upgrade_best_practices"></a>

AWS recommends the following best practices for using upgrade rollout policies.

**Topics**
+ [Start small and scale gradually](#orgs_manage_policies_upgrade_best_practices_scale)
+ [Establish review processes](#orgs_manage_policies_upgrade_best_practices_review)
+ [Validate policy changes effectively](#orgs_manage_policies_upgrade_best_practices_validate)
+ [Monitor and communicate changes](#orgs_manage_policies_upgrade_best_practices_monitor)
+ [Maintain compliance and security](#orgs_manage_policies_upgrade_best_practices_compliance)
+ [Optimize operational efficiency](#orgs_manage_policies_upgrade_best_practices_optimize)

## Start small and scale gradually
<a name="orgs_manage_policies_upgrade_best_practices_scale"></a>

Begin your implementation with a test policy attached to a single account in a non-critical environment. This approach allows you to validate the behavior and impact of upgrade rollout policies without risking disruption to critical workloads. Once you've confirmed the policy works as expected, incrementally move it up your organizational structure to include more accounts and organizational units.

This gradual scaling helps you identify and address any issues early in the implementation process. Consider creating a pilot group of resources that represents the diversity of your environment but carries minimal operational risk. Document the results of each expansion phase to inform future policy rollouts and adjustments.

## Establish review processes
<a name="orgs_manage_policies_upgrade_best_practices_review"></a>

Implement regular review processes to monitor for new upgrade rollout policy attributes and evaluate policy exceptions. These reviews should align with your organization's security and operational requirements. Create a schedule for reviewing policy effectiveness and maintain documentation of any adjustments made.

Your review process should include regular assessments of which resources are governed by policies, verification that upgrade orders align with your intended strategy, and evaluation of any policy exceptions. Consider establishing criteria for when policies need updating and maintain a change log to track policy evolution over time.

## Validate policy changes effectively
<a name="orgs_manage_policies_upgrade_best_practices_validate"></a>

After making changes to an upgrade rollout policy, check the effective policies for representative accounts at each level of your organization. Use the AWS Management Console or `DescribeEffectivePolicy` API operation to verify that your changes have the intended impact. This validation should include checking resources across different organizational units and confirming that inheritance works as expected.

Pay special attention to resources that have explicit upgrade orders assigned versus those using default values. Establish a validation checklist that includes verifying tag-based targeting, confirming maintenance window alignments, and testing policy inheritance.

## Monitor and communicate changes
<a name="orgs_manage_policies_upgrade_best_practices_monitor"></a>

Establish comprehensive monitoring for your upgrade rollout policies and create clear communication channels for sharing upgrade-related information. Document clear procedures for handling upgrade failures and create response plans for different scenarios.

Maintain regular communication with teams managing resources affected by upgrade policies. Consider creating dashboards that provide visibility into upcoming upgrades and their expected progression through your environments.

## Maintain compliance and security
<a name="orgs_manage_policies_upgrade_best_practices_compliance"></a>

Regularly audit your upgrade rollout policies to ensure they align with your compliance requirements. Document all policy decisions and maintain clear records of upgrade patterns and exceptions. Implement security controls around policy modifications and maintain an audit trail of policy changes using AWS CloudTrail.

Review access permissions to policy management functions regularly and implement least-privilege access for policy administration. Create procedures for emergency policy modifications and maintain documentation of security-related upgrade requirements.

## Optimize operational efficiency
<a name="orgs_manage_policies_upgrade_best_practices_optimize"></a>

Design your policies to minimize operational overhead while maintaining necessary controls. To prevent unintended behavior, do not reuse tags across different use cases. Automate policy compliance checking where possible and create standard operating procedures for common policy management tasks.

Consider creating templates for different types of upgrade scenarios and maintain documentation of successful policy patterns. Regular review of operational metrics can help identify opportunities for policy optimization and process improvement.

# Upgrade rollout policy syntax and examples
<a name="orgs_manage_policies_upgrade_syntax"></a>

An upgrade rollout policy defines how AWS services apply automatic upgrades across your resources. Understanding the policy syntax helps you create effective policies that match your organization's upgrade requirements.

**Topics**
+ [Considerations](#orgs_manage_policies_upgrade_syntax_considerations)
+ [Basic policy structure](#orgs_manage_policies_upgrade_syntax_structure)
+ [Policy components](#orgs_manage_policies_upgrade_syntax_components)
+ [Upgrade rollout policy examples](#orgs_manage_policies_upgrade_syntax_examples)

## Considerations
<a name="orgs_manage_policies_upgrade_syntax_considerations"></a>

When implementing upgrade rollout policies, consider these important factors:
+ Policy names must be unique within your organization and should be clear and descriptive. Choose names that reflect the policy's purpose and scope. For more information, see [Optimize operational efficiency](orgs_manage_policies_upgrade_best_practices.md#orgs_manage_policies_upgrade_best_practices_optimize).
+ Testing is crucial before broad deployment. Validate new policies in non-production environments first and expand gradually to ensure desired behavior. For more information, see [Start small and scale gradually](orgs_manage_policies_upgrade_best_practices.md#orgs_manage_policies_upgrade_best_practices_scale).
+ Policy changes may take several hours to propagate across your organization. Plan your implementations accordingly and ensure proper monitoring is in place. For more information, see [Monitor and communicate changes](orgs_manage_policies_upgrade_best_practices.md#orgs_manage_policies_upgrade_best_practices_monitor).
+ JSON formatting must be valid and stay within the maximum policy size of 5,120 bytes. Keep policy structures as simple as possible while meeting your requirements.
+ Regular policy reviews help maintain effectiveness. Schedule periodic evaluations of your policies to ensure they continue to meet your organizational needs. For more information, see [Establish review processes](orgs_manage_policies_upgrade_best_practices.md#orgs_manage_policies_upgrade_best_practices_review).
+ Resources without an assigned upgrade order default to the "Second" order. Consider explicitly setting upgrade orders for critical resources rather than relying on defaults. For more information, see [Validate policy changes effectively](orgs_manage_policies_upgrade_best_practices.md#orgs_manage_policies_upgrade_best_practices_validate).
+ Manual upgrades take precedence over policy-defined upgrade orders. Ensure your change management processes account for both automatic and manual upgrade scenarios. For more information, see [Establish review processes](orgs_manage_policies_upgrade_best_practices.md#orgs_manage_policies_upgrade_best_practices_review).

**Note**  
When implementing tag-based upgrade rollout policies from your management account, be aware that the management account cannot directly view or access resource-level tags in member accounts. We recommend establishing a process where member accounts apply consistent resource tags, and then create organization-level policies that reference these tags. This ensures proper coordination between resource-level tagging and organizational policy enforcement. You can also use [Tag policies](orgs_manage_policies_tag-policies.md) to help maintain consistent tags when resources are tagged across your organization.

## Basic policy structure
<a name="orgs_manage_policies_upgrade_syntax_structure"></a>

Upgrade rollout policies use a JSON structure that includes the following main elements:
+ Policy metadata (such as version information)
+ Resource targeting rules
+ Upgrade order specifications
+ Optional exception messages
+ Service-specific attributes

The following example shows a basic upgrade rollout policy structure:

```
{
   "upgrade_rollout":{
      "default":{
         "patch_order":{
            "@@assign":"last"
         }
      },
      "tags":{
         "devtag":{
            "tag_values":{
               "tag1":{
                  "patch_order":{
                     "@@assign":"first"
                  }
               },
               "tag2":{
                  "patch_order":{
                     "@@assign":"second"
                  }
               },
               "tag3":{
                  "patch_order":{
                     "@@assign":"last"
                  }
               }
            }
         }
      }
   }
}
```

## Policy components
<a name="orgs_manage_policies_upgrade_syntax_components"></a>

An upgrade rollout policy consists of two key components that work together to control how upgrades are applied across your resources. These components include configuration options for both default behaviors and tag-based overrides. Understanding how these components interact helps you create effective policies that match your organizational needs.

### Default patch order setup
<a name="orgs_manage_policies_upgrade_syntax_components_default"></a>

When you create an upgrade rollout policy without specifying any resource-specific overrides, all resources default to a base upgrade order. You can set this default using the "default" field in your policy. Resources without explicit upgrade order assignments through tags will follow this default order. 

**Note**  
The console experience today requires a default order to be specified.

The following example shows how to set all resources to receive upgrades last by default, unless overridden by tags. This approach is useful when you want to ensure most resources update later in the upgrade cycle:

```
"upgrade_rollout": {
    "default": {
        "patch_order": "last"
    }
}
```

### Resource level overriding via Tags
<a name="orgs_manage_policies_upgrade_syntax_components_tags"></a>

You can override the default upgrade order for specific resources using tags. This allows you to create granular control over which resources receive upgrades in which order. For example, you can assign different upgrade orders based on your environment types, development stages, or workload criticality.

The following example shows how to configure development resources to receive upgrades first and production resources to receive them last. This configuration ensures your development environments can validate upgrades before they reach production:

```
"upgrade_rollout": {
    "tags": {
        "environment": {
            "tag_values": {
                "development": {
                    "patch_order": "first"
                },
                "production": {
                    "patch_order": "last"
                }
            }
        }
    }
}
```

## Upgrade rollout policy examples
<a name="orgs_manage_policies_upgrade_syntax_examples"></a>

Here are common upgrade rollout policy scenarios:

### Example 1: Development environment first
<a name="orgs_manage_policies_upgrade_syntax_example1"></a>

This example shows how to configure resources in your development environment to receive upgrades first. By targeting resources with the "development" environment tag, you ensure your development environments are the first to receive and validate new upgrades. This pattern helps identify potential issues before upgrades reach more critical environments:

```
{
    "tags": {
        "environment": {
            "tag_values": {
                "development": {
                    "upgrade_order": "first"
                }
            }
        }
    }
}
```

### Example 2: Production environment last
<a name="orgs_manage_policies_upgrade_syntax_example2"></a>

This example demonstrates how to ensure your production environments receive upgrades last. By explicitly setting production-tagged resources to the last upgrade order, you maintain stability in your production environment while allowing adequate testing in pre-production environments. This approach is particularly useful for organizations with strict change management requirements:

```
{
    "tags": {
        "environment": {
            "tag_values": {
                "production": {
                    "upgrade_order": "last"
                }
            }
        }
    }
}
```

### Example 3: Multiple upgrade orders using tags
<a name="orgs_manage_policies_upgrade_syntax_example3"></a>

The following example demonstrates how to use a single tag key with different values to specify all three upgrade orders. This approach is useful when you want to manage upgrade orders through a single tagging scheme:

```
{
   "upgrade_rollout":{
      "default":{
         "patch_order":{
            "@@assign":"last"
         }
      },
      "tags":{
         "devtag":{
            "tag_values":{
               "tag1":{
                  "patch_order":{
                     "@@assign":"first"
                  }
               },
               "tag2":{
                  "patch_order":{
                     "@@assign":"second"
                  }
               },
               "tag3":{
                  "patch_order":{
                     "@@assign":"last"
                  }
               }
            }
         }
      }
   }
}
```

# Amazon S3 policies
<a name="orgs_manage_policies_s3"></a>

Amazon S3 policies allow you to centrally manage configurations for Amazon S3 resources at scale across the accounts in an organization. Amazon S3 policies currently support settings for blocking public access.

You can use an Amazon S3 policy to specify whether to enable or disable all four Block Public Access settings, and that specification will apply to all Amazon S3 resources within selected accounts. You can use Block Public Access settings in an Amazon S3 policy to enforce consistent security posture across your organization and eliminate the operational overhead of managing individual account configurations.

## How it works
<a name="s3-policies-how-it-works"></a>

When you attach an Amazon S3 policy to an organizational entity, it defines settings that apply to all Amazon S3 resources within accounts in that scope. These configurations override account-level settings, allowing you to centrally manage Amazon S3 settings.

Amazon S3 policies can be applied to an entire organization, organizational units (OUs), or individual accounts. Accounts joining an organization will automatically inherit any Amazon S3 policies based on their location in the organization hierarchy.

Detachment behavior: If an Amazon S3 policy is detached, accounts automatically revert to their previous account-level configuration. Amazon S3 preserves the original account-level settings to enable seamless restoration.

## Key features
<a name="s3-policies-key-features"></a>
+ Unified control: All four Block Public Access settings (BlockPublicAcls, BlockPublicPolicy, IgnorePublicAcls, RestrictPublicBuckets) are controlled together as a single configuration
+ Automatic inheritance: New accounts automatically inherit policies based on their organizational placement
+ Override protection: Prevents account-level modifications when organization policies are active
+ Seamless restoration: Original account settings are preserved and restored when policies are detached

## Prerequisites
<a name="s3-policies-prerequisites"></a>

Before using Amazon S3 policies, ensure you have:
+ An AWS organization in all features mode
+ Permissions to manage AWS Organizations policies (organizations:CreatePolicy, organizations:AttachPolicy, etc.)
+ The Amazon S3 policy type enabled for your organization

# Best practices for using Amazon S3 policies
<a name="orgs_manage_policies_s3_best_practices"></a>

When implementing Amazon S3 policies across your organization, following established best practices helps ensure successful deployment and maintenance.

## Start simply and make small changes
<a name="s3-start-simple-incremental-changes"></a>

To simplify debugging, start with simple policies and make changes one item at a time. Validate the behavior and impact of each change before making the next change. This approach reduces the number of variables you have to account for when an error or unexpected result does happen.

## Establish review processes
<a name="s3-establish-review-processes"></a>

Implement processes to monitor for new policy attributes, evaluate policy exceptions, and make adjustments to maintain alignment with your organizational security and operational requirements.

## Validate changes to your Amazon S3 policies using DescribeEffectivePolicy
<a name="s3-validate-policy-changes"></a>

After you make a change to an Amazon S3 policy, check the effective policies for representative accounts below the level where you made the change. You can view the effective policy by using the AWS Management Console, or by using the DescribeEffectivePolicy API operation or one of its AWS CLI or AWS SDK variants. Ensure that the change you made had the intended impact on the effective policy.

## Communicate and train
<a name="s3-communicate-and-train"></a>

Ensure your organization understands the purpose and impact of your policies. Provide clear guidance on the expected behaviors and how to handle failures due to policy enforcement.

## Plan for legitimate public access needs
<a name="s3-plan-for-public-access"></a>

Before implementing organization-level policies, identify accounts that require public Amazon S3 buckets for legitimate business purposes (such as static website hosting). Consider using OU-level or account-level policy attachment to exclude these accounts, or consolidate public bucket needs into dedicated accounts.

## Monitor policy enforcement
<a name="s3-monitor-policy-enforcement"></a>

Use AWS CloudTrail to monitor policy attachment and enforcement actions. Set up EventBridge rules to automate responses to policy violations or changes.

# Amazon S3 policy syntax and examples
<a name="orgs_manage_policies_s3_syntax"></a>

An Amazon S3 policy is a plaintext file that is structured according to the rules of [JSON](http://json.org). The syntax for Amazon S3 policies follows the syntax for all management policy types. For more information, see [Understanding management policy inheritance](orgs_manage_policies_inheritance_mgmt.md). This topic focuses on applying that general syntax to the specific requirements of the Amazon S3 policies and the Block Public Access settings they help manage.

The following Amazon S3 policy example shows the basic policy syntax:

```
{
    "s3_attributes": {
        "public_access_block_configuration": {
            "@@assign": "all"
        }
    }
}
```

## The Amazon S3 policy syntax includes the following elements
<a name="s3-policy-syntax-elements"></a>

`s3_attributes`  
The top-level key for Amazon S3 policy configuration.

`public_access_block_configuration`  
Defines the Block Public Access behavior for the organization.

`@@assign`  
The assignment operator that accepts one of two values:  
+ `"all"` - Enables all four Amazon S3 Block Public Access settings at the organization level
+ `"none"` - Disables organization-level control, allowing individual accounts to manage their own Block Public Access settings
Amazon S3 Block Public Access has four settings that control public access:  

1. **BlockPublicAcls** - Amazon S3 will block public access permissions applied to newly added buckets or objects, and prevent the creation of new public access control lists (ACLs) for existing buckets and objects. This setting doesn't change any existing permissions that allow public access to Amazon S3 resources using ACLs.

1. **BlockPublicPolicy** - Amazon S3 will block new bucket and access point policies that grant public access to buckets and objects. This setting doesn't change any existing policies that allow public access to Amazon S3 resources.

1. **IgnorePublicAcls** - Amazon S3 will ignore all ACLs that grant public access to buckets and objects.

1. **RestrictPublicBuckets** - Amazon S3 will ignore public and cross-account access for buckets or access points with policies that grant public access to buckets and objects.
When you set `@@assign` to `"all"`, all four settings are consolidated and enabled at the organization level, providing comprehensive protection against public access across all accounts in your organization.

# AWS Shield Network Security Director policies
<a name="orgs_manage_policies_network_security_director"></a>

AWS Shield Network Security Director helps secure your AWS environment by discovering your compute, networking, and network security resources. Network Security Director evaluates each resource's security configuration by analyzing network topology and security configurations against AWS best practices and threat intelligence.

AWS Shield Network Security Director policies allow you to centrally enable and manage Network Security Director across accounts in your AWS organization. With a Network Security Director policy, you specify which organizational entities (root, OUs, or accounts) have Network Security Director enabled. When accounts join your organization, they automatically inherit the applicable policies based on their location in the organizational hierarchy. This ensures that your resources are analyzed for network security configuration gaps as your organization grows. The policies respect existing organizational structures and provide flexibility in determining which accounts are analyzed.

AWS Shield Network Security Director is currently available in preview. 

## How it works
<a name="network-security-director-policies-how-it-works"></a>

When you attach an AWS Shield Network Security Director policy to an organizational entity, the policy automatically enables Network Security Director for all member accounts within that scope. Also, if you have finalized AWS Shield Network Security Director setup by registering a delegated administrator, that account will have centralized visibility over the network security posture of accounts in the organization that have AWS Shield Network Security Director enabled.

AWS Shield Network Security Director policies can be applied to the entire organization, to specific organizational units (OUs), or to individual accounts. Accounts that join the organization—or move into an OU with an attached policy—automatically inherit the policy and have AWS Shield Network Security Director enabled and linked to the Network Security Director delegated administrator. Network Security Director policies allow you to enable a network analysis, view the network topology and network security findings for your resources, and receive remediation recommendations for resolving configuration gaps. Specific configuration settings and suppression of individual findings can be managed via the Network Security Director delegated administrator account for the organization. 

When you attach an AWS Shield Network Security Director policy to your organization or organizational unit, AWS Organizations automatically evaluates the policy and applies it based on the scope you define. The policy enforcement logic follows specific conflict resolution rules: 
+  When regions appear in both enable and disable lists, the disable configuration takes precedence. For example, if a region is listed in both enable and disable configurations, AWS Shield Network Security Director will be disabled in that region. 
+  When `ALL_SUPPORTED` is specified for enablement, AWS Shield Network Security Director is enabled in all current and future regions unless explicitly disabled. This allows you to maintain comprehensive coverage as AWS expands into new regions. 

# Getting started with AWS Shield Network Security Director policies
<a name="orgs_manage_policies_network_security_director_getting_started"></a>

Before you configure Network Security Director policies, ensure you understand the prerequisites and implementation requirements. This topic guides you through the process of setting up and managing these policies in your organization.

## Before you begin
<a name="network_security_director_getting_started-before-begin"></a>

Review the following requirements before implementing AWS Shield Network Security Director policies:
+ Your account must be part of an AWS organization
+ You must be signed in as either:
  + The management account for the organization
  + An AWS Organizations delegated administrator with permissions to manage AWS Shield Network Security Director policies
+ You must enable trusted access for Network Security Director in your organization
+ You must enable the Network Security Director policy type in the root of your organization

Additionally, verify that:
+ AWS Shield Network Security Director is supported in the Regions where you want to apply policies
+ You have the AWS Shield Network Security Director service-linked role configured in your management account. If you need to create this role, you can create it directly by running `aws iam create-service-linked-role --aws-service-name network-director.amazonaws.com`.

## Implementation steps
<a name="network_security_director_getting_started-implementation"></a>

To implement Network Security Director policies effectively, follow these steps in sequence. Each step ensures proper configuration and helps prevent common issues during setup. These steps can be performed through the AWS Organizations console, AWS Command Line Interface (AWS CLI), or AWS SDKs.

1. [Enable trusted access for AWS Shield Network Security Director](orgs_integrate_services.md#orgs_how-to-enable-disable-trusted-access).

1. [Enable AWS Shield Network Security Director policies for your organization](enable-policy-type.md).

1. [Create an AWS Shield Network Security Director policy](orgs_manage_policies_network_security_director_syntax.md).

1. [Attach the policy to your organization's root, OU, or account](orgs_policies_attach.md).

1. [View the combined effective Network Security Director policy that applies to an account](orgs_manage_policies_effective.md).

# AWS Shield Network Security Director policy syntax and examples
<a name="orgs_manage_policies_network_security_director_syntax"></a>

Network Security Director policies follow a standardized JSON syntax that defines how Network Security Director is enabled and configured across your organization. An AWS Shield Network Security Director policy is a JSON document structured according to the AWS Organizations management-policy syntax. It defines which organizational entities will have AWS Shield Network Security Director automatically enabled.

## Basic policy structure
<a name="network-security-director-basic-structure"></a>

An AWS Shield Network Security Director policy uses this basic structure:

```
{
    "network_security_director": {
        "enablement": {
            "network_security_scan": {
                "enable_in_regions": {
                    "@@assign": ["us-east-1", "eu-west-1"]
                },
                "disable_in_regions": {
                    "@@assign": []
                    }
                }
            },
        }
    }
}
```

## Policy components
<a name="network-security-director-policy-components"></a>

AWS Shield Network Security Director policies contain these key components:

`network_security_director`  
The top-level key for Network Security Director policy documents, which is required for all Network Security Director policies.

`enablement`  
Defines how Network Security Director is enabled across the organization, and contains scan configurations.

`network_security_scan`  
Defines enforcement configuration for network security scanning.

`enable_in_regions`  
Configuration identifier for region settings. Defines where the network security scan should be enabled.

`disable_in_regions`  
Configuration identifier for region settings. Defines where the network security scan should be disabled.

# Delegated administrator for AWS Organizations
<a name="orgs_delegate_policies"></a>

We recommend that you use the AWS Organizations management account and its users and roles only for tasks that must be performed by that account. We also recommend that you store your AWS resources in other member accounts in the organization and keep them out of the management account. This is because security features like Organizations service control policies (SCPs) do not restrict users or roles in the management account. 

From the organization's management account, you can delegate policy management for Organizations to specified member accounts to perform policy actions that are by default available only to the management account.

For example resource-based delegation policies, see [Resource-based policy examples for AWS Organizations](security_iam_resource-based-policy-examples.md).

**Topics**
+ [Create a resource-based delegation policy](orgs-policy-delegate.md)
+ [Update a resource-based delegation policy](orgs-policy-delegate-update.md)
+ [View a resource-based delegation policy](view-delegated-resource-based-policy.md)
+ [Delete a resource-based delegation policy](delete-delegated-resource-based-policy.md)

# Create a resource-based delegation policy with AWS Organizations
<a name="orgs-policy-delegate"></a>

From the management account, create a resource-based delegation policy for your organization and add a statement that specifies which member accounts can perform actions on policies. You can add multiple statements in the policy to denote a different set of permissions to member accounts.

**Minimum permissions**  
To create the resource-based delegation policy, you need permissions to run the following actions:  
`organizations:PutResourcePolicy`
`organizations:DescribeResourcePolicy` 
Additionally, you must grant roles and users in the delegated administrator account the corresponding IAM permissions to the required actions. Without IAM permissions, it is assumed that the calling principal doesn’t have the required permissions to manage AWS Organizations policies.

------
#### [ AWS Management Console ]

Add statements to the resource-based delegation policy in the AWS Management Console using one of the following methods: 
+ **JSON policy** – Paste and customize an example resource-based delegation policy to use in your account, or type your own JSON policy document in the JSON editor.
+ **Visual editor** – Construct a new delegation policy in the visual editor, which guides you in creating a delegation policy without having to write JSON syntax.

**Use the JSON policy editor to create a delegation policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. Choose **Settings**.

1. In the **Delegated administrator for AWS Organizations** section, choose **Delegate** to create the Organizations delegation policy.

1. Enter a JSON policy document. For details about the IAM policy language, see [IAM JSON policy](https://docs.aws.amazon.com//IAM/latest/UserGuide/reference_policies.html) reference.

1. Resolve any [security warnings, errors, or general warnings](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_policy-validator.html) generated during policy validation, and then choose **Create policy** to save your work.

**Use the visual editor to create a delegation policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. Choose **Settings**.

1. In the **Delegated administrator for AWS Organizations** section, choose **Delegate** to create the Organizations delegation policy.

1. On the **Create Delegation policy** page, choose **Add new statement**.

1. Set **Effect** to `Allow`.

1. Add `Principal` to define the member accounts to which you want to delegate.

1. From the list of **Actions**, choose the actions you want to delegate. You can use **Filter actions** to narrow down the choices.

1. To specify if the delegated member account can attach policies to the organization root or organizational units (OUs), set `Resources`. You must also select `policy` as a resource type. You can specify resources in the following ways:
   + Choose **Add a resource** and construct the Amazon Resource Name (ARN) by following the prompts in the dialog box.
   + List resource ARNs manually in the editor. For more information about ARN syntax, see [Amazon Resource Name (ARN)](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) in the AWS General Reference Guide. For information about using ARNs in the resource element of a policy, see [IAM JSON policy elements: Resource](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_resource.html).

1. Choose **Add a condition** to specify other conditions, including the policy type you want to delegate. Choose the condition's **Condition key**, **Tag key**, **Qualifier**, and **Operator**, and then type a **Value**. When you're finished, choose **Add condition**. For more information about the **Condition** element, see [IAM JSON policy elements: Condition](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html) in the IAM JSON policy reference.

1. To add more permission blocks, choose **Add new statement**. For each block, repeat steps 5 through 9.

1. Resolve any security warnings, errors, or general warnings generated during [policy validation](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_policy-validator.html), and then choose **Create policy** to save your work.

------
#### [ AWS CLI & AWS SDKs ]

**Create a delegation policy**  
You can use the following command to create a delegation policy: 
+ AWS CLI: [put-resource-policy](https://docs.aws.amazon.com/cli/latest/reference/organizations/put-resource-policy.html)

  The following example creates a delegation policy.

  ```
  $ aws organizations put-resource-policy --content
  {
      "Version": "2012-10-17",		 	 	 
      "Statement": [
          {
              "Sid": "Fully_manage_backup_policies",
              "Effect": "Allow",
              "Principal": {
                  "AWS": "135791357913"
              },
              "Action": [
                  "organizations:DescribeOrganization",
                  "organizations:ListAccounts",
                  "organizations:CreatePolicy",
                  "organizations:DescribePolicy",
                  "organizations:UpdatePolicy",
                  "organizations:DeletePolicy",
                  "organizations:AttachPolicy",
                  "organizations:DetachPolicy"
              ],
              "Resource": [
                  "arn:aws:organizations::246802468024:root/o-abcdef/r-pqrstu",
                  "arn:aws:organizations::246802468024:ou/o-abcdef/*",
                  "arn:aws:organizations::246802468024:account/o-abcdef/*",
                  "arn:aws:organizations::246802468024:organization/policy/backup_policy/*",
              ],
              "Condition": {
                  "StringLikeIfExists": {
                      "organizations:PolicyType": [
                          "BACKUP_POLICY"
                      ]
                  }
              }
          }
      ]
  }
  ```
+ AWS SDK: [PutResourcePolicy](https://docs.aws.amazon.com/organizations/latest/APIReference/API_PutResourcePolicy.html)

------

**Supported delegation policy actions**  
The following actions are supported for delegation policy: 
+ `AttachPolicy`
+ `CreatePolicy`
+ `DeletePolicy`
+ `DescribeAccount`
+ `DescribeCreateAccountStatus`
+ `DescribeEffectivePolicy`
+ `DescribeHandshake`
+ `DescribeOrganization`
+ `DescribeOrganizationalUnit`
+ `DescribePolicy`
+ `DescribeResourcePolicy`
+ `DetachPolicy`
+ `DisablePolicyType`
+ `EnablePolicyType`
+ `ListAccounts`
+ `ListAccountsForParent`
+ `ListAWSServiceAccessForOrganization`
+ `ListChildren`
+ `ListCreateAccountStatus`
+ `ListDelegatedAdministrators`
+ `ListDelegatedServicesForAccount`
+ `ListHandshakesForAccount`
+ `ListHandshakesForOrganization`
+ `ListOrganizationalUnitsForParent`
+ `ListParents`
+ `ListPolicies`
+ `ListPoliciesForTarget`
+ `ListRoots`
+ `ListTagsForResource`
+ `ListTargetsForPolicy`
+ `TagResource`
+ `UntagResource`
+ `UpdatePolicy`

**Supported condition keys**  
Only condition keys supported by AWS Organizations can be used for delegation policy. For more information, see [Condition keys for AWS Organizations](https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsorganizations.html#awsorganizations-policy-keys) in the *Service Authorization Reference*.

# Update a resource-based delegation policy with AWS Organizations
<a name="orgs-policy-delegate-update"></a>

From the management account, update a resource-based delegation policy for your organization and add a statement that specifies which member accounts can perform actions on policies. You can add multiple statements in the policy to denote a different set of permissions to member accounts.

**Minimum permissions**  
To update the resource-based delegation policy, you need permissions to run the following actions:  
`organizations:PutResourcePolicy`
`organizations:DescribeResourcePolicy` 
Additionally, you must grant roles and users in the delegated administrator account the corresponding IAM permissions to the required actions. Without IAM permissions, it is assumed that the calling principal doesn’t have the required permissions to manage AWS Organizations policies.

------
#### [ AWS Management Console ]

Add statements to the resource-based delegation policy in the AWS Management Console using one of the following methods: 
+ **JSON policy** – Paste and customize an example resource-based delegation policy to use in your account, or type your own JSON policy document in the JSON editor.
+ **Visual editor** – Construct a new delegation policy in the visual editor, which guides you in creating a delegation policy without having to write JSON syntax.

**Use the JSON policy editor to update a delegation policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. Choose **Settings**.

1. In the **Delegated administrator for AWS Organizations** section, choose **Edit** to update the Organizations delegation policy.

1. Enter a JSON policy document. For details about the IAM policy language, see [IAM JSON policy](https://docs.aws.amazon.com//IAM/latest/UserGuide/reference_policies.html) reference.

1. Resolve any [security warnings, errors, or general warnings](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_policy-validator.html) generated during policy validation, and then choose **Create policy**.

**Use the visual editor update a delegation policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. Choose **Settings**.

1. In the **Delegated administrator for AWS Organizations** section, choose **Edit** to update the Organizations delegation policy.

1. On the **Create Delegation policy** page, choose **Add new statement**.

1. Set **Effect** to `Allow`.

1. Add `Principal` to define the member accounts to which you want to delegate.

1. From the list of **Actions**, choose the actions you want to delegate. You can use **Filter actions** to narrow down the choices.

1. To specify if the delegated member account can attach policies to the organization root or organizational units (OUs), set `Resources`. You must also select `policy` as a resource type. You can specify resources in the following ways:
   + Choose **Add a resource** and construct the Amazon Resource Name (ARN) by following the prompts in the dialog box.
   + List resource ARNs manually in the editor. For more information about ARN syntax, see [Amazon Resource Name (ARN)](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) in the AWS General Reference Guide. For information about using ARNs in the resource element of a policy, see [IAM JSON policy elements: Resource](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_resource.html).

1. Choose **Add a condition** to specify other conditions, including the policy type you want to delegate. Choose the condition's **Condition key**, **Tag key**, **Qualifier**, and **Operator**, and then type a **Value**. When you're finished, choose **Add condition**. For more information about the **Condition** element, see [IAM JSON policy elements: Condition](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html) in the IAM JSON policy reference.

1. To add more permission blocks, choose **Add new statement**. For each block, repeat steps 5 through 9.

1. Resolve any security warnings, errors, or general warnings generated during [policy validation](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_policy-validator.html), and then choose **Save policy**.

------
#### [ AWS CLI & AWS SDKs ]

**Create or update a delegation policy**  
You can use the following command to create or update a delegation policy: 
+ AWS CLI: [put-resource-policy](https://docs.aws.amazon.com/cli/latest/reference/organizations/put-resource-policy.html)

  The following example creates or updates the delegation policy.

  ```
  $ aws organizations put-resource-policy --content
  {
      "Version": "2012-10-17",		 	 	 
      "Statement": [
          {
              "Sid": "Fully_manage_backup_policies",
              "Effect": "Allow",
              "Principal": {
                  "AWS": "135791357913"
              },
              "Action": [
                  "organizations:DescribeOrganization",
                  "organizations:ListAccounts",
                  "organizations:CreatePolicy",
                  "organizations:DescribePolicy",
                  "organizations:UpdatePolicy",
                  "organizations:DeletePolicy",
                  "organizations:AttachPolicy",
                  "organizations:DetachPolicy"
              ],
              "Resource": [
                  "arn:aws:organizations::246802468024:root/o-abcdef/r-pqrstu",
                  "arn:aws:organizations::246802468024:ou/o-abcdef/*",
                  "arn:aws:organizations::246802468024:account/o-abcdef/*",
                  "arn:aws:organizations::246802468024:organization/policy/backup_policy/*",
              ],
              "Condition": {
                  "StringLikeIfExists": {
                      "organizations:PolicyType": [
                          "BACKUP_POLICY"
                      ]
                  }
              }
          }
      ]
  }
  ```
+ AWS SDK: [PutResourcePolicy](https://docs.aws.amazon.com/organizations/latest/APIReference/API_PutResourcePolicy.html)

------

**Supported delegation policy actions**  
The following actions are supported for delegation policy: 
+ `AttachPolicy`
+ `CreatePolicy`
+ `DeletePolicy`
+ `DescribeAccount`
+ `DescribeCreateAccountStatus`
+ `DescribeEffectivePolicy`
+ `DescribeHandshake`
+ `DescribeOrganization`
+ `DescribeOrganizationalUnit`
+ `DescribePolicy`
+ `DescribeResourcePolicy`
+ `DetachPolicy`
+ `DisablePolicyType`
+ `EnablePolicyType`
+ `ListAccounts`
+ `ListAccountsForParent`
+ `ListAWSServiceAccessForOrganization`
+ `ListChildren`
+ `ListCreateAccountStatus`
+ `ListDelegatedAdministrators`
+ `ListDelegatedServicesForAccount`
+ `ListHandshakesForAccount`
+ `ListHandshakesForOrganization`
+ `ListOrganizationalUnitsForParent`
+ `ListParents`
+ `ListPolicies`
+ `ListPoliciesForTarget`
+ `ListRoots`
+ `ListTagsForResource`
+ `ListTargetsForPolicy`
+ `TagResource`
+ `UntagResource`
+ `UpdatePolicy`

**Supported condition keys**  
Only condition keys supported by AWS Organizations can be used for delegation policy. For more information, see [Condition keys for AWS Organizations](https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsorganizations.html#awsorganizations-policy-keys) in the *Service Authorization Reference*.

# View a resource-based delegation policy with AWS Organizations
<a name="view-delegated-resource-based-policy"></a>

From the management account, view your organization’s resource-based delegation policy to understand which delegated administrators have access to manage which policy types.

**Minimum permissions**  
To view the resource-based delegation policy, you need permissions to run the following action: `organizations:DescribeResourcePolicy`. 

------
#### [ AWS Management Console ]

**To view a delegation policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. Choose **Settings**.

1. In the **Delegated administrator for AWS Organizations** section, scroll to view the full delegation policy.

------
#### [ AWS CLI & AWS SDKs ]

**View a delegation policy**  
You can use the following command to view a delegation policy: 
+ AWS CLI: [describe-resource-policy](https://docs.aws.amazon.com/cli/latest/reference/organizations/describe-resource-policy.html)

  The following example retrieves the policy.

  ```
  $ aws organizations describe-resource-policy
  ```
+ AWS SDK: [DescribeResourcePolicy](https://docs.aws.amazon.com/organizations/latest/APIReference/API_DescribeResourcePolicy.html)

------

# Delete a resource-based delegation policy with AWS Organizations
<a name="delete-delegated-resource-based-policy"></a>

When you no longer need to delegate the management of policies in your organization, you can delete the resource-based delegation policy from the organization's management account.

**Important**  
If you delete your resource-based delegation policy, you can't recover it.

**Minimum permissions**  
To delete the resource-based delegation policy, you need permissions to run the following action: `organizations:DeleteResourcePolicy`. 

------
#### [ AWS Management Console ]

**To delete a delegation policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. Choose **Settings**.

1. In the **Delegated administrator for AWS Organizations** section, choose **Delete**.

1. In the **Delete policy** confirmation dialog box, type **delete**. Then, choose **Delete policy**.

------
#### [ AWS CLI & AWS SDKs ]

**Delete a delegation policy**  
You can use the following command to delete a delegation policy: 
+ AWS CLI: [delete-resource-policy](https://docs.aws.amazon.com/cli/latest/reference/organizations/delete-resource-policy.html)

  The following example deletes the policy.

  ```
  $ aws organizations delete-resource-policy
  ```
+ AWS SDK: [DeleteResourcePolicy](https://docs.aws.amazon.com/organizations/latest/APIReference/API_DeleteResourcePolicy.html)

------

# Enabling a policy type
<a name="enable-policy-type"></a>

Before you can create and attach a policy to your organization, you must enable that policy type for use. Enabling a policy type is a one-time task on the organization root. You can enable a policy type from only the organization's management account or a member account designated as a delegated administrator.

**Minimum permissions**  
To enable a policy type, you need permission to run the following actions:  
`organizations:EnablePolicyType`
`organizations:DescribeOrganization` – required only when using the Organizations console
`organizations:ListRoots` – required only when using the Organizations console

------
#### [ AWS Management Console ]

**To enable a policy type**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[Policies](https://console.aws.amazon.com/organizations/v2/home/policies)** page, choose the name of the policy type that you want to enable.

1. On the policy type page, choose **Enable *policy type***.

   The page is replaced by a list of the available policies of the specified type.

------
#### [ AWS CLI & AWS SDKs ]

**To enable a policy type**  
You can use one of the following commands to enable a policy type:
+ AWS CLI: [enable-policy-type](https://docs.aws.amazon.com/cli/latest/reference/organizations/enable-policy-type.html)

  The following example shows how to enable backup policies for your organization. Note that you must specify the ID of your organization's root.

  ```
  $ aws organizations enable-policy-type \
      --root-id r-a1b2 \
      --policy-type BACKUP_POLICY
  {
      "Root": {
          "Id": "r-a1b2",
          "Arn": "arn:aws:organizations::123456789012:root/o-aa111bb222/r-a1b2",
          "Name": "Root",
          "PolicyTypes": [
              {
                  "Type": "BACKUP_POLICY",
                  "Status": "ENABLED"
              }
          ]
      }
  }
  ```

  The list of `PolicyTypes` in the output now includes the specified policy type with the `Status` of `ENABLED`.
+ AWS SDKs: [EnablePolicyType](https://docs.aws.amazon.com/organizations/latest/APIReference/API_EnablePolicyType.html)

------

# Disabling a policy type
<a name="disable-policy-type"></a>

If you no longer want to use a certain policy type in your organization, you can disable that type to prevent its accidental use. You can disable a policy type from only the organization's management account or a member account designated as a delegated administrator..

## Considerations
<a name="disable-policy-type-considerations"></a>

**Disabled policies are detached from all entities but not deleted**

When you disable a policy type, all policies of the specified type are automatically detached from all entities in the organization root. The policies are ***not*** deleted.

**(Service control policy type only) All entities in the root are initially attached to only the default `FullAWSAccess` SCP**

(Service control policy type only) If you re-enable the SCP policy type later, all entities in the organization root are initially attached to only the default `FullAWSAccess` SCP. Attachments of SCPs to entities are lost when the SCPs are disabled in the organization. If you later want to re-enable SCPs, you must reattach them to the organization's root, OUs, and accounts, as appropriate.

## Disable a policy type
<a name="disable-policy-type-disable"></a>

**Minimum permissions**  
To disable SCPs, you need permission to run the following actions:  
`organizations:DisablePolicyType`
`organizations:DescribeOrganization` – required only when using the Organizations console
`organizations:ListRoots` – required only when using the Organizations console

------
#### [ AWS Management Console ]

**To disable a policy type**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[Policies](https://console.aws.amazon.com/organizations/v2/home/policies)** page, choose the name of the policy type that you want to disable.

1. On the policy type page, choose **Disable *policy type***.

1. On the confirmation dialog box, enter the word **disable**, and then choose **Disable**.

   The list of available policies of the specified type disappears.

------
#### [ AWS CLI & AWS SDKs ]

**To disable a policy type**  
You can use one of the following commands to disable a policy type:
+ AWS CLI: [disable-policy-type](https://docs.aws.amazon.com/cli/latest/reference/organizations/disable-policy-type.html)

  The following example shows how to disable backup policies for your organization. Note that you must specify the ID of your organization's root.

  ```
  $ aws organizations disable-policy-type \
      --root-id r-a1b2 \
      --policy-type BACKUP_POLICY
  {
      "Root": {
          "Id": "r-a1b2",
          "Arn": "arn:aws:organizations::123456789012:root/o-aa111bb222/r-a1b2",
          "Name": "Root",
          "PolicyTypes": []
      }
  }
  ```

  The list of `PolicyTypes` in the output no longer includes the specified policy type.
+ AWS SDKs: [DisablePolicyType](https://docs.aws.amazon.com/organizations/latest/APIReference/API_DisablePolicyType.html)

------

# Creating organization policies with AWS Organizations
<a name="orgs_policies_create"></a>

After you [enable policies](enable-policy-type.md) for your organization, you can create a policy.

This topic describes how to create policies with AWS Organizations. A *policy* defines the controls that you want to apply to a group of AWS accounts.

**Topics**
+ [Create a service control policy (SCP)](#create-an-scp)
+ [Create a resource control policy (RCP)](#create-an-rcp)
+ [Create a declarative policy](#create-declarative-policy-procedure)
+ [Create a backup policy](#create-backup-policy-procedure)
+ [Create a tag policy](#create-tag-policy-procedure)
+ [Create a chat applications policy](#create-chatbot-policy-procedure)
+ [Create an AI services opt-out policy](#create-ai-opt-out-policy-procedure)
+ [Create a upgrade rollout policy](#create-upgrade-rollout-policy-procedure)
+ [Create a Security Hub policy](#create-security-hub-policy-procedure)

## Create a service control policy (SCP)
<a name="create-an-scp"></a>

**Minimum permissions**  
To create SCPs, you need permission to run the following action:  
`organizations:CreatePolicy`

------
#### [ AWS Management Console ]

**To create a service control policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[Service control policies](https://console.aws.amazon.com/organizations/v2/home/policies/service-control-policy)** page, choose **Create policy**. 

1. On the [**Create new service control policy** page](https://console.aws.amazon.com/organizations/home/policies/service-control/create), enter a **Policy name** and an optional **Policy description**.

1. (Optional) Add one or more tags by choosing **Add tag** and then entering a key and an optional value. Leaving the value blank sets it to an empty string; it isn't `null`. You can attach up to 50 tags to a policy. For more information, see [Tagging AWS Organizations resourcesConsiderations](orgs_tagging.md).
**Note**  
In most of the steps that follow, we discuss using the controls on the right side of the JSON editor to construct the policy, element by element. Alternatively, you can, at any time, simply enter text in the JSON editor on the left side of the window. You can directly type, or use copy and paste.

1. To build the policy, your next steps vary depending on whether you want to add a statement that [denies](orgs_manage_policies_scps_evaluation.md#how_scps_deny) or [allows](orgs_manage_policies_scps_evaluation.md#how_scps_allow) access. For more information, see [SCP evaluation](orgs_manage_policies_scps_evaluation.md). If you use `Deny` statements, you have additional control because you can restrict access to specific resources, define conditions for when SCPs are in effect, and use the [NotAction](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_notaction.html) element. For details about syntax, see [SCP syntax](orgs_manage_policies_scps_syntax.md).

   To add a statement that *denies* access:

   1. <a name="step.b"></a>In the right **Edit statement** pane of the editor, under **Add actions**, choose an AWS service.

      As you choose options on the right, the JSON editor updates to show the corresponding JSON policy on left.

   1. After you select a service, a list opens that contains the available actions for that service. You can choose **All actions**, or choose one or more individual actions that you want to deny. 

      The JSON on the left updates to include the actions you selected.
**Note**  
If you select an individual action and then also go back and also select **All actions**, the expected entry for `servicename:*` is added to the JSON, but the individual actions that you previously selected are left in the JSON and not removed.

   1. If you want to add actions from additional services, you can choose **All services** at the top of the **Statement** box, and then repeat the previous two steps as needed.

   1. Specify resources to include in the statement. 
      + Next to **Add a resource**, choose **Add**.
      + In the **Add resource** dialog, choose the service whose resources you want to control from the list. You can select from among only those services you selected in the previous step.
      + Under **Resource type**, choose the type of resource you want to control.
      + Finally, complete the Amazon Resource Name (ARN) in **Resource ARN** to identify the specific resource to which you want to control access. You must replace all placeholders that are surrounded by curly braces `{}`. You can specify wild cards (`*`) where that resource type's ARN syntax permits. See the documentation for a specific resource type for information about where you can use wild cards.
      + Save your addition to the policy by choosing **Add resource**. The `Resource` element in the JSON reflects your additions or changes. The **Resource** element is required. 
**Tip**  
If you want to specify all resources for the selected service, either choose the **All resources** option in the list, or edit the `Resource` statement directly in the JSON to read `"Resource":"*"`.

   1. (Optional) To specify conditions that limit when a policy statement is in effect, next to **Add condition**, choose **Add**. 
      + **Condition key** – From the list you can choose any condition key that is available for all AWS services (for example, `aws:SourceIp`) or a service-specific key for only one of the services that you selected for this statement. 
      + **Qualifier** – (Optional) When the request has more than one values for a multivalued context key, you can specify a [qualifier](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_multi-value-conditions.html) for testing requests against the values. For more information see, [Single-valued vs. multivalued context keys](reference_policies_condition-single-vs-multi-valued-context-keys.html) in the *IAM User Guide*. To check if a request can have multiple values, see the [Actions, resources, and condition keys for AWS services](https://docs.aws.amazon.com/service-authorization/latest/reference/reference_policies_actions-resources-contextkeys.html) in the *Service Authorization Reference*.
        + **Default** – Tests a single value in the request against the condition key value in the policy. The condition returns true if the value in the request matches the value in the policy. If the policy specifies more than one value then they are treated as an "or" test, and the condition returns true if the request values matches any of the policy values.
        + **For any value in a request** – When the request can have multiple values, this option tests whether *at least one* of the request values matches at least one of the condition key values in the policy. The condition returns true if any one of the key values in the request matches any one of the condition values in the policy. For no matching key or a null dataset, the condition returns false.
        + **For all values in a request** – When the request can have multiple values, this option tests whether *every* request value matches a condition key value in the policy. The condition returns true if every key value in the request matches at least one value in the policy. It also returns true if there are no keys in the request, or if the key values resolve to a null data set, such as an empty string.
      + **Operator** – The [operator](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition_operators.html) specifies the type of comparison to make. The options that are presented depend on the data type of the condition key. For example, the `aws:CurrentTime` global condition key lets you pick from any of the date comparison operators, or `Null`, which you can use to test whether the value is present in the request.

        For any condition operator except the `Null` test, you can choose the [IfExists](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition_operators.html#Conditions_IfExists) option. 
      + **Value** – (Optional) Specify one or more values for which you want to test the request.

      Choose **Add condition**.

      For more information about condition keys, see [IAM JSON Policy Elements: Condition](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html) in the *IAM User Guide*. 

1. To add a statement that *allows* access:

   1. In the JSON editor on the left, change the line `"Effect": "Deny"` to `"Effect": "Allow"`.

      As you choose options on the right, the JSON editor updates to show the corresponding JSON policy on the left.

   1. After you select a service, a list opens that contains the available actions for that service. You can choose **All actions**, or choose one or more individual actions that you want to allow. 

      The JSON on the left updates to include the actions you selected.
**Note**  
If you select an individual action and then also go back and also select **All actions**, the expected entry for `servicename:*` is added to the JSON, but the individual actions that you previously selected are left in the JSON and not removed.

   1. If you want to add actions from additional services, you can choose **All services** at the top of the **Statement** box, and then repeat the previous two steps as needed.

1. (Optional) To add another statement to the policy, choose **Add statement** and use the visual editor to build the next statement. 

1. When you're finished adding statements, choose **Create policy** to save the completed SCP.

Your new SCP appears in the list of the organization's policies. You can now [attach your SCP to the root, OUs, or accounts](orgs_policies_attach.md).

------
#### [ AWS CLI & AWS SDKs ]

**To create a service control policy**  
You can use one of the following commands to create an SCP:
+ AWS CLI: [create-policy](https://docs.aws.amazon.com/cli/latest/reference/organizations/create-policy.html)

  The following example assumes that you have a file named `Deny-IAM.json` with the JSON policy text in it. It uses that file to create a new service control policy.

  ```
  $ aws organizations create-policy \
      --content file://Deny-IAM.json \
      --description "Deny all IAM actions" \
      --name DenyIAMSCP \
      --type SERVICE_CONTROL_POLICY
  {
      "Policy": {
          "PolicySummary": {
              "Id": "p-i9j8k7l6m5",
              "Arn": "arn:aws:organizations::123456789012:policy/o-aa111bb222/service_control_policy/p-i9j8k7l6m5",
              "Name": "DenyIAMSCP",
              "Description": "Deny all IAM actions",
              "Type": "SERVICE_CONTROL_POLICY",
              "AwsManaged": false
          },
           "Content": "{\"Version\":\"2012-10-17\",		 	 	 \"Statement\":[{\"Sid\":\"Statement1\",\"Effect\":\"Deny\",\"Action\":[\"iam:*\"],\"Resource\":[\"*\"]}]}"
      }
  }
  ```
+ AWS SDKs: [CreatePolicy](https://docs.aws.amazon.com/organizations/latest/APIReference/API_CreatePolicy.html)

------

**Note**  
SCPs don't take effect on the management account and in a few other situations. For more information, see [Tasks and entities not restricted by SCPs](orgs_manage_policies_scps.md#not-restricted-by-scp).

## Create a resource control policy (RCP)
<a name="create-an-rcp"></a>

**Minimum permissions**  
To create RCPs, you need permission to run the following action:  
`organizations:CreatePolicy`

------
#### [ AWS Management Console ]

**To create a resource control policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **Resource control policy** page, choose **Create policy**. 

1. On the [**Create new resource control policy** page](https://console.aws.amazon.com/organizations/home/policies/service-control/create), enter a **Policy name** and an optional **Policy description**.

1. (Optional) Add one or more tags by choosing **Add tag** and then entering a key and an optional value. Leaving the value blank sets it to an empty string; it isn't `null`. You can attach up to 50 tags to a policy. For more information, see [Tagging AWS Organizations resourcesConsiderations](orgs_tagging.md).
**Note**  
In most of the steps that follow, we discuss using the controls on the right side of the JSON editor to construct the policy, element by element. Alternatively, you can, at any time, simply enter text in the JSON editor on the left side of the window. You can directly type, or use copy and paste.

1. To add a statement:

   1. In the right **Edit statement** pane of the editor, under **Add actions**, choose an AWS service.

      As you choose options on the right, the JSON editor updates to show the corresponding JSON policy on left.

   1. After you select a service, a list opens that contains the available actions for that service. You can choose **All actions**, or choose one or more individual actions that you want to deny. 

      The JSON on the left updates to include the actions you selected.
**Note**  
If you select an individual action and then also go back and also select **All actions**, the expected entry for `servicename:*` is added to the JSON, but the individual actions that you previously selected are left in the JSON and not removed.

   1. If you want to add actions from additional services, you can choose **All services** at the top of the **Statement** box, and then repeat the previous two steps as needed.

   1. Specify resources to include in the statement.
      + Next to **Add a resource**, choose **Add**.
      + In the **Add resource** dialog, choose the service whose resources you want to control from the list. You can select from among only those services you selected in the previous step.
      + Under **Resource type**, choose the type of resource you want to control.
      + Complete the Amazon Resource Name (ARN) in **Resource ARN** to identify the specific resource to which you want to control access. You must replace all placeholders that are surrounded by curly braces `{}`. You can specify wild cards (`*`) where that resource type's ARN syntax permits. See the [documentation](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_resource.html#reference_policies_elements_resource_wildcards) for a specific resource type for information about where you can use wild cards.
      + Save your addition to the policy by choosing **Add resource**. The `Resource` element in the JSON reflects your additions or changes. The **Resource** element is required. 
**Tip**  
If you want to specify all resources for the selected service, either choose the **All resources** option in the list, or edit the `Resource` statement directly in the JSON to read `"Resource":"*"`.

   1. (Optional) To specify conditions that limit when a policy statement is in effect, next to **Add condition**, choose **Add**. 
      + **Condition key** – From the list you can choose any condition key that is available for all AWS services (for example, `aws:SourceIp`) or a service-specific key for only one of the services that you selected for this statement. 
      + **Qualifier** – (Optional) When the request has more than one values for a multivalued context key, you can specify a [qualifier](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_multi-value-conditions.html) for testing requests against the values. For more information see, [Single-valued vs. multivalued context keys](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-single-vs-multi-valued-context-keys.html) in the *IAM User Guide*. To check if a request can have multiple values, see the [Actions, resources, and condition keys for AWS services](https://docs.aws.amazon.com/service-authorization/latest/reference/reference_policies_actions-resources-contextkeys.html) in the *Service Authorization Reference*.
        + **Default** – Tests a single value in the request against the condition key value in the policy. The condition returns true if the value in the request matches the value in the policy. If the policy specifies more than one value then they are treated as an "or" test, and the condition returns true if the request values matches any of the policy values.
        + **For any value in a request** – When the request can have multiple values, this option tests whether *at least one* of the request values matches at least one of the condition key values in the policy. The condition returns true if any one of the key values in the request matches any one of the condition values in the policy. For no matching key or a null dataset, the condition returns false.
        + **For all values in a request** – When the request can have multiple values, this option tests whether *every* request value matches a condition key value in the policy. The condition returns true if every key value in the request matches at least one value in the policy. It also returns true if there are no keys in the request, or if the key values resolve to a null data set, such as an empty string.
      + **Operator** – The [operator](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition_operators.html) specifies the type of comparison to make. The options that are presented depend on the data type of the condition key. For example, the `aws:CurrentTime` global condition key lets you pick from any of the date comparison operators, or `Null`, which you can use to test whether the value is present in the request.

        For any condition operator except the `Null` test, you can choose the [IfExists](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition_operators.html#Conditions_IfExists) option. 
      + **Value** – (Optional) Specify one or more values for which you want to test the request.

      Choose **Add condition**.

      For more information about condition keys, see [IAM JSON Policy Elements: Condition](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html) in the *IAM User Guide*. 

   1. (Optional) To use the `NotAction` element to deny access to all actions ***except*** those specified, replace `Action` in the left pane with `NotAction`, just after the `"Effect": "Deny",` element. For more information, see [IAM JSON Policy Elements: NotAction](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_notaction.html) in the *IAM User Guide*. 

1. (Optional) To add another statement to the policy, choose **Add statement** and use the visual editor to build the next statement. 

1. When you're finished adding statements, choose **Create policy** to save the completed RCP.

Your new RCP appears in the list of the organization's policies. You can now [attach your RCP to the root, OUs, or accounts](orgs_policies_attach.md).

------
#### [ AWS CLI & AWS SDKs ]

**To create a resource control policy**  
You can use one of the following commands to create an RCP:
+ AWS CLI: [create-policy](https://docs.aws.amazon.com/cli/latest/reference/organizations/create-policy.html)

  The following example assumes that you have a file named `Deny-IAM.json` with the JSON policy text in it. It uses that file to create a new resource control policy.

  ```
  $ aws organizations create-policy \
      --content file://Deny-IAM.json \
      --description "Deny all IAM actions" \
      --name DenyIAMRCP \
      --type RESOURCE_CONTROL_POLICY
  {
      "Policy": {
          "PolicySummary": {
              "Id": "p-i9j8k7l6m5",
              "Arn": "arn:aws:organizations::123456789012:policy/o-aa111bb222/resource_control_policy/p-i9j8k7l6m5",
              "Name": "DenyIAMRCP",
              "Description": "Deny all IAM actions",
              "Type": "RESOURCE_CONTROL_POLICY",
              "AwsManaged": false
          },
           "Content": "{\"Version\":\"2012-10-17\",		 	 	 \"Statement\":[{\"Sid\":\"Statement1\",\"Effect\":\"Deny\",\"Action\":[\"iam:*\"],\"Resource\":[\"*\"]}]}"
      }
  }
  ```
+ AWS SDKs: [CreatePolicy](https://docs.aws.amazon.com/organizations/latest/APIReference/API_CreatePolicy.html)

------

**Note**  
RCPs don't take effect on the management account and in a few other situations. For more information, see [Resources and entities not restricted by RCPs](orgs_manage_policies_rcps.md#actions-not-restricted-by-rcps).

## Create a declarative policy
<a name="create-declarative-policy-procedure"></a>

**Minimum permissions**  
To create a declarative policy, you need permission to run the following action:  
`organizations:CreatePolicy`

------
#### [ AWS Management Console ]

**To create a declarative policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the ** [Declarative policies](https://console.aws.amazon.com/organizations/v2/home/policies/declarative-policy-ec2)** page, choose **Create policy**. 

1. On the [**Create new declarative policy for EC2** page](https://console.aws.amazon.com/organizations/v2/home/policies/declarative-policy-ec2/create), enter a **Policy name** and an optional **Policy description**.

1. (Optional) You can add one or more tags to the policy by choosing **Add tag** and then entering a key and an optional value. Leaving the value blank sets it to an empty string; it isn't `null`. You can attach up to 50 tags to a policy. For more information, see [Tagging AWS Organizations resourcesConsiderations](orgs_tagging.md).

1. You can build the policy using the **Visual editor** as described in this procedure. You can also enter or paste policy text in the **JSON** tab. For information about declarative policy syntax, see [Declarative policy syntax and examples](orgs_manage_policies_declarative_syntax.md).

   If you choose to use the **Visual editor**, select the service attribute you want to include in your declarative policy. For more information, see [Supported AWS services and attributes](orgs_manage_policies_declarative.md#orgs_manage_policies_declarative-supported-controls).

1. Choose **Add service attribute**, and configure the attribute to your specifications. For more detailed information on the each effect, see [Declarative policy syntax and examples](orgs_manage_policies_declarative_syntax.md).

1. When you're finished editing your policy, choose **Create policy** at the lower-right corner of the page.

------
#### [ AWS CLI & AWS SDKs ]

**To create a declarative policy**  
You can use one of the following to create a declarative policy:
+ AWS CLI: [create-policy](https://docs.aws.amazon.com/cli/latest/reference/organizations/create-policy.html)

  1. Create a declarative policy like the following, and store it in a text file.

     ```
     {
         "ec2_attributes": {
             "image_block_public_access": {
                 "state": {
                     "@@assign": "block_new_sharing"
                 }
             }
         }
     }
     ```

     This declarative policy specifies that all accounts affected by the policy are must be configured so that new Amazon Machine Images (AMIs) are not publicly sharable. For information about declarative policy syntax, see [Declarative policy syntax and examples](orgs_manage_policies_declarative_syntax.md).

  1. Import the JSON policy file to create a new policy in the organization. In this example, the previous JSON file was named `policy.json`.

     ```
     $ aws organizations create-policy \
         --type DECLARATIVE_POLICY_EC2 \
         --name "MyTestPolicy" \
         --description "My test policy" \
         --content file://policy.json
     {
         "Policy": {
             "Content": "{"ec2_attributes":{"image_block_public_access":{"state":{"@@assign":"block_new_sharing"}}}}".
             "PolicySummary": {
                 "Id": "p-i9j8k7l6m5"
                 "Arn": "arn:aws:organizations::o-aa111bb222:policy/declarative_policy_ec2/p-i9j8k7l6m5",
                 "Description": "My test policy",
                 "Name": "MyTestPolicy",
                 "Type": "DECLARATIVE_POLICY_EC2"
             }
         }
     }
     ```
+ AWS SDKs: [CreatePolicy](https://docs.aws.amazon.com/organizations/latest/APIReference/API_CreatePolicy.html)

------

**What to do next**  
After you create a declarative policy, assess readiness using the [account status report](orgs_manage_policies_declarative.md#orgs_manage_policies_declarative-account-status-report). You can then enforce your baseline configurations. To do that, you can [attach the policy](orgs_policies_attach.md) to the organization root, organizational units (OUs), AWS accounts within your organization, or a combination of all of those.

## Create a backup policy
<a name="create-backup-policy-procedure"></a>

**Minimum permissions**  
To create a backup policy, you need permission to run the following action:  
`organizations:CreatePolicy`

------
#### [ AWS Management Console ]

You can create a backup policy in the AWS Management Console in one of two ways:
+ A visual editor that lets you choose options and generates the JSON policy text for you.
+ A text editor that lets you directly create the JSON policy text yourself. 

The visual editor makes the process easy, but it limits your flexibility. It's a great way to create your first policies and get comfortable with using them. After you understand how they work and have started to be limited by what the visual editor provides, you can add advanced features to your policies by editing the JSON policy text yourself. The visual editor uses only the [@@assign value-setting operator](policy-operators.md#value-setting-operators), and it doesn't provide any access to the [child control operators](policy-operators.md#child-control-operators). You can add the child control operators only if you manually edit the JSON policy text.

**To create a backup policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[Backup policies](https://console.aws.amazon.com/organizations/v2/home/policies/backup-policy)** page, choose **Create policy**. 

1. On the **Create policy** page, enter a ****Policy name**** and an optional **Policy description**.

1. (Optional) You can add one or more tags to the policy by choosing **Add tag** and then entering a key and an optional value. Leaving the value blank sets it to an empty string; it isn't `null`. You can attach up to 50 tags to a policy. For more information about tagging, see [Tagging AWS Organizations resourcesConsiderations](orgs_tagging.md).

1. You can build the policy using the **Visual editor** as described in this procedure. You can also enter or paste policy text in the **JSON** tab. For information about backup policy syntax, see [Backup policy syntax and examples](orgs_manage_policies_backup_syntax.md).

   If you choose to use the **Visual editor**, select the backup options appropriate for your scenario. A backup plan consists of three parts. For more information about these backup plan elements, see [Creating a backup plan](https://docs.aws.amazon.com/aws-backup/latest/devguide/creating-a-backup-plan.html) and [Assigning resources](https://docs.aws.amazon.com/aws-backup/latest/devguide/assigning-resources.html) in the *AWS Backup Developer Guide*.

   1. Backup plan general details
      + The **Backup plan name** can consist of only alphanumeric, hyphen, and underline characters.
      + You must select at least one **Backup plan region** from the list. The plan can back up resources in only the selected AWS Regions.

   1. One or more backup rules that specify how and when AWS Backup is to operate. Each backup rule defines the following items:
      +  A schedule that includes the frequency of the backup and the time window in which the backup can occur.
      + The name of the backup vault to use. The **Backup vault name** can consist of only alphanumeric, hyphen, and underline characters. The backup vault must exist before the plan can successfully run. Create the vault using the AWS Backup console or AWS CLI commands.
      + (Optional) One or more **Copy to region** rules to also copy the backup to vaults in other AWS Regions.
      + One or more tag key and value pairs to attach to the backup recovery points created each time this backup plan runs.
      + Lifecycle options that specify when the backup transitions to cold storage, and when the backup expires.

      Choose **Add rule** to add each rule you need to the plan.

      For more information about backup rules, see [Backup Rules](https://docs.aws.amazon.com/aws-backup/latest/devguide/creating-a-backup-plan.html#backup-rules) in the *AWS Backup Developer Guide*.

   1. A resource assignment that specifies which resources that AWS Backup should backup with this plan. The assignment is made by specifying tag pairs that AWS Backup uses to find and match resources
      + The **Resource assignment name** can consist of only alphanumeric, hyphen, and underline characters.
      + Specify the **IAM role** for AWS Backup to use to perform the backup by its name. 

        In the console, you don't specify the entire Amazon Resource Name (ARN). You must include both the role name and its prefix that specifies the type of role. The prefixes are typically `role` or `service-role` , and they are separated from the role name by a forward slash ('/'). For example, you might enter `role/MyRoleName` or `service-role/MyManagedRoleName`. This is converted to a full ARN for you when stored in the underlying JSON.
**Important**  
The specified IAM role must already exist in the account the policy is applied to. If it does not, the backup plan might successfully start backup jobs, but those backup jobs will fail.
      + Specify one or more **Resource tag key** and **Tag values** pairs to identify resources that you want backed up. If there is more than one tag value, separate the values with commas.

      Choose **Add assignment** to add each configured resource assignment to the backup plan.

      For more information, see [Assign Resources to a Backup Plan](https://docs.aws.amazon.com/aws-backup/latest/devguide/create-a-scheduled-backup.html#assign-resources-to-plan) in the *AWS Backup Developer Guide*.

1. When you're finished creating your policy, choose **Create policy**. The policy appears in your list of available backup policies. 

------
#### [ AWS CLI & AWS SDKs ]

**To create a backup policy**  
You can use one of the following to create a backup policy:
+ AWS CLI: [create-policy](https://docs.aws.amazon.com/cli/latest/reference/organizations/create-policy.html)

  Create a backup plan as JSON text similar to the following, and store it in a text file. For complete rules for the syntax, see [Backup policy syntax and examples](orgs_manage_policies_backup_syntax.md).

  ```
  {
      "plans": {
          "PII_Backup_Plan": {
              "regions": { "@@assign": [ "ap-northeast-2", "us-east-1", "eu-north-1" ] },
              "rules": {
                  "Hourly": {
                      "schedule_expression": { "@@assign": "cron(0 5/1 ? * * *)" },
                      "start_backup_window_minutes": { "@@assign": "480" },
                      "complete_backup_window_minutes": { "@@assign": "10080" },
                      "lifecycle": {
                          "move_to_cold_storage_after_days": { "@@assign": "180" },
                          "delete_after_days": { "@@assign": "270" }
                      },
                      "target_backup_vault_name": { "@@assign": "FortKnox" },
                      "copy_actions": {
                          "arn:aws:backup:us-east-1:$account:backup-vault:secondary-vault": {
                              "lifecycle": {
                                  "move_to_cold_storage_after_days": { "@@assign": "10" },
                                  "delete_after_days": { "@@assign": "100" }
                              }
                          }
                      }
                  }
              },
              "selections": {
                  "tags": {
                      "datatype": {
                          "iam_role_arn": { "@@assign": "arn:aws:iam::$account:role/MyIamRole" },
                          "tag_key": { "@@assign": "dataType" },
                          "tag_value": { "@@assign": [ "PII" ] }
                      }
                  }
              }
          }
      }
  }
  ```

  This backup plan specifies that AWS Backup should back up all resources in the affected AWS accounts that are in the specified AWS Regions and that have the tag `dataType` with a value of `PII`.

  Next, import the JSON policy file backup plan to create a new backup policy in the organization. Note the policy ID at the end of the policy ARN in the output.

  ```
  $ aws organizations create-policy \
      --name "MyBackupPolicy" \
      --type BACKUP_POLICY \
      --description "My backup policy" \
      --content file://policy.json{
      "Policy": {
          "PolicySummary": {
              "Arn": "arn:aws:organizations::o-aa111bb222:policy/backup_policy/p-i9j8k7l6m5",
              "Description": "My backup policy",
              "Name": "MyBackupPolicy",
              "Type": "BACKUP_POLICY"
          }
          "Content": "...a condensed version of the JSON policy document you provided in the file...",
      }
  }
  ```
+ AWS SDKs: [CreatePolicy](https://docs.aws.amazon.com/organizations/latest/APIReference/API_CreatePolicy.html)

------

## Create a tag policy
<a name="create-tag-policy-procedure"></a>

**Minimum permissions**  
To create tag policies, you need permission to run the following action:  
`organizations:CreatePolicy`

You can create a tag policy in the AWS Management Console in one of two ways:
+ A visual editor that lets you choose options and generates the JSON policy text for you.
+ A text editor that lets you directly create the JSON policy text yourself. 

The visual editor makes the process easy, but it limits your flexibility. It's a great way to create your first policies and get comfortable with using them. After you understand how they work and have started to be limited by what the visual editor provides, you can add advanced features to your policies by editing the JSON policy text yourself. The visual editor uses only the [@@assign value-setting operator](policy-operators.md#value-setting-operators), and it doesn't provide any access to the [child control operators](policy-operators.md#child-control-operators). You can add the child control operators only if you manually edit the JSON policy text.

------
#### [ AWS Management Console ]

You can create a tag policy in the AWS Management Console in one of two ways:
+ A visual editor that lets you choose options and generates the JSON policy text for you.
+ A text editor that lets you directly create the JSON policy text yourself. 

The visual editor makes the process easy, but it limits your flexibility. It's a great way to create your first policies and get comfortable with using them. After you understand how they work and have started to be limited by what the visual editor provides, you can add advanced features to your policies by editing the JSON policy text yourself. The visual editor uses only the [@@assign value-setting operator](policy-operators.md#value-setting-operators), and it doesn't provide any access to the [child control operators](policy-operators.md#child-control-operators). You can add the child control operators only if you manually edit the JSON policy text.

**To create a tag policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[Tag policies](https://console.aws.amazon.com/organizations/v2/home/policies/tag-policy)** page, choose **Create policy**. 

1. On the **Create policy** page, enter a ****Policy name**** and an optional **Policy description**.

1. (Optional) You can add one or more tags to the policy object itself. These tags are not part of the policy. To do this, choose **Add tag** and then enter a key and an optional value. Leaving the value blank sets it to an empty string; it isn't `null`. You can attach up to 50 tags to a policy. For more information, see [Tagging AWS Organizations resourcesConsiderations](orgs_tagging.md).

1. You can build the tag policy using the **Visual editor** as described in this procedure. You can also type or paste a tag policy in the **JSON** tab. For information about tag policy syntax, see [Tag policy syntax](orgs_manage_policies_example-tag-policies.md#tag-policy-syntax-reference).

   If you choose to use the **Visual editor**, specify the following:

1. For **New tag key 1**, specify the name of a tag key to add.

1. For **Compliance Options** you can select the following options:

   1. **Use the capitalization that you've specified above for the tag key** — leave this option cleared (the default) to specify that the inherited parent tag policy, if any exists, should define the case treatment for the tag key.

      Enable this option if you want to mandate a specific capitalization for the tag key using this policy. If you select this option, the capitalization you specified for **Tag Key** overrides the case treatment specified in an inherited parent policy. 

      If a parent policy doesn't exist and you don't enable this option, only tag keys in all lowercase characters are considered compliant. For more information about inheritance from parent policies, see [Understanding management policy inheritance](orgs_manage_policies_inheritance_mgmt.md).
**Tip**  
Consider using the example tag policy shown in [Example 1: Define organization-wide tag key case](orgs_manage_policies_example-tag-policies.md#tag-policy-example-key-case) as a guide in creating a tag policy that define tag keys and their case treatment. Attach it to the organization root. Later, you can create and attach additional tag policies to OUs or accounts to create additional tagging rules. 

   1. **Specify allowed values for this tag key** — enable this option if you want to add allowed values for this tag key to any values inherited from a parent policy.

      By default, this option is cleared, which means that only those values defined in and inherited from a parent policy are considered compliant. If a parent policy doesn't exist and you don't specify tag values then any value (including no value at all) is considered compliant. 

      To update the list of acceptable tag values, select **Specify allowed values for this tag key** and then choose **Specify values**. When prompted, enter the new values (one value per box), and then choose **Save changes**.

1. For **Resource types to enforce**, you can select **Prevent noncompliant operations for this tag**.

   We recommend that you leave this option cleared (the default) unless you are experienced with using tag policies. Make sure that you have reviewed the recommendations in [Enforce tagging consistency](orgs_manage_policies_tag-policies-enforcement.md), and test thoroughly. Otherwise, you could prevent users in your organization's accounts from tagging the resources they need. 

   If you do want to enforce compliance with this tag key, select the check box and then **Specify resource types**. When prompted, select the resource types to include in the policy. Then choose **Save changes**.
**Important**  
When you select this option, any operations that manipulate tags for resources of the specified types succeed only if the operation results in tags that are compliant with the policy.

1. (Optional) To add another tag key to this tag policy, choose **Add tag key**. Then perform steps 6–9 to define the tag key.

1. When you're finished building your tag policy, choose **Save changes**.

------
#### [ AWS CLI & AWS SDKs ]

**To create a tag policy**  
You can use one of the following to create a tag policy:
+ AWS CLI: [create-policy](https://docs.aws.amazon.com/cli/latest/reference/organizations/create-policy.html)

  You can use any text editor to create a tag policy. Use JSON syntax and save the tag policy as a file with any name and extension in a location of your choosing. Tag policies can have a maximum of 2,500 characters, including spaces. For information about tag policy syntax, see [Tag policy syntax](orgs_manage_policies_example-tag-policies.md#tag-policy-syntax-reference).

**To create a tag policy**

  1. Create a tag policy in a text file that looks similar to the following:

     Contents of `testpolicy.json`:

     ```
     {
         "tags": {
             "CostCenter": {
                 "tag_key": {
                     "@@assign": "CostCenter"
                 }
             }
         }
     }
     ```

     This tag policy defines the `CostCenter` tag key. The tag can accept any value or no value. A policy like this means that a resource that has the CostCenter tag attached with or without a value is compliant.

  1. Create a policy that contains the policy content from the file. Extra white space in the output has been truncated for readability.

     ```
     $ aws organizations create-policy \
         --name "MyTestTagPolicy" \
         --description "My Test policy" \
         --content file://testpolicy.json \
         --type TAG_POLICY
     {
         "Policy": {
             "PolicySummary": {
                 "Id": "p-a1b2c3d4e5",
                 "Arn": "arn:aws:organizations::123456789012:policy/o-aa111bb222/tag_policy/p-a1b2c3d4e5",
                 "Name": "MyTestTagPolicy",
                 "Description": "My Test policy",
                 "Type": "TAG_POLICY",
                 "AwsManaged": false
             },
             "Content": "{\n\"tags\":{\n\"CostCenter\":{\n\"tag_key\":{\n\"@@assign\":\"CostCenter\"\n}\n}\n}\n}\n\n"
         }
     }
     ```
+ AWS SDKs: [CreatePolicy](https://docs.aws.amazon.com/organizations/latest/APIReference/API_CreatePolicy.html)

------

## Create a chat applications policy
<a name="create-chatbot-policy-procedure"></a>

**Minimum permissions**  
To create a chat applications policy, you need permission to run the following action:  
`organizations:CreatePolicy`

------
#### [ AWS Management Console ]

You can create a chat applications policy in the AWS Management Console in one of two ways:
+ A visual editor that lets you choose options and generates the JSON policy text for you.
+ A text editor that lets you directly create the JSON policy text yourself. 

The visual editor makes the process easy, but it limits your flexibility. It's a great way to create your first policies and get comfortable with using them. After you understand how they work and have started to be limited by what the visual editor provides, you can add advanced features to your policies by editing the JSON policy text yourself. The visual editor uses only the [@@assign value-setting operator](policy-operators.md#value-setting-operators), and it doesn't provide any access to the [child control operators](policy-operators.md#child-control-operators). You can add the child control operators only if you manually edit the JSON policy text.

**To create a chat applications policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[Chatbot policies](https://console.aws.amazon.com/organizations/v2/home/policies/chatbot-policy)** page, choose **Create policy**. 

1. On the [**Create new chat applications policy** page](https://console.aws.amazon.com/organizations/v2/home/policies/chatbot-policy/create), enter a **Policy name** and an optional **Policy description**.

1. (Optional) You can add one or more tags to the policy by choosing **Add tag** and then entering a key and an optional value. Leaving the value blank sets it to an empty string; it isn't `null`. You can attach up to 50 tags to a policy. For more information, see [Tagging AWS Organizations resourcesConsiderations](orgs_tagging.md).

1. You can build the policy using the **Visual editor** as described in this procedure. You can also enter or paste policy text in the **JSON** tab. For information about chat applications policy syntax, see [Chat applications policy syntax and examples](orgs_manage_policies_chatbot_syntax.md).

   If you choose to use the **Visual editor**, configure your chat applications policy by specifying access controls for chat clients.

   1. Choose one of the following for **Set Amazon Chime chat client access**
      + Deny chime access.
      + Allow Chime access.

   1. Choose on the following for **Set Microsoft Teams chat client access**
      + Deny access to all Teams
      + Allow access to all Teams
      + Restrict access to named Teams

   1. Choose one of the following for **Set Slack chat client access**
      + Deny access to all Slack workspaces
      + Allow access to all Slack workspaces
      + Restrict access to named Slack worksapces
**Note**  
In addition, you can select **Limit Amazon Q Developer in chat applications usage to only private Slack channels**.

   1. Select the following options for **Set IAM permissions types**
      + **Enable Channel level IAM role** — All channel members share IAM role permissions to run tasks in a channel. A channel role is appropriate if channel members require the same permissions.
      + **Enable User level IAM role** — Channel members must choose an IAM user role to perform actions (Requires Console access to choose roles). User roles are apporopriate if channel members require different permissions and can choose their user roles.

1. When you're finished creating your policy, choose **Create policy**. The policy appears in your list of chatbot backup policies. 

------
#### [ AWS CLI & AWS SDKs ]

**To create a chat applications policy**  
You can use one of the following to create a chat applications policy:
+ AWS CLI: [create-policy](https://docs.aws.amazon.com/cli/latest/reference/organizations/create-policy.html)

  You can use any text editor to create a chat applications policy. Use JSON syntax and save the chat applications policy as a file with any name and extension in a location of your choosing. Chat applications policies can have a maximum of ? characters, including spaces. For information about tag policy syntax, see [Chat applications policy syntax and examples](orgs_manage_policies_chatbot_syntax.md).

**To create a chat applications policy**

  1. Create a chat applications policy in a text file that looks similar to the following:

     Contents of `testpolicy.json`:

     ```
     {
        "chatbot": {
           "platforms": {
              "slack": {
                 "client": {
                    "@@assign": "enabled"
                 },
                 "workspaces": {
                    "@@assign": [
                       "Slack-Workspace-Id"
                    ]
                 },
                 "default": {
                    "supported_channel_types": {
                       "@@assign": [
                          "private"
                       ]
                    }
                 }
              },
              "microsoft_teams": {
                 "client": {
                    "@@assign": "disabled"
                 }
              }
           }
        }
     }
     ```

     This chat applications policy allows only private Slack channels in a specific workspace, disables Microsoft Teams, and supports all [role settings](https://docs.aws.amazon.com/chatbot/latest/adminguide/understanding-permissions.html#role-settings).

  1. Create a policy that contains the policy content from the file. Extra white space in the output has been truncated for readability.

     ```
     $ aws organizations create-policy \
         --name "MyTestChatbotPolicy" \
         --description "My Test policy" \
         --content file://testpolicy.json \
         --type CHATBOT_POLICY
     {
         "Policy": {
             "PolicySummary": {
                 "Id": "p-a1b2c3d4e5",
                 "Arn": "arn:aws:organizations::123456789012:policy/o-aa111bb222/chatbot_policy/p-a1b2c3d4e5",
                 "Name": "MyTestChatApplicationsPolicy",
                 "Description": "My Test policy",
                 "Type": "CHATBOT_POLICY",
                 "AwsManaged": false
             },
             "Content": "{"chatbot":{"platforms":{"slack":{"client":{"@@assign":"enabled"},"workspaces":{"@@assign":["Slack-Workspace-Id"]},"supported_channel_types":{"@@assign":["private"]}},"microsoft_teams":{"client":{"@@assign":"disabled"}}}}}"
         }
     }
     ```
+ AWS SDKs: [CreatePolicy](https://docs.aws.amazon.com/organizations/latest/APIReference/API_CreatePolicy.html)

------

## Create an AI services opt-out policy
<a name="create-ai-opt-out-policy-procedure"></a>

**Minimum permissions**  
To create an AI services opt-out policy, you need permission to run the following action:  
`organizations:CreatePolicy`

------
#### [ AWS Management Console ]

**To create an AI services opt-out policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[AI services opt-out policies](https://console.aws.amazon.com/organizations/v2/home/policies/aiservices-opt-out-policy)** page, choose **Create policy**. 

1. On the [**Create new AI services opt-out policy** page](https://console.aws.amazon.com/organizations/v2/home/policies/aiservices-opt-out-policy/create), enter a **Policy name** and an optional **Policy description**.

1. (Optional) You can add one or more tags to the policy by choosing **Add tag** and then entering a key and an optional value. Leaving the value blank sets it to an empty string; it isn't `null`. You can attach up to 50 tags to a policy. For more information, see [Tagging AWS Organizations resourcesConsiderations](orgs_tagging.md).

1. Enter or paste the policy text in the **JSON** tab. For information about AI services opt-out policy syntax, see [AI services opt-out policy syntax and examples](orgs_manage_policies_ai-opt-out_syntax.md). For example policies that you can use as a starting point, see [AI services opt-out policy examples](orgs_manage_policies_ai-opt-out_syntax.md#ai-opt-out-policy-examples).

1. When you're finished editing your policy, choose **Create policy** at the lower-right corner of the page.

------
#### [ AWS CLI & AWS SDKs ]

**To create an AI services opt-out policy**  
You can use one of the following to create a tag policy:
+ AWS CLI: [create-policy](https://docs.aws.amazon.com/cli/latest/reference/organizations/create-policy.html)

  1. Create an AI services opt-out policy like the following, and store it in a text file. Note that "`optOut`" and "`optIn`" are case-sensitive.

     ```
     {
         "services": {
             "default": {
                 "opt_out_policy": {
                     "@@assign": "optOut"
                 }
             },
             "rekognition": {
                 "opt_out_policy": {
                     "@@assign": "optIn"
                 }
             }
         }
     }
     ```

     This AI services opt-out policy specifies that all accounts affected by the policy are opted out of all AI services except for Amazon Rekognition. 

  1. Import the JSON policy file to create a new policy in the organization. In this example, the previous JSON file was named `policy.json`.

     ```
     $ aws organizations create-policy \
         --type AISERVICES_OPT_OUT_POLICY \
         --name "MyTestPolicy" \
         --description "My test policy" \
         --content file://policy.json
     {
         "Policy": {
             "Content": "{\"services\":{\"default\":{\"opt_out_policy\":{\"@@assign\":\"optOut\"}},\"rekognition\":{\"opt_out_policy\":{\"@@assign\":\"optIn\"}}}}",
             "PolicySummary": {
                 "Id": "p-i9j8k7l6m5"
                 "Arn": "arn:aws:organizations::o-aa111bb222:policy/aiservices_opt_out_policy/p-i9j8k7l6m5",
                 "Description": "My test policy",
                 "Name": "MyTestPolicy",
                 "Type": "AISERVICES_OPT_OUT_POLICY"
             }
         }
     }
     ```
+ AWS SDKs: [CreatePolicy](https://docs.aws.amazon.com/organizations/latest/APIReference/API_CreatePolicy.html)

------

## Create a upgrade rollout policy
<a name="create-upgrade-rollout-policy-procedure"></a>

**Minimum permissions**  
To create a upgrade rollout policy, you need permission to run the following action:  
`organizations:CreatePolicy`

------
#### [ AWS Management Console ]

**To create a upgrade rollout policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[Upgrade rollout policies](https://console.aws.amazon.com/organizations/v2/home/policies/upgrade-rollout-policy)** page, choose **Create policy**. 

1. On the [**Create new upgrade rollout policy** page](https://console.aws.amazon.com/organizations/v2/home/policies/declarative-policy-ec2/create), enter a **Policy name** and an optional **Policy description**.

1. (Optional) You can add one or more tags to the policy by choosing **Add tag** and then entering a key and an optional value. Leaving the value blank sets it to an empty string; it isn't `null`. You can attach up to 50 tags to a policy. For more information, see [Tagging AWS Organizations resourcesConsiderations](orgs_tagging.md).

1. You can build the policy using the **Visual editor** as described in this procedure. You can also enter or paste policy text in the **JSON** tab. For more information, see [Upgrade rollout policy syntax and examples](orgs_manage_policies_upgrade_syntax.md).

   If you choose to use the **Visual editor**, select the upgrade order you want to use for your upgrade rollout policy. For more information about upgrade orders, see [What are upgrade rollout policies?](orgs_manage_policies_upgrade_rollout.md#orgs_manage_policies_upgrade_rollout_what_are).

1. Under **Policy order and resources**, select either **First**, **Second** or **Last** from the menu.

1. (Optional) To target individual resources with this policy, select **Override specific resources**, and then do the following:

   1. In **Key**, enter the name of the resource that you want to override.

   1. In **Value**, enter the ARN for the resource.

   1. In **Upgrade order**, choose the preferred order that should be applied to this resource.

   1. If additional resources need to be specified, choose **Add tag**, and then repeat the previous steps to define the tag key.

1. When you're finished editing your policy, choose **Create policy** at the lower-right corner of the page.

Your new policy appears in the list of upgrade rollout policies. You can now [attach your policy to the root, OUs, or accounts](orgs_policies_attach.md).

------
#### [ AWS CLI & AWS SDKs ]

**To create a upgrade rollout policy**  
You can use one of the following to create a upgrade rollout policy:
+ AWS CLI: [create-policy](https://docs.aws.amazon.com/cli/latest/reference/organizations/create-policy.html)

  1. Create a upgrade rollout policy like the following, and store it in a text file.

     ```
     {
         "upgrade_rollout": {
             "default": {
                 "patch_order": {
                     "@@assign": "last"
                 }
             },
             "tags": {
                 "my_patch_order_tag": {
                     "tag_values": {
                         "tag1": {
                             "patch_order": {
                                 "@@assign": "first"
                             }
                         },
                         "tag2": {
                             "patch_order": {
                                 "@@assign": "second"
                             }
                         },
                         "tag3": {
                             "patch_order": {
                                 "@@assign": "last"
                             }
                         }
                     }
                 }
             }
         }
     }
     ```

     This upgrade rollout policy defines the order of how AWS services apply automatic upgrades across your resources. For information about upgrade rollout policy syntax, see [Upgrade rollout policy syntax and examples](orgs_manage_policies_upgrade_syntax.md).

  1. Import the JSON policy file to create a new policy in the organization. In this example, the previous JSON file was named `policy.json`.

     ```
     $ aws organizations create-policy \
         --type UPGRADE_ROLLOUT_POLICY \
         --name "MyTestPolicy" \
         --description "My test policy" \
         --content file://policy.json
     {
     "Policy": {
             "PolicySummary": {
                 "Id": "p-i9j8k7l6m5",
                 "Arn": "arn:aws:organizations::123456789012:policy/o-aa111bb222/upgrade_rollout_policy/p-i9j8k7l6m5",
                 "Name": "MyTestPolicy",
                 "Description": "My test policy",
                 "Type": "UPGRADE_ROLLOUT_POLICY",
                 "AwsManaged": false
             },
             "Content": "{\n    \"upgrade_rollout\": {\n        \"default\": {\n            \"patch_order\": {\n                \"@@assign\": \"last\"\n            }\n        },\n        \"tags\": {\n            \"my_patch_order_tag\": {\n                \"tag_values\": {\n                    \"tag1\": {\n                        \"patch_order\": {\n                            \"@@assign\": \"first\"\n                        }\n                    },\n                    \"tag2\": {\n                        \"patch_order\": {\n                            \"@@assign\": \"second\"\n                        }\n                    },\n                    \"tag3\": {\n                        \"patch_order\": {\n                            \"@@assign\": \"last\"\n                        }\n                    }\n                }\n            }\n        }\n    }\n}\n"
         }
     }
     ```
+ AWS SDKs: [CreatePolicy](https://docs.aws.amazon.com/organizations/latest/APIReference/API_CreatePolicy.html)

------

## Create a Security Hub policy
<a name="create-security-hub-policy-procedure"></a>

**Minimum permissions**  
To create a Security Hub policy, you need permission to run the following action:  
`organizations:CreatePolicy`

------
#### [ AWS Management Console ]

**To create a Security Hub policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[Security Hub policies](https://console.aws.amazon.com/organizations/v2/home/policies/securityhub-policy)** page, choose **Create policy**. 

1. On the [**Create new Security Hub policy** page](https://console.aws.amazon.com/organizations/v2/home/policies/securityhub-policy/create), enter a **Policy name** and an optional **Policy description**.

1. (Optional) You can add one or more tags to the policy by choosing **Add tag** and then entering a key and an optional value. Leaving the value blank sets it to an empty string; it isn't `null`. You can attach up to 50 tags to a policy. For more information, see [Tagging AWS Organizations resourcesConsiderations](orgs_tagging.md).

1. Enter or paste the policy text in the JSON code box. For information about the Security Hub policy syntax, see [Security Hub policy syntax and examples](orgs_manage_policies_security_hub_syntax.md). For example policies that you can use as a starting point, see [Security Hub policy examples](orgs_manage_policies_security_hub_syntax.md#security-hub-policy-examples).

1. When you're finished editing your policy, choose **Create policy** at the lower-right corner of the page.

------
#### [ AWS CLI & AWS SDKs ]

**To create an Security Hub policy**  
You can use one of the following to create a Security Hub policy:
+ AWS CLI: [create-policy](https://docs.aws.amazon.com/cli/latest/reference/organizations/create-policy.html)

  **Example: Create a policy that enables Security Hub in all supported Regions**

  The following example assumes that you have a file named `testPolicy_enableAllSupportedRegions.json` with the JSON policy text in it. It uses that file to create a new Security Hub policy.

  ```
  $ aws organizations create-policy \
      --content file://./testPolicy_enableAllSupportedRegions.json \
      --name "testPolicy_enableAllSupportedRegions" \
      --description "Test policy to enable securityhub in ALL_SUPPORTED Regions" \
      --type SECURITYHUB_POLICY
  {
      "Policy": {
          "PolicySummary": {
              "Id": "p-66ev7hgcvj",
              "Arn": "arn:aws:organizations::123456789012:policy/o-aa111bb222/securityhub_policy/p-66ev7hgcvj",
              "Name": "testPolicy_enableAllSupportedRegions",
              "Description": "Test policy to enable securityhub in ALL_SUPPORTED Regions",
              "Type": "SECURITYHUB_POLICY",
              "AwsManaged": false
          },
          "Content": "{\n  \"securityhub\": {\n    \"enable_in_regions\": {\n      \"@@assign\":[\n        \"ALL_SUPPORTED\"\n      ]\n    },\n    \"disable_in_regions\": {\n      \"@@assign\":[]\n    }\n  }\n}\n"
      }
  }
  ```

  **Example: Create a policy that enables Security Hub in all supported Regions but disable in the us-east-1 Region**

  The following example assumes that you have a file named `testPolicy_enableAllSupportedRegions_Disable_us-east-1.json` with the JSON policy text in it. It uses that file to create a new Security Hub policy.

  ```
  $ aws organizations create-policy \
      --content file://./testPolicy_enableAllSupportedRegions_Disable_us-east-1.json \
      --name "testPolicy_enableAllSupportedRegions_Disable_us-east-1" \
      --description "Test policy to enable securityhub in ALL_SUPPORTED Regions but disable in us-east-1 Region" \
      --type SECURITYHUB_POLICY
  {
      "Policy": {
          "PolicySummary": {
              "Id": "p-66217dwpos",
              "Arn": "arn:aws:organizations::123456789012:policy/o-aa111bb222/securityhub_policy/p-66217dwpos",
              "Name": "testPolicy_enableAllSupportedRegions_Disable_us-east-1",
              "Description": "Test policy to enable securityhub in ALL_SUPPORTED Regions but disable in us-east-1 Region",
              "Type": "SECURITYHUB_POLICY",
              "AwsManaged": false
          },
          "Content": "{\n  \"securityhub\": {\n    \"enable_in_regions\": {\n      \"@@assign\":[\n        \"ALL_SUPPORTED\"\n      ]\n    },\n    \"disable_in_regions\": {\n      \"@@assign\":[\n        \"us-east-1\"\n      ]\n    }\n  }\n}\n"
      }
  }
  ```
+ AWS SDKs: [CreatePolicy](https://docs.aws.amazon.com/organizations/latest/APIReference/API_CreatePolicy.html)

------

# Updating organization policies with AWS Organizations
<a name="orgs_policies_update"></a>

When your policy requirements change, you can update an existing policy.

This topic describes how to update policies with AWS Organizations. A *policy* defines the controls that you want to apply to a group of AWS accounts.

**Topics**
+ [Update a service control policy (SCP)](#update_policy)
+ [Update a resource control policy (RCP)](#update_policy-rcp)
+ [Update a declarative policy](#update-declarative-policy-procedure)
+ [Update a backup policy](#update-backup-policy-procedure)
+ [Update a tag policy](#update-tag-policy-procedure)
+ [Update a chat applications policy](#update-chatbot-policy-procedure)
+ [Update an AI services opt-out policy](#update-ai-opt-out-policy-procedure)
+ [Update a Security Hub policy](#update-security-hub-policy-procedure)

## Update a service control policy (SCP)
<a name="update_policy"></a>

When you sign in to your organization's management account, you can rename or change the contents of a policy. Changing the contents of an SCP immediately affects any users, groups, and roles in all attached accounts.

**Minimum permissions**  
To update an SCP, you need permission to run the following actions:  
`organizations:UpdatePolicy` with a `Resource` element in the same policy statement that includes the ARN of the specified policy (or "\$1")
`organizations:DescribePolicy` with a `Resource` element in the same policy statement that includes the ARN of the specified policy (or "\$1")

------
#### [ AWS Management Console ]

**To update a policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[Service control policies](https://console.aws.amazon.com/organizations/v2/home/policies/service-control-policy)** page, choose the name of the policy that you want to update.

1. On the policy's detail page, choose **Edit policy**.

1. Make any or all of the following changes:
   + You can rename the policy by entering a new name in **Policy name**.
   + You can change the description by entering new text in **Policy description**.
   + You can edit the policy text by editing the policy in JSON format in the left pane. Alternatively, you can choose a statement in the editor on the right, and also alter its elements by using the controls. For more details about each control, see the [Creating an SCP procedure](orgs_policies_create.md#create-an-scp) earlier in this topic.

1. When you're finished, choose **Save changes**.

------
#### [ AWS CLI & AWS SDKs ]

**To update a policy**  
You can use one of the following commands to update a policy: 
+ AWS CLI: [update-policy](https://docs.aws.amazon.com/cli/latest/reference/organizations/update-policy.html)

  The following example renames a policy.

  ```
  $ aws organizations update-policy \
      --policy-id p-i9j8k7l6m5 \
      --name "MyRenamedPolicy"
  {
      "Policy": {
          "PolicySummary": {
              "Id": "p-i9j8k7l6m5",
              "Arn": "arn:aws:organizations::123456789012:policy/o-aa111bb222/service_control_policy/p-i9j8k7l6m5",
              "Name": "MyRenamedPolicy",
              "Description": "Blocks all IAM actions",
              "Type": "SERVICE_CONTROL_POLICY",
              "AwsManaged": false
          },
          "Content": "{\"Version\":\"2012-10-17\",		 	 	 \"Statement\":[{\"Sid\":\"Statement1\",\"Effect\":\"Deny\",\"Action\":[\"iam:*\"],\"Resource\":[\"*\"]}]}"
      }
  }
  ```

  The following example adds or changes the description for a service control policy.

  ```
  $ aws organizations update-policy \
      --policy-id p-i9j8k7l6m5 \
      --description "My new policy description"
  {
      "Policy": {
          "PolicySummary": {
              "Id": "p-i9j8k7l6m5",
              "Arn": "arn:aws:organizations::123456789012:policy/o-aa111bb222/service_control_policy/p-i9j8k7l6m5",
              "Name": "MyRenamedPolicy",
              "Description": "My new policy description",
              "Type": "SERVICE_CONTROL_POLICY",
              "AwsManaged": false
          },
          "Content": "{\"Version\":\"2012-10-17\",		 	 	 \"Statement\":[{\"Sid\":\"Statement1\",\"Effect\":\"Deny\",\"Action\":[\"iam:*\"],\"Resource\":[\"*\"]}]}"
      }
  }
  ```

  The following example changes the policy document of the SCP by specifying a file that contains the new JSON policy text.

  ```
  $ aws organizations update-policy \
      --policy-id p-zlfw1r64 
      --content file://MyNewPolicyText.json
  {
      "Policy": {
          "PolicySummary": {
              "Id": "p-i9j8k7l6m5",
              "Arn": "arn:aws:organizations::123456789012:policy/o-aa111bb222/service_control_policy/p-i9j8k7l6m5",
              "Name": "MyRenamedPolicy",
              "Description": "My new policy description",
              "Type": "SERVICE_CONTROL_POLICY",
              "AwsManaged": false
          },
          "Content": "{\"Version\":\"2012-10-17\",		 	 	 \"Statement\":[{\"Sid\":\"AModifiedPolicy\",\"Effect\":\"Deny\",\"Action\":[\"iam:*\"],\"Resource\":[\"*\"]}]}"
      }
  }
  ```
+ AWS SDKs: [UpdatePolicy](https://docs.aws.amazon.com/organizations/latest/APIReference/API_UpdatePolicy.html)

------

## Update a resource control policy (RCP)
<a name="update_policy-rcp"></a>

When you sign in to your organization's management account, you can rename or change the contents of a policy. Changing the contents of an RCP immediately affects any resources in all attached accounts.

**Minimum permissions**  
To update an RCP, you need permission to run the following actions:  
`organizations:UpdatePolicy` with a `Resource` element in the same policy statement that includes the ARN of the specified policy (or "\$1")
`organizations:DescribePolicy` with a `Resource` element in the same policy statement that includes the ARN of the specified policy (or "\$1")

------
#### [ AWS Management Console ]

**To update a policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **Resource control policy** page, choose the name of the policy that you want to update.

1. On the policy's detail page, choose **Edit policy**.

1. Make any or all of the following changes:
   + You can rename the policy by entering a new name in **Policy name**.
   + You can change the description by entering new text in **Policy description**.
   + You can edit the policy text by editing the policy in JSON format in the left pane. Alternatively, you can choose a statement in the editor on the right, and also alter its elements by using the controls. For more details about each control, see the [Creating an RCP procedure](orgs_policies_create.md#create-an-rcp) earlier in this topic.

1. When you're finished, choose **Save changes**.

------
#### [ AWS CLI & AWS SDKs ]

**To update a policy**  
You can use one of the following commands to update a policy: 
+ AWS CLI: [update-policy](https://docs.aws.amazon.com/cli/latest/reference/organizations/update-policy.html)

  The following example renames a policy.

  ```
  $ aws organizations update-policy \
      --policy-id p-i9j8k7l6m5 \
      --name "MyRenamedPolicy"
  {
      "Policy": {
          "PolicySummary": {
              "Id": "p-i9j8k7l6m5",
              "Arn": "arn:aws:organizations::123456789012:policy/o-aa111bb222/service_control_policy/p-i9j8k7l6m5",
              "Name": "MyRenamedPolicy",
              "Description": "Blocks all IAM actions",
              "Type": "SERVICE_CONTROL_POLICY",
              "AwsManaged": false
          },
          "Content": "{\"Version\":\"2012-10-17\",		 	 	 \"Statement\":[{\"Sid\":\"Statement1\",\"Effect\":\"Deny\",\"Action\":[\"iam:*\"],\"Resource\":[\"*\"]}]}"
      }
  }
  ```

  The following example adds or changes the description for a resource control policy.

  ```
  $ aws organizations update-policy \
      --policy-id p-i9j8k7l6m5 \
      --description "My new policy description"
  {
      "Policy": {
          "PolicySummary": {
              "Id": "p-i9j8k7l6m5",
              "Arn": "arn:aws:organizations::123456789012:policy/o-aa111bb222/service_control_policy/p-i9j8k7l6m5",
              "Name": "MyRenamedPolicy",
              "Description": "My new policy description",
              "Type": "SERVICE_CONTROL_POLICY",
              "AwsManaged": false
          },
          "Content": "{\"Version\":\"2012-10-17\",		 	 	 \"Statement\":[{\"Sid\":\"Statement1\",\"Effect\":\"Deny\",\"Action\":[\"iam:*\"],\"Resource\":[\"*\"]}]}"
      }
  }
  ```

  The following example changes the policy document of the RCP by specifying a file that contains the new JSON policy text.

  ```
  $ aws organizations update-policy \
      --policy-id p-zlfw1r64 
      --content file://MyNewPolicyText.json
  {
      "Policy": {
          "PolicySummary": {
              "Id": "p-i9j8k7l6m5",
              "Arn": "arn:aws:organizations::123456789012:policy/o-aa111bb222/service_control_policy/p-i9j8k7l6m5",
              "Name": "MyRenamedPolicy",
              "Description": "My new policy description",
              "Type": "SERVICE_CONTROL_POLICY",
              "AwsManaged": false
          },
          "Content": "{\"Version\":\"2012-10-17\",		 	 	 \"Statement\":[{\"Sid\":\"AModifiedPolicy\",\"Effect\":\"Deny\",\"Action\":[\"iam:*\"],\"Resource\":[\"*\"]}]}"
      }
  }
  ```
+ AWS SDKs: [UpdatePolicy](https://docs.aws.amazon.com/organizations/latest/APIReference/API_UpdatePolicy.html)

------

## Update a declarative policy
<a name="update-declarative-policy-procedure"></a>

**Minimum permissions**  
To update a declarative policy, you must have permission to run the following actions:  
`organizations:UpdatePolicy` with a `Resource` element in the same policy statement that includes the ARN of the specified policy (or "\$1")
`organizations:DescribePolicy` with a `Resource` element in the same policy statement that includes the Amazon Resource Name (ARN) of the specified policy (or "\$1")

------
#### [ AWS Management Console ]

**To update a declarative policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the ** [Declarative policies](https://console.aws.amazon.com/organizations/v2/home/policies/declarative-policy-ec2)** page, choose the name of the policy that you want to update.

1. On the policy's detail page, choose **Edit policy**.

1. You can enter a new **Policy name**, **Policy description**, or edit the **JSON** policy text. For information about declarative policy syntax, see [Declarative policy syntax and examples](orgs_manage_policies_declarative_syntax.md).

1. When you're finished updating the policy, choose **Save changes**.

------
#### [ AWS CLI & AWS SDKs ]

**To update a policy**  
You can use one of the following to update a policy: 
+ AWS CLI: [update-policy](https://docs.aws.amazon.com/cli/latest/reference/organizations/update-policy.html)

  The following example renames a declarative policy.

  ```
  $ aws organizations update-policy \
      --policy-id p-i9j8k7l6m5 \
      --name "Renamed policy"
  {
      "Policy": {
          "PolicySummary": {
              "Id": "p-i9j8k7l6m5",
              "Arn": "arn:aws:organizations::123456789012:policy/o-aa111bb222/declarative_policy_ec2/p-i9j8k7l6m5",
              "Name": "Renamed policy",
              "Type": "DECLARATIVE_POLICY_EC2",
              "AwsManaged": false
          },
          "Content": "{"ec2-configuration":{"ec2_attributes":{"image_block_public_access":{"state":{"@@assign":"block_new_sharing"}}}}".
      }
  }
  ```

  The following example adds or changes the description for a declarative policy.

  ```
  $ aws organizations update-policy \
      --policy-id p-i9j8k7l6m5 \
      --description "My new description"
  {
      "Policy": {
          "PolicySummary": {
              "Id": "p-i9j8k7l6m5",
              "Arn": "arn:aws:organizations::123456789012:policy/o-aa111bb222/declarative_policy_ec2/p-i9j8k7l6m5",
              "Name": "Renamed policy",
              "Description": "My new description",
              "Type": "DECLARATIVE_POLICY_EC2",
              "AwsManaged": false
          },
          "Content": "{"ec2_attributes":{"image_block_public_access":{"state":{"@@assign":"block_new_sharing"}}}}".
      }
  }
  ```
+ AWS SDKs: [UpdatePolicy](https://docs.aws.amazon.com/organizations/latest/APIReference/API_UpdatePolicy.html)

------

## Update a backup policy
<a name="update-backup-policy-procedure"></a>

When you sign in to your organization's management account, you can edit a policy that requires changes in your organization. 

**Minimum permissions**  
To update a backup policy, you must have permission to run the following actions:  
`organizations:UpdatePolicy` with a `Resource` element in the same policy statement that includes the ARN of the policy to update (or "\$1")
`organizations:DescribePolicy` with a `Resource` element in the same policy statement that includes the ARN of the policy to update (or "\$1")

------
#### [ AWS Management Console ]

**To update a backup policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[Backup policies](https://console.aws.amazon.com/organizations/v2/home/policies/backup-policy)** page, choose the name of the policy that you want to update.

1. Choose **Edit policy**.

1. You can enter a new **Policy name**, **Policy description**. You can change the policy content by using either the **Visual editor** or by directly editing the **JSON**. 

1. When you're finished updating the policy, choose **Save changes**.

------
#### [ AWS CLI & AWS SDKs ]

**To update a backup policy**  
You can use one of the following to update a backup policy: 
+ AWS CLI: [update-policy](https://docs.aws.amazon.com/cli/latest/reference/organizations/update-policy.html)

  The following example renames a backup policy.

  ```
  $ aws organizations update-policy \
      --policy-id p-i9j8k7l6m5 \
      --name "Renamed policy"
  {
      "Policy": {
          "PolicySummary": {
              "Id": "p-i9j8k7l6m5",
              "Arn": "arn:aws:organizations::123456789012:policy/o-aa111bb222/backup_policy/p-i9j8k7l6m5",
              "Name": "Renamed policy",
              "Type": "BACKUP_POLICY",
              "AwsManaged": false
          },
           "Content": "{\"plans\":{\"TestBackupPlan\":{\"regions\":{\"@@assign\":   ....TRUNCATED FOR BREVITY....   "@@assign\":[\"Yes\"]}}}}}}}"
      }
  }
  ```

  The following example adds or changes the description for a backup policy.

  ```
  $ aws organizations update-policy \
      --policy-id p-i9j8k7l6m5 \
      --description "My new description"
  {
      "Policy": {
          "PolicySummary": {
              "Id": "p-i9j8k7l6m5",
              "Arn": "arn:aws:organizations::123456789012:policy/o-aa111bb222/backup_policy/p-i9j8k7l6m5",
              "Name": "Renamed policy",
              "Description": "My new description",
              "Type": "BACKUP_POLICY",
              "AwsManaged": false
          },
         "Content": "{\"plans\":{\"TestBackupPlan\":{\"regions\":{\"@@assign\":   ....TRUNCATED FOR BREVITY....   "@@assign\":[\"Yes\"]}}}}}}}"
      }
  }
  ```

  The following example changes the JSON policy document attached to a backup policy. In this example, the content is taken from a file called `policy.json` with the following text:

  ```
  {
      "plans": {
          "PII_Backup_Plan": {
              "regions": { "@@assign": [ "ap-northeast-2", "us-east-1", "eu-north-1" ] },
              "rules": {
                  "Hourly": {
                      "schedule_expression": { "@@assign": "cron(0 5/1 ? * * *)" },
                      "start_backup_window_minutes": { "@@assign": "480" },
                      "complete_backup_window_minutes": { "@@assign": "10080" },
                      "lifecycle": {
                          "move_to_cold_storage_after_days": { "@@assign": "180" },
                          "delete_after_days": { "@@assign": "270" },
                          "opt_in_to_archive_for_supported_resources": {"@@assign": false}
                      },
                      "target_backup_vault_name": { "@@assign": "FortKnox" },
                      "copy_actions": {
                          "arn:aws:backup:us-east-1:$account:backup-vault:secondary-vault": {
                              "lifecycle": {
                                  "move_to_cold_storage_after_days": { "@@assign": "10" },
                                  "delete_after_days": { "@@assign": "100" },
                                  "opt_in_to_archive_for_supported_resources": {"@@assign": false}
                              }
                          }
                      }
                  }
              },
              "selections": {
                  "tags": {
                      "datatype": {
                          "iam_role_arn": { "@@assign": "arn:aws:iam::$account:role/MyIamRole" },
                          "tag_key": { "@@assign": "dataType" },
                          "tag_value": { "@@assign": [ "PII" ] }
                      }
                  }
              }
          }
      }
  }
  ```

  ```
  $ aws organizations update-policy \
      --policy-id p-i9j8k7l6m5 \
      --content file://policy.json
  {
      "Policy": {
          "PolicySummary": {
              "Id": "p-i9j8k7l6m5",
              "Arn": "arn:aws:organizations::123456789012:policy/o-aa111bb222/backup_policy/p-i9j8k7l6m5",
              "Name": "Renamed policy",
              "Description": "My new description",
              "Type": "BACKUP_POLICY",
              "AwsManaged": false
          },
           "Content": "{\"plans\":{\"TestBackupPlan\":{\"regions\":{\"@@assign\":   ....TRUNCATED FOR BREVITY....   "@@assign\":[\"Yes\"]}}}}}}}"
  }
  ```
+ AWS SDKs: [UpdatePolicy](https://docs.aws.amazon.com/organizations/latest/APIReference/API_UpdatePolicy.html)

------

## Update a tag policy
<a name="update-tag-policy-procedure"></a>

**Minimum permissions**  
To update a tag policy, you must have permission to run the following actions:  
`organizations:UpdatePolicy` with a `Resource` element in the same policy statement that includes the ARN of the specified policy (or "\$1")
`organizations:DescribePolicy` with a `Resource` element in the same policy statement that includes the ARN of the specified policy (or "\$1")

------
#### [ AWS Management Console ]

**To update a tag policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the ****[Tag policies](https://console.aws.amazon.com/organizations/v2/home/policies/tag-policy)** page** page, choose the tag policy that you want to update.

1. Choose **Edit policy**.

1. You can enter a new **Policy name**, **Policy description**. You can change the policy content by using either the **Visual editor** or by editing the **JSON**. 

1. When you're finished updating the tag policy, choose **Save changes**.

------
#### [ AWS CLI & AWS SDKs ]

**To update a policy**  
You can use one of the following to update a policy: 
+ AWS CLI: [update-policy](https://docs.aws.amazon.com/cli/latest/reference/organizations/update-policy.html)

  The following example renames a tag policy.

  ```
  $ aws organizations update-policy \
      --policy-id p-i9j8k7l6m5 \
      --name "Renamed tag policy"
  {
      "Policy": {
          "PolicySummary": {
              "Id": "p-i9j8k7l6m5",
              "Arn": "arn:aws:organizations::123456789012:policy/o-aa111bb222/tag_policy/p-i9j8k7l6m5",
              "Name": "Renamed tag policy",
              "Type": "TAG_POLICY",
              "AwsManaged": false
          },
          "Content": "{\n\"tags\":{\n\"CostCenter\":{\n\"tag_key\":{\n\"@@assign\":\"CostCenter\"\n}\n}\n}\n}\n\n"
      }
  }
  ```

  The following example adds or changes the description for a tag policy.

  ```
  $ aws organizations update-policy \
      --policy-id p-i9j8k7l6m5 \
      --description "My new tag policy description"
  {
      "Policy": {
          "PolicySummary": {
              "Id": "p-i9j8k7l6m5",
              "Arn": "arn:aws:organizations::123456789012:policy/o-aa111bb222/tag_policy/p-i9j8k7l6m5",
              "Name": "Renamed tag policy",
              "Description": "My new tag policy description",
              "Type": "TAG_POLICY",
              "AwsManaged": false
          },
         "Content": "{\n\"tags\":{\n\"CostCenter\":{\n\"tag_key\":{\n\"@@assign\":\"CostCenter\"\n}\n}\n}\n}\n\n"
      }
  }
  ```

  The following example changes the JSON policy document attached to an AI services opt-out policy. In this example, the content is taken from a file called `policy.json` with the following text:

  ```
  {
    "tags": {
      "Stage": {
        "tag_key": {
          "@@assign": "Stage"
        },
        "tag_value": {
          "@@assign": [
            "Production",
            "Test"
          ]
        }
      }
    }
  }
  ```

  ```
  $ aws organizations update-policy \
      --policy-id p-i9j8k7l6m5 \
      --content file://policy.json
  {
      "Policy": {
          "PolicySummary": {
              "Id": "p-i9j8k7l6m5",
              "Arn": "arn:aws:organizations::123456789012:policy/o-aa111bb222/tag_policy/p-i9j8k7l6m5",
              "Name": "Renamed tag policy",
              "Description": "My new tag policy description",
              "Type": "TAG_POLICY",
              "AwsManaged": false
          },
           "Content": "{\"tags\":{\"Stage\":{\"tag_key\":{\"@@assign\":\"Stage\"},\"tag_value\":{\"@@assign\":[\"Production\",\"Test\"]},\"enforced_for\":{\"@@assign\":[\"ec2:instance\"]}}}}"
  }
  ```
+ AWS SDKs: [UpdatePolicy](https://docs.aws.amazon.com/organizations/latest/APIReference/API_UpdatePolicy.html)

------

## Update a chat applications policy
<a name="update-chatbot-policy-procedure"></a>

**Minimum permissions**  
To update a chat applications policy, you must have permission to run the following actions:  
`organizations:UpdatePolicy` with a `Resource` element in the same policy statement that includes the ARN of the specified policy (or "\$1")
`organizations:DescribePolicy` with a `Resource` element in the same policy statement that includes the ARN of the specified policy (or "\$1")

------
#### [ AWS Management Console ]

**To update a chat applications policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the ****[Chatbot policies](https://console.aws.amazon.com/organizations/v2/home/policies/chatbot-policy)** page** page, choose the chat applications policy that you want to update.

1. Choose **Edit policy**.

1. You can enter a new **Policy name**, **Policy description**. You can change the policy content by using either the **Visual editor** or by editing the **JSON**. 

1. When you're finished updating the tag policy, choose **Save changes**.

------
#### [ AWS CLI & AWS SDKs ]

**To update a policy**  
You can use one of the following to update a policy: 
+ AWS CLI: [update-policy](https://docs.aws.amazon.com/cli/latest/reference/organizations/update-policy.html)

  The following example renames a chat applications policy.

  ```
  $ aws organizations update-policy \
      --policy-id p-i9j8k7l6m5 \
      --name "Renamed chat applications policy"
  {
      "Policy": {
          "PolicySummary": {
              "Id": "p-i9j8k7l6m5",
              "Arn": "arn:aws:organizations::123456789012:policy/o-aa111bb222/chatbot_policy/p-i9j8k7l6m5",
              "Name": "Renamed chat applications policy",
              "Type": "CHATBOT_POLICY",
              "AwsManaged": false
          },
          "Content": "{"chatbot":{"platforms":{"slack":{"client":{"@@assign":"enabled"},"workspaces":{"@@assign":["Slack-Workspace-Id"]},"default":{"supported_channel_types":{"@@assign":["private"]}}},"microsoft_teams":{"client":{"@@assign":"disabled"}}}}}"
      }
  }
  ```
+ AWS SDKs: [UpdatePolicy](https://docs.aws.amazon.com/organizations/latest/APIReference/API_UpdatePolicy.html)

------

## Update an AI services opt-out policy
<a name="update-ai-opt-out-policy-procedure"></a>

**Minimum permissions**  
To update an AI services opt-out policy, you must have permission to run the following actions:  
`organizations:UpdatePolicy` with a `Resource` element in the same policy statement that includes the ARN of the specified policy (or "\$1")
`organizations:DescribePolicy` with a `Resource` element in the same policy statement that includes the Amazon Resource Name (ARN) of the specified policy (or "\$1")

------
#### [ AWS Management Console ]

**To update an AI services opt-out policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[AI services opt-out policies](https://console.aws.amazon.com/organizations/v2/home/policies/aiservices-opt-out-policy)** page, choose the name of the policy that you want to update.

1. On the policy's detail page, choose **Edit policy**.

1. You can enter a new **Policy name**, **Policy description**, or edit the **JSON** policy text. For information about AI services opt-out policy syntax, see [AI services opt-out policy syntax and examples](orgs_manage_policies_ai-opt-out_syntax.md). For example policies that you can use as a starting point, see [AI services opt-out policy examples](orgs_manage_policies_ai-opt-out_syntax.md#ai-opt-out-policy-examples).

1. When you're finished updating the policy, choose **Save changes**.

------
#### [ AWS CLI & AWS SDKs ]

**To update a policy**  
You can use one of the following to update a policy: 
+ AWS CLI: [update-policy](https://docs.aws.amazon.com/cli/latest/reference/organizations/update-policy.html)

  The following example renames an AI services opt-out policy.

  ```
  $ aws organizations update-policy \
      --policy-id p-i9j8k7l6m5 \
      --name "Renamed policy"
  {
      "Policy": {
          "PolicySummary": {
              "Id": "p-i9j8k7l6m5",
              "Arn": "arn:aws:organizations::123456789012:policy/o-aa111bb222/aiservices_opt_out_policy/p-i9j8k7l6m5",
              "Name": "Renamed policy",
              "Type": "AISERVICES_OPT_OUT_POLICY",
              "AwsManaged": false
          },
          "Content": "{\"services\":{\"default\":{\"opt_out_policy\":   ....TRUNCATED FOR BREVITY...   :{\"@@assign\":\"optIn\"}}}}"
      }
  }
  ```

  The following example adds or changes the description for an AI services opt-out policy.

  ```
  $ aws organizations update-policy \
      --policy-id p-i9j8k7l6m5 \
      --description "My new description"
  {
      "Policy": {
          "PolicySummary": {
              "Id": "p-i9j8k7l6m5",
              "Arn": "arn:aws:organizations::123456789012:policy/o-aa111bb222/aiservices_opt_out_policy/p-i9j8k7l6m5",
              "Name": "Renamed policy",
              "Description": "My new description",
              "Type": "AISERVICES_OPT_OUT_POLICY",
              "AwsManaged": false
          },
          "Content": "{\"services\":{\"default\":{\"opt_out_policy\":   ....TRUNCATED FOR BREVITY...   :{\"@@assign\":\"optIn\"}}}}"
      }
  }
  ```

  The following example changes the JSON policy document attached to an AI services opt-out policy. In this example, the content is taken from a file called `policy.json` with the following text:

  ```
  {
      "services": {
          "default": {
              "opt_out_policy": {
                  "@@assign": "optOut"
              }
          },
          "comprehend": {
              "opt_out_policy": {
                  "@@operators_allowed_for_child_policies": ["@@none"],
                  "@@assign": "optOut"
              }
          },
          "rekognition": {
              "opt_out_policy": {
                  "@@assign": "optIn"
              }
          }
      }
  }
  ```

  ```
  $ aws organizations update-policy \
      --policy-id p-i9j8k7l6m5 \
      --content file://policy.json
  {
      "Policy": {
          "PolicySummary": {
              "Id": "p-i9j8k7l6m5",
              "Arn": "arn:aws:organizations::123456789012:policy/o-aa111bb222/aiservices_opt_out_policy/p-i9j8k7l6m5",
              "Name": "Renamed policy",
              "Description": "My new description",
              "Type": "AISERVICES_OPT_OUT_POLICY",
              "AwsManaged": false
          },
           "Content": "{\n\"services\": {\n\"default\": {\n\"   ....TRUNCATED FOR BREVITY....    ": \"optIn\"\n}\n}\n}\n}\n"}
  }
  ```
+ AWS SDKs: [UpdatePolicy](https://docs.aws.amazon.com/organizations/latest/APIReference/API_UpdatePolicy.html)

------

## Update a Security Hub policy
<a name="update-security-hub-policy-procedure"></a>

**Minimum permissions**  
To update a Security Hub policy, you must have permission to run the following actions:  
`organizations:UpdatePolicy` with a `Resource` element in the same policy statement that includes the ARN of the specified policy (or "\$1")
`organizations:DescribePolicy` with a `Resource` element in the same policy statement that includes the Amazon Resource Name (ARN) of the specified policy (or "\$1")

------
#### [ AWS Management Console ]

**To update a Security Hub policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[Security Hub policies](https://console.aws.amazon.com/organizations/v2/home/policies/securityhub-policy)** page, choose the name of the policy that you want to update.

1. On the policy's detail page, choose **Edit policy**.

1. You can enter a new **Policy name**, **Policy description**, or edit the **JSON** policy text. For information about Security Hub policy syntax, see [Security Hub policy syntax and examples](orgs_manage_policies_security_hub_syntax.md). For example policies that you can use as a starting point, see [Security Hub policy examples](orgs_manage_policies_security_hub_syntax.md#security-hub-policy-examples).

1. When you're finished updating the policy, choose **Save changes**.

------
#### [ AWS CLI & AWS SDKs ]

**To update a policy**  
You can use one of the following to update a policy: 
+ AWS CLI: [update-policy](https://docs.aws.amazon.com/cli/latest/reference/organizations/update-policy.html)

  The following example renames a Security Hub policy.

  ```
  $ aws organizations update-policy \
      --policy-id p-66ev7hgcvj \
      --name "Renamed policy"
  {
      "Policy": {
          "PolicySummary": {
              "Id": "p-66ev7hgcvj",
              "Arn": "arn:aws:organizations::123456789012:policy/o-aa111bb222/securityhub_policy/p-66ev7hgcvj",
              "Name": "Renamed policy",
              "Type": "SECURITYHUB_POLICY",
              "AwsManaged": false
          },
          "Content": "{\n  \"securityhub\": {\n    \"enable_in_regions\": {\n      \"@@assign\":[\n        \"ALL_SUPPORTED\"\n      ]\n    },\n    \"disable_in_regions\": {\n      \"@@assign\":[]\n    }\n  }\n}\n"
      }
  }
  ```

  The following example adds or changes the description for a Security Hub policy.

  ```
  $ aws organizations update-policy \
      --policy-id p-66ev7hgcvj \
      --name "My new description"
  {
      "Policy": {
          "PolicySummary": {
              "Id": "p-66ev7hgcvj",
              "Arn": "arn:aws:organizations::123456789012:policy/o-aa111bb222/securityhub_policy/p-66ev7hgcvj",
              "Name": "My new description",
              "Type": "SECURITYHUB_POLICY",
              "AwsManaged": false
          },
          "Content": "{\n  \"securityhub\": {\n    \"enable_in_regions\": {\n      \"@@assign\":[\n        \"ALL_SUPPORTED\"\n      ]\n    },\n    \"disable_in_regions\": {\n      \"@@assign\":[]\n    }\n  }\n}\n"
      }
  }
  ```
+ AWS SDKs: [UpdatePolicy](https://docs.aws.amazon.com/organizations/latest/APIReference/API_UpdatePolicy.html)

------

# Editing tags attached to organization policies with AWS Organizations
<a name="orgs_policies_edit"></a>

This topic describes how to edit tags attached policies with AWS Organizations. A *policy* defines the controls that you want to apply to a group of AWS accounts.

**Topics**
+ [Edit tags attached to a service control policy (SCP)](#tag_policy_scp)
+ [Edit tags attached to a resource control policy (RCP)](#tag_policy_rcp)
+ [Edit tags attached to an declarative policy](#tag-declarative-policy-procedure)
+ [Edit tags attached to a backup policy](#tag-backup-policy-procedure)
+ [Edit tags attached to a tag policy](#tag_tag-policies)
+ [Edit tags attached to a chat applications policy](#tag_chatbot-policies)
+ [Edit tags attached to an AI services opt-out policy](#tag-ai-opt-out-policy-procedure)
+ [Edit tags attached to a Security Hub policy](#tag-security-hub-policy-procedure)

## Edit tags attached to a service control policy (SCP)
<a name="tag_policy_scp"></a>

When you sign in to your organization's management account, you can add or remove the tags attached to an SCP. For more information about tagging, see [Tagging AWS Organizations resourcesConsiderations](orgs_tagging.md). 

**Minimum permissions**  
To edit the tags attached to an SCP in your organization, you must have the following permissions:  
`organizations:DescribeOrganization` – required only when using the Organizations console
`organizations:DescribePolicy` – required only when using the Organizations console
`organizations:TagResource`
`organizations:UntagResource`

------
#### [ AWS Management Console ]

**To edit the tags attached to an SCP**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[Service control policies](https://console.aws.amazon.com/organizations/v2/home/policies/service-control-policy)** page choose the name of the policy with the tags that you want to edit.

1. On the policy details page, choose the **Tags** tab, and then choose**Manage tags**.

1. Make any or all of the following changes:
   + Change the value of a tag by entering a new value over the old one. You can't directly modify the tag key. To change a key, you must delete the tag with the old key and then add a tag with the new key. 
   + Remove an existing tag by choosing **Remove**.
   + Add a new tag key and value pair. Choose **Add tag**, then enter the new key name and optional value in the provided boxes. If you leave the **Value** box empty, the value is an empty string; it isn't `null`.

1. When you're finished, choose **Save changes**.

------
#### [ AWS CLI & AWS SDKs ]

**To edit the tags attached to an SCP**  
You can use one of the following commands to edit the tags attached to an SCP:
+ AWS CLI: [tag-resource](https://docs.aws.amazon.com/cli/latest/reference/organizations/tag-resource.html) and [untag-resource](https://docs.aws.amazon.com/cli/latest/reference/organizations/untag-resource.html)
+ AWS SDKs: [TagResource](https://docs.aws.amazon.com/organizations/latest/APIReference/API_TagResource.html) and [UntagResource](https://docs.aws.amazon.com/organizations/latest/APIReference/API_UntagResource.html)

------

## Edit tags attached to a resource control policy (RCP)
<a name="tag_policy_rcp"></a>

When you sign in to your organization's management account, you can add or remove the tags attached to an RCP. For more information about tagging, see [Tagging AWS Organizations resourcesConsiderations](orgs_tagging.md). 

**Minimum permissions**  
To edit the tags attached to an RCP in your AWS organization, you must have the following permissions:  
`organizations:DescribeOrganization` – required only when using the Organizations console
`organizations:DescribePolicy` – required only when using the Organizations console
`organizations:TagResource`
`organizations:UntagResource`

------
#### [ AWS Management Console ]

**To edit the tags attached to an RCP**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **Resource control policy** page, choose the name of the policy with the tags that you want to edit.

1. On the policy details page, choose the **Tags** tab, and then choose **Manage tags**.

1. Make any or all of the following changes:
   + Change the value of a tag by entering a new value over the old one. You can't directly modify the tag key. To change a key, you must delete the tag with the old key and then add a tag with the new key. 
   + Remove an existing tag by choosing **Remove**.
   + Add a new tag key and value pair. Choose **Add tag**, then enter the new key name and optional value in the provided boxes. If you leave the **Value** box empty, the value is an empty string; it isn't `null`.

1. When you're finished, choose **Save changes**.

------
#### [ AWS CLI & AWS SDKs ]

**To edit the tags attached to an RCP**  
You can use one of the following commands to edit the tags attached to an RCP:
+ AWS CLI: [tag-resource](https://docs.aws.amazon.com/cli/latest/reference/organizations/tag-resource.html) and [untag-resource](https://docs.aws.amazon.com/cli/latest/reference/organizations/untag-resource.html)
+ AWS SDKs: [TagResource](https://docs.aws.amazon.com/organizations/latest/APIReference/API_TagResource.html) and [UntagResource](https://docs.aws.amazon.com/organizations/latest/APIReference/API_UntagResource.html)

------

## Edit tags attached to an declarative policy
<a name="tag-declarative-policy-procedure"></a>

When you sign in to your organization's management account, you can add or remove the tags attached to a declarative policy. For more information about tagging, see [Tagging AWS Organizations resourcesConsiderations](orgs_tagging.md).

**Minimum permissions**  
To edit the tags attached to a declarative policy in your AWS organization, you must have the following permissions:  
`organizations:DescribeOrganization`– required only when using the Organizations console
`organizations:DescribePolicy`– required only when using the Organizations console
`organizations:TagResource`
`organizations:UntagResource`

------
#### [ AWS Management Console ]

**To edit the tags attached to a declarative policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the ** [Declarative policies](https://console.aws.amazon.com/organizations/v2/home/policies/declarative-policy-ec2)** page, choose the name of the policy with the tags that you want to edit.

1. On the chosen policy's detail page, choose the **Tags** tab, and then choose **Manage tags**.

1. You can perform any of these actions on this page:
   + Edit the value for any tag by entering a new value over the old one. You can't modify the key. To change a key, you must delete the tag with the old key and add a tag with the new key. 
   + Remove an existing tag by choosing **Remove**.
   + Add a new tag key and value pair. Choose **Add tag**, then enter the new key name and optional value in the provided boxes. If you leave the **Value** box empty, the value is an empty string; it isn't `null`.

1. Choose **Save changes** after you've made all the additions, removals, and edits you want to make.

------
#### [ AWS CLI & AWS SDKs ]

**To edit the tags attached to a declarative policy**  
You can use one of the following commands to edit the tags attached to a declarative policy:
+ AWS CLI: [tag-resource](https://docs.aws.amazon.com/cli/latest/reference/organizations/tag-resource.html) and [untag-resource](https://docs.aws.amazon.com/cli/latest/reference/organizations/untag-resource.html)
+ AWS SDKs: [TagResource](https://docs.aws.amazon.com/organizations/latest/APIReference/API_TagResource.html) and [UntagResource](https://docs.aws.amazon.com/organizations/latest/APIReference/API_UntagResource.html)

------

## Edit tags attached to a backup policy
<a name="tag-backup-policy-procedure"></a>

When you sign in to your organization's management account, you can add or remove the tags attached to a backup policy. For more information about tagging, see [Tagging AWS Organizations resourcesConsiderations](orgs_tagging.md).

**Minimum permissions**  
To edit the tags attached to a backup policy in your organization, you must have the following permissions:  
`organizations:DescribeOrganization` (console only – to navigate to the policy)
`organizations:DescribePolicy` (console only – to navigate to the policy)
`organizations:TagResource`
`organizations:UntagResource`

------
#### [ AWS Management Console ]

**To edit the tags attached to an backup policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. **[Backup policies](https://console.aws.amazon.com/organizations/v2/home/policies/backup-policy)** page

1. Choose the name of the policy with the tags that you want to edit.

   The policy detail page appears.

1. On the **Tags** tab, choose **Manage tags**.

1. You can perform any of these actions on this page:
   + Edit the value for any tag by entering a new value over the old one. You can't modify the key. To change a key, you must delete the tag with the old key and add a tag with the new key. 
   + Remove an existing tag by choosing **Remove**.
   + Add a new tag key and value pair. Choose **Add tag**, then enter the new key name and optional value in the provided boxes. If you leave the **Value** box empty, the value is an empty string; it isn't `null`.

1. Choose **Save changes** after you've made all the additions, removals, and edits you want to make.

------
#### [ AWS CLI & AWS SDKs ]

**To edit the tags attached to a backup policy**  
You can use one of the following commands to edit the tags attached to a backup policy:
+ AWS CLI: [tag-resource](https://docs.aws.amazon.com/cli/latest/reference/organizations/tag-resource.html) and [untag-resource](https://docs.aws.amazon.com/cli/latest/reference/organizations/untag-resource.html)
+ AWS SDKs: [TagResource](https://docs.aws.amazon.com/organizations/latest/APIReference/API_TagResource.html) and [UntagResource](https://docs.aws.amazon.com/organizations/latest/APIReference/API_UntagResource.html)

------

## Edit tags attached to a tag policy
<a name="tag_tag-policies"></a>

When you sign in to your organization's management account, you can add or remove the tags attached to a tag policy. To do this, complete the following steps.

**Minimum permissions**  
To edit the tags attached to a tag policy in your organization, you must have the following permissions:  
`organizations:DescribeOrganization` (console only – to navigate to the policy)
`organizations:DescribePolicy` (console only – to navigate to the policy)
`organizations:TagResource`
`organizations:UntagResource`

------
#### [ AWS Management Console ]

**To edit the tags attached to a tag policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the ****[Tag policies](https://console.aws.amazon.com/organizations/v2/home/policies/tag-policy)** page** page, choose the name of the policy with the tags that you want to edit.

1. On the chosen policy's detail page, choose the **Tags** tab, and then choose **Manage tags**.

1. You can perform any of these actions on this page:
   + Edit the value for any tag by entering a new value over the old one. You can't modify the key. To change a key, you must delete the tag with the old key and add a tag with the new key. 
   + Remove an existing tag by choosing **Remove**.
   + Add a new tag key and value pair. Choose **Add tag**, then enter the new key name and optional value in the provided boxes. If you leave the **Value** box empty, the value is an empty string; it isn't `null`.

1. Choose **Save changes** after you've made all the additions, removals, and edits you want to make.

------
#### [ AWS CLI & AWS SDKs ]

**To edit the tags attached to a tag policy**  
You can use one of the following commands to edit the tags attached to a tag policy:
+ AWS CLI: [tag-resource](https://docs.aws.amazon.com/cli/latest/reference/organizations/tag-resource.html) and [untag-resource](https://docs.aws.amazon.com/cli/latest/reference/organizations/untag-resource.html)
+ AWS SDKs: [TagResource](https://docs.aws.amazon.com/organizations/latest/APIReference/API_TagResource.html) and [UntagResource](https://docs.aws.amazon.com/organizations/latest/APIReference/API_UntagResource.html)

------

## Edit tags attached to a chat applications policy
<a name="tag_chatbot-policies"></a>

When you sign in to your organization's management account, you can add or remove the tags attached to a chat applications policy. To do this, complete the following steps.

**Minimum permissions**  
To edit the tags attached to a chat applications policy in your organization, you must have the following permissions:  
`organizations:DescribeOrganization` (console only – to navigate to the policy)
`organizations:DescribePolicy` (console only – to navigate to the policy)
`organizations:TagResource`
`organizations:UntagResource`

------
#### [ AWS Management Console ]

**To edit the tags attached to an chat applications policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the ****[Chatbot policies](https://console.aws.amazon.com/organizations/v2/home/policies/chatbot-policy)** page** page, choose the name of the policy with the tags that you want to edit.

1. On the chosen policy's detail page, choose the **Tags** tab, and then choose **Manage tags**.

1. You can perform any of these actions on this page:
   + Edit the value for any tag by entering a new value over the old one. You can't modify the key. To change a key, you must delete the tag with the old key and add a tag with the new key. 
   + Remove an existing tag by choosing **Remove**.
   + Add a new tag key and value pair. Choose **Add tag**, then enter the new key name and optional value in the provided boxes. If you leave the **Value** box empty, the value is an empty string; it isn't `null`.

1. Choose **Save changes** after you've made all the additions, removals, and edits you want to make.

------
#### [ AWS CLI & AWS SDKs ]

**To edit the tags attached to a chat applications policy**  
You can use one of the following commands to edit the tags attached to a chat applications policy:
+ AWS CLI: [tag-resource](https://docs.aws.amazon.com/cli/latest/reference/organizations/tag-resource.html) and [untag-resource](https://docs.aws.amazon.com/cli/latest/reference/organizations/untag-resource.html)
+ AWS SDKs: [TagResource](https://docs.aws.amazon.com/organizations/latest/APIReference/API_TagResource.html) and [UntagResource](https://docs.aws.amazon.com/organizations/latest/APIReference/API_UntagResource.html)

------

## Edit tags attached to an AI services opt-out policy
<a name="tag-ai-opt-out-policy-procedure"></a>

When you sign in to your organization's management account, you can add or remove the tags attached to an AI services opt-out policy. For more information about tagging, see [Tagging AWS Organizations resourcesConsiderations](orgs_tagging.md).

**Minimum permissions**  
To edit the tags attached to an AI services opt-out policy in your organization, you must have the following permissions:  
`organizations:DescribeOrganization`– required only when using the Organizations console
`organizations:DescribePolicy`– required only when using the Organizations console
`organizations:TagResource`
`organizations:UntagResource`

------
#### [ AWS Management Console ]

**To edit the tags attached to an AI services opt-out policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[AI services opt-out policies](https://console.aws.amazon.com/organizations/v2/home/policies/aiservices-opt-out-policy)** page, choose the name of the policy with the tags that you want to edit.

1. On the chosen policy's detail page, choose the **Tags** tab, and then choose **Manage tags**.

1. You can perform any of these actions on this page:
   + Edit the value for any tag by entering a new value over the old one. You can't modify the key. To change a key, you must delete the tag with the old key and add a tag with the new key. 
   + Remove an existing tag by choosing **Remove**.
   + Add a new tag key and value pair. Choose **Add tag**, then enter the new key name and optional value in the provided boxes. If you leave the **Value** box empty, the value is an empty string; it isn't `null`.

1. Choose **Save changes** after you've made all the additions, removals, and edits you want to make.

------
#### [ AWS CLI & AWS SDKs ]

**To edit the tags attached to a AI services opt-out policy**  
You can use one of the following commands to edit the tags attached to a AI services opt-out policy:
+ AWS CLI: [tag-resource](https://docs.aws.amazon.com/cli/latest/reference/organizations/tag-resource.html) and [untag-resource](https://docs.aws.amazon.com/cli/latest/reference/organizations/untag-resource.html)
+ AWS SDKs: [TagResource](https://docs.aws.amazon.com/organizations/latest/APIReference/API_TagResource.html) and [UntagResource](https://docs.aws.amazon.com/organizations/latest/APIReference/API_UntagResource.html)

------

## Edit tags attached to a Security Hub policy
<a name="tag-security-hub-policy-procedure"></a>

When you sign in to your organization's management account, you can add or remove the tags attached to a Security Hub policy. For more information about tagging, see [Tagging AWS Organizations resourcesConsiderations](orgs_tagging.md).

**Minimum permissions**  
To edit the tags attached to a Security Hub policy in your organization, you must have the following permissions:  
`organizations:DescribeOrganization`– required only when using the Organizations console
`organizations:DescribePolicy`– required only when using the Organizations console
`organizations:TagResource`
`organizations:UntagResource`

------
#### [ AWS Management Console ]

**To edit the tags attached to a Security Hub policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[Security Hub policies](https://console.aws.amazon.com/organizations/v2/home/policies/securityhub-policy)** page, choose the name of the policy with the tags that you want to edit.

1. On the chosen policy's detail page, choose the **Tags** tab, and then choose **Manage tags**.

1. You can perform any of these actions on this page:
   + Edit the value for any tag by entering a new value over the old one. You can't modify the key. To change a key, you must delete the tag with the old key and add a tag with the new key. 
   + Remove an existing tag by choosing **Remove**.
   + Add a new tag key and value pair. Choose **Add tag**, then enter the new key name and optional value in the provided boxes. If you leave the **Value** box empty, the value is an empty string; it isn't `null`.

1. Choose **Save changes** after you've made all the additions, removals, and edits you want to make.

------
#### [ AWS CLI & AWS SDKs ]

**To edit the tags attached to a Security Hub policy**  
You can use one of the following commands to edit the tags attached to a Security Hub policy:
+ AWS CLI: [tag-resource](https://docs.aws.amazon.com/cli/latest/reference/organizations/tag-resource.html) and [untag-resource](https://docs.aws.amazon.com/cli/latest/reference/organizations/untag-resource.html)
+ AWS SDKs: [TagResource](https://docs.aws.amazon.com/organizations/latest/APIReference/API_TagResource.html) and [UntagResource](https://docs.aws.amazon.com/organizations/latest/APIReference/API_UntagResource.html)

------

# Attaching organization policies with AWS Organizations
<a name="orgs_policies_attach"></a>

This topic describes how to attach policies with AWS Organizations. A *policy* defines the controls that you want to apply to a group of AWS accounts.

**Topics**
+ [Attach policies](#attach_policy)

## Attach policies with AWS Organizations
<a name="attach_policy"></a>

**Minimum permissions**  
To attach policies, you must have permission to run the following action:  
`organizations:AttachPolicy`

**Minimum permissions**  
To attach an authorization policy (SCP or RCP) to a root, OU, or account, you need permission to run the following action:  
`organizations:AttachPolicy` with a `Resource` element in the same policy statement that includes "\$1" or the Amazon Resource Name (ARN) of the specified policy and the ARN of the root, OU, or account that you want to attach the policy to

### AWS Management Console
<a name="attach_policy_console"></a>

------
#### [ Service control policies (SCPs) ]

You can attach an SCP by either navigating to the policy or to the root, OU, or account that you want to attach the policy to.

**To attach an SCP by navigating to the root, OU, or account**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[AWS accounts](https://console.aws.amazon.com/organizations/v2/home/accounts)** page, navigate to and then choose the check box next to the root, OU, or account that you want to attach an SCP to. You might have to expand OUs (choose the ![\[Gray cloud icon representing cloud computing or storage services.\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/console-expand.png)) to find the OU or account that you want.

1. In the **Policies** tab, in the entry for **Service control policies**, choose **Attach**.

1. Find the policy that you want and choose **Attach policy**.

   The list of attached SCPs on the **Policies** tab is updated to include the new addition. The policy change takes effect immediately, affecting the permissions of IAM users and roles in the attached account or all accounts under the attached root or OU.

**To attach an SCP by navigating to the policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[Service control policies](https://console.aws.amazon.com/organizations/v2/home/policies/service-control-policy)** page, choose the name of the policy that you want to attach.

1. On the **Targets** tab, choose **Attach**.

1. Choose the radio button next to the root, OU, or account that you want to attach the policy to. You might have to expand OUs (choose the ![\[Gray cloud icon representing cloud computing or storage services.\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/console-expand.png)) to find the OU or account that you want.

1. Choose **Attach policy**.

   The list of attached SCPs on the **Targets** tab is updated to include the new addition. The policy change takes effect immediately, affecting the permissions of IAM users and roles in the attached account or all accounts under the attached root or OU.

------
#### [ Resource control policies (RCPs) ]

You can attach an RCP by either navigating to the policy or to the root, OU, or account that you want to attach the policy to.

**To attach an RCP by navigating to the root, OU, or account**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[AWS accounts](https://console.aws.amazon.com/organizations/v2/home/accounts)** page, navigate to and then choose the check box next to the root, OU, or account that you want to attach an RCP to. You might have to expand OUs (choose the ![\[Gray cloud icon representing cloud computing or storage services.\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/console-expand.png)) to find the OU or account that you want.

1. In the **Policies** tab, in the entry for **Resource control policies**, choose **Attach**.

1. Find the policy that you want and choose **Attach policy**.

   The list of attached RCPs on the **Policies** tab is updated to include the new addition. The policy change takes effect immediately, affecting the permissions of resources in the attached account or all accounts under the attached root or OU.

**To attach an RCP by navigating to the policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **Resource control policy** page, choose the name of the policy that you want to attach.

1. On the **Targets** tab, choose **Attach**.

1. Choose the radio button next to the root, OU, or account that you want to attach the policy to. You might have to expand OUs (choose the ![\[Gray cloud icon representing cloud computing or storage services.\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/console-expand.png)) to find the OU or account that you want.

1. Choose **Attach policy**.

   The list of attached RCPs on the **Targets** tab is updated to include the new addition. The policy change takes effect immediately, affecting the permissions of resources in the attached account or all accounts under the attached root or OU.

------
#### [ Declarative policies ]

You can attach a declarative policy by either navigating to the policy or to the root, OU, or account that you want to attach the policy to.

**To attach a declarative policy by navigating to the root, OU, or account**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[AWS accounts](https://console.aws.amazon.com/organizations/v2/home/accounts)** page, navigate to and then choose the name of the root, OU, or account that you want to attach a policy to. You might have to expand OUs (choose the ![\[Gray cloud icon representing cloud computing or storage services.\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/console-expand.png)) to find the OU or account that you want.

1. In the **Policies** tab, in the entry for **Declarative policies**, choose **Attach**.

1. Find the policy that you want and choose **Attach policy**.

   The list of attached declarative policies on the **Policies** tab is updated to include the new addition. The policy change takes effect immediately.

**To attach a declarative policy by navigating to the policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the ** [Declarative policies](https://console.aws.amazon.com/organizations/v2/home/policies/declarative-policy-ec2)** page, choose the name of the policy that you want to attach.

1. On the **Targets** tab, choose **Attach**.

1. Choose the radio button next to the root, OU, or account that you want to attach the policy to. You might have to expand OUs (choose the ![\[Gray cloud icon representing cloud computing or storage services.\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/console-expand.png)) to find the OU or account that you want.

1. Choose **Attach policy**.

   The list of attached declarative policies on the **Targets** tab is updated to include the new addition. The policy change takes effect immediately.

------
#### [ Backup policies ]

You can attach a backup policy by either navigating to the policy or to the root, OU, or account that you want to attach the policy to.

**To attach a backup policy by navigating to the root, OU, or account**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[AWS accounts](https://console.aws.amazon.com/organizations/v2/home/accounts)** page, navigate to and then choose the name of the root, OU, or account that you want to attach a policy to. You might have to expand OUs (choose the ![\[Gray cloud icon representing cloud computing or storage services.\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/console-expand.png)) to find the OU or account that you want.

1. In the **Policies** tab, in the entry for **Backup policies**, choose **Attach**.

1. Find the policy that you want and choose **Attach policy**.

   The list of attached backup policies on the **Policies** tab is updated to include the new addition. The policy change takes effect immediately.

**To attach a backup policy by navigating to the policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[Backup policies](https://console.aws.amazon.com/organizations/v2/home/policies/backup-policy)** page, choose the name of the policy that you want to attach.

1. On the **Targets** tab, choose **Attach**.

1. Choose the radio button next to the root, OU, or account that you want to attach the policy to. You might have to expand OUs (choose the ![\[Gray cloud icon representing cloud computing or storage services.\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/console-expand.png)) to find the OU or account that you want.

1. Choose **Attach policy**.

   The list of attached backup policies on the **Targets** tab is updated to include the new addition. The policy change takes effect immediately.

------
#### [ Tag policies ]

You can attach a tag policy by either navigating to the policy or to the root, OU, or account that you want to attach the policy to.

**To attach a tag policy by navigating to the root, OU, or account**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[AWS accounts](https://console.aws.amazon.com/organizations/v2/home/accounts)** page, navigate to and then choose the name of the root, OU, or account that you want to attach a policy to. You might have to expand OUs (choose the ![\[Gray cloud icon representing cloud computing or storage services.\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/console-expand.png)) to find the OU or account that you want.

1. In the **Policies** tab, in the entry for **Tag policies**, choose **Attach**.

1. Find the policy that you want and choose **Attach policy**.

   The list of attached tag policies on the **Policies** tab is updated to include the new addition. The policy change takes effect immediately.

**To attach a tag policy by navigating to the policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[Tag policies](https://console.aws.amazon.com/organizations/v2/home/policies/tag-policy)** page, choose the name of the policy that you want to attach.

1. On the **Targets** tab, choose **Attach**.

1. Choose the radio button next to the root, OU, or account that you want to attach the policy to. You might have to expand OUs (choose the ![\[Gray cloud icon representing cloud computing or storage services.\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/console-expand.png)) to find the OU or account that you want.

1. Choose **Attach policy**.

   The list of attached tag policies on the **Targets** tab is updated to include the new addition. The policy change takes effect immediately.

------
#### [ Chat applications policies ]

You can attach a chat applications policy by either navigating to the policy or to the root, OU, or account that you want to attach the policy to.

**To attach a chat applications policy by navigating to the root, OU, or account**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[AWS accounts](https://console.aws.amazon.com/organizations/v2/home/accounts)** page, navigate to and then choose the name of the root, OU, or account that you want to attach a policy to. You might have to expand OUs (choose the ![\[Gray cloud icon representing cloud computing or storage services.\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/console-expand.png)) to find the OU or account that you want.

1. In the **Policies** tab, in the entry for **Chat applications policies**, choose **Attach**.

1. Find the policy that you want and choose **Attach policy**.

   The list of attached chat applications policies on the **Policies** tab is updated to include the new addition. The policy change takes effect immediately.

**To attach a chat applications policy by navigating to the policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[Chatbot policies](https://console.aws.amazon.com/organizations/v2/home/policies/chatbot-policy)** page, choose the name of the policy that you want to attach.

1. On the **Targets** tab, choose **Attach**.

1. Choose the radio button next to the root, OU, or account that you want to attach the policy to. You might have to expand OUs (choose the ![\[Gray cloud icon representing cloud computing or storage services.\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/console-expand.png)) to find the OU or account that you want.

1. Choose **Attach policy**.

   The list of attached chat applications policies on the **Targets** tab is updated to include the new addition. The policy change takes effect immediately.

------
#### [ AI services opt-out policies ]

You can attach an AI services opt-out policy by either navigating to the policy or to the root, OU, or account that you want to attach the policy to.

**To attach an AI services opt-out policy by navigating to the root, OU, or account**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[AWS accounts](https://console.aws.amazon.com/organizations/v2/home/accounts)** page, navigate to and then choose the name of the root, OU, or account that you want to attach a policy to. You might have to expand OUs (choose the ![\[Gray cloud icon representing cloud computing or storage services.\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/console-expand.png)) to find the OU or account that you want.

1. In the **Policies** tab, in the entry for **AI service opt-out policies**, choose **Attach**.

1. Find the policy that you want and choose **Attach policy**.

   The list of attached AI services opt-out policies on the **Policies** tab is updated to include the new addition. The policy change takes effect immediately.

**To attach an AI services opt-out policy by navigating to the policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[AI services opt-out policies](https://console.aws.amazon.com/organizations/v2/home/policies/aiservices-opt-out-policy)** page, choose the name of the policy that you want to attach.

1. On the **Targets** tab, choose **Attach**.

1. Choose the radio button next to the root, OU, or account that you want to attach the policy to. You might have to expand OUs (choose the ![\[Gray cloud icon representing cloud computing or storage services.\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/console-expand.png)) to find the OU or account that you want.

1. Choose **Attach policy**.

   The list of attached AI services opt-out policies on the **Targets** tab is updated to include the new addition. The policy change takes effect immediately.

------
#### [ Security Hub policies ]

You can attach a Security Hub policy by either navigating to the policy or to the root, OU, or account that you want to attach the policy to.

**To attach a Security Hub policy by navigating to the root, OU, or account**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[AWS accounts](https://console.aws.amazon.com/organizations/v2/home/accounts)** page, navigate to and then choose the name of the root, OU, or account that you want to attach a policy to. You might have to expand OUs (choose the ![\[Gray cloud icon representing cloud computing or storage services.\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/console-expand.png)) to find the OU or account that you want.

1. In the **Policies** tab, in the entry for **Security Hub policies**, choose **Attach**.

1. Find the policy that you want and choose **Attach policy**.

   The list of attached Security Hub policies on the **Policies** tab is updated to include the new addition. The policy change takes effect immediately.

**To attach a Security Hub policy by navigating to the policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[Security Hub policies](https://console.aws.amazon.com/organizations/v2/home/policies/securityhub-policy)** page, choose the name of the policy that you want to attach.

1. On the **Targets** tab, choose **Attach**.

1. Choose the radio button next to the root, OU, or account that you want to attach the policy to. You might have to expand OUs (choose the ![\[Gray cloud icon representing cloud computing or storage services.\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/console-expand.png)) to find the OU or account that you want.

1. Choose **Attach policy**.

   The list of attached Security Hub policies on the **Targets** tab is updated to include the new addition. The policy change takes effect immediately.

------

### AWS CLI & AWS SDKs
<a name="attach_policy_cli_sdk"></a>

**To attach a policy**

The following code examples show how to use `AttachPolicy`.

------
#### [ .NET ]

**SDK for .NET**  
 There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/dotnetv3/Organizations#code-examples). 

```
    using System;
    using System.Threading.Tasks;
    using Amazon.Organizations;
    using Amazon.Organizations.Model;

    /// <summary>
    /// Shows how to attach an AWS Organizations policy to an organization,
    /// an organizational unit, or an account.
    /// </summary>
    public class AttachPolicy
    {
        /// <summary>
        /// Initializes the Organizations client object and then calls the
        /// AttachPolicyAsync method to attach the policy to the root
        /// organization.
        /// </summary>
        public static async Task Main()
        {
            IAmazonOrganizations client = new AmazonOrganizationsClient();
            var policyId = "p-00000000";
            var targetId = "r-0000";

            var request = new AttachPolicyRequest
            {
                PolicyId = policyId,
                TargetId = targetId,
            };

            var response = await client.AttachPolicyAsync(request);

            if (response.HttpStatusCode == System.Net.HttpStatusCode.OK)
            {
                Console.WriteLine($"Successfully attached Policy ID {policyId} to Target ID: {targetId}.");
            }
            else
            {
                Console.WriteLine("Was not successful in attaching the policy.");
            }
        }
    }
```
+  For API details, see [AttachPolicy](https://docs.aws.amazon.com/goto/DotNetSDKV3/organizations-2016-11-28/AttachPolicy) in *AWS SDK for .NET API Reference*. 

------
#### [ CLI ]

**AWS CLI**  
**To attach a policy to a root, OU, or account**  
**Example 1**  
The following example shows how to attach a service control policy (SCP) to an OU:  

```
aws organizations attach-policy
                --policy-id p-examplepolicyid111
                --target-id ou-examplerootid111-exampleouid111
```
**Example 2**  
The following example shows how to attach a service control policy directly to an account:  

```
aws organizations attach-policy
                --policy-id p-examplepolicyid111
                --target-id 333333333333
```
+  For API details, see [AttachPolicy](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/organizations/attach-policy.html) in *AWS CLI Command Reference*. 

------
#### [ Python ]

**SDK for Python (Boto3)**  
 There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/python/example_code/organizations#code-examples). 

```
def attach_policy(policy_id, target_id, orgs_client):
    """
    Attaches a policy to a target. The target is an organization root, account, or
    organizational unit.

    :param policy_id: The ID of the policy to attach.
    :param target_id: The ID of the resources to attach the policy to.
    :param orgs_client: The Boto3 Organizations client.
    """
    try:
        orgs_client.attach_policy(PolicyId=policy_id, TargetId=target_id)
        logger.info("Attached policy %s to target %s.", policy_id, target_id)
    except ClientError:
        logger.exception(
            "Couldn't attach policy %s to target %s.", policy_id, target_id
        )
        raise
```
+  For API details, see [AttachPolicy](https://docs.aws.amazon.com/goto/boto3/organizations-2016-11-28/AttachPolicy) in *AWS SDK for Python (Boto3) API Reference*. 

------
#### [ SAP ABAP ]

**SDK for SAP ABAP**  
 There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/sap-abap/services/org#code-examples). 

```
    TRY.
        lo_org->attachpolicy(
          iv_policyid = iv_policy_id
          iv_targetid = iv_target_id ).
        MESSAGE 'Policy attached to target.' TYPE 'I'.
      CATCH /aws1/cx_orgaccessdeniedex.
        MESSAGE 'You do not have permission to attach the policy.' TYPE 'E'.
      CATCH /aws1/cx_orgpolicynotfoundex.
        MESSAGE 'The specified policy does not exist.' TYPE 'E'.
      CATCH /aws1/cx_orgtargetnotfoundex.
        MESSAGE 'The specified target does not exist.' TYPE 'E'.
      CATCH /aws1/cx_orgduplicateplyatta00.
        MESSAGE 'The policy is already attached to the target.' TYPE 'E'.
    ENDTRY.
```
+  For API details, see [AttachPolicy](https://docs.aws.amazon.com/sdk-for-sap-abap/v1/api/latest/index.html) in *AWS SDK for SAP ABAP API reference*. 

------

The policy change takes effect immediately, affecting the permissions of IAM users and roles in the attached account or all accounts under the attached root or OU

# Detaching organization policies with AWS Organizations
<a name="orgs_policies_detach"></a>

This topic describes how to detach policies with AWS Organizations. A *policy* defines the controls that you want to apply to a group of AWS accounts.

**Topics**
+ [Detach policies](#detach_policy)

## Detach policies with AWS Organizations
<a name="detach_policy"></a>

**Minimum permissions**  
To detach a policy from the organization root, OU, or account, you must have permission to run the following action:  
`organizations:DetachPolicy`

**Note**  
You can't detach the last authorization policy (SCP or RCP) from a root, an OU, or an account. There must be at least one SCP and RCP attached to every root, OU, and account at all times.

### AWS Management Console
<a name="detach_policy_console"></a>

------
#### [ Service control policies (SCPs) ]

You can detach an SCP by either navigating to the policy or to the root, OU, or account that you want to detach the policy from.

**To detach an SCP by navigating to the root, OU, or account it's attached to**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[AWS accounts](https://console.aws.amazon.com/organizations/v2/home/accounts)** page navigate to the Root, OU, or account that you want to detach a policy from. You might have to expand OUs (choose the ![\[Gray cloud icon representing cloud computing or storage services.\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/console-expand.png)) to find the OU or account that you want. Choose the name of the Root, OU, or account.

1. On the **Policies** tab, choose the radio button next to the SCP that you want to detach, and then choose **Detach**. 

1. In the confirmation dialog box, choose **Detach policy**.

   The list of attached SCPs is updated. The policy change caused by detaching the SCP takes effect immediately. For example, detaching an SCP immediately affects the permissions of IAM users and roles in the formerly attached account or accounts under the formerly attached organization root or OU.

**To detach an SCP by navigating to the policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[Service control policies](https://console.aws.amazon.com/organizations/v2/home/policies/service-control-policy)** page, choose the name of the policy that you want to detach from a root, OU, or account.

1. On the **Targets** tab, choose the radio button next to the root, OU, or account that you want to detach the policy from. You might have to expand OUs (choose the ![\[Gray cloud icon representing cloud computing or storage services.\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/console-expand.png)) to find the OU or account that you want.

1. Choose **Detach**.

1. In the confirmation dialog box, choose **Detach**.

   The list of attached SCPs is updated. The policy change caused by detaching the SCP takes effect immediately. For example, detaching an SCP immediately affects the permissions of IAM users and roles in the formerly attached account or accounts under the formerly attached organization root or OU.

------
#### [ Resource control policies (RCPs) ]

You can detach an RCP by either navigating to the policy or to the root, OU, or account that you want to detach the policy from. After you detach an RCP from an entity, that RCP no longer applies to any resources that were affected by the now detached entity.

**Note**  
**You cannot detach the `RCPFullAWSAccess` policy**  
The `RCPFullAWSAccess` policy is automatically attached to the root, every OU, and every account in your organization. You cannot detach this policy.

**To detach an RCP by navigating to the root, OU, or account it's attached to**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[AWS accounts](https://console.aws.amazon.com/organizations/v2/home/accounts)** page navigate to the Root, OU, or account that you want to detach a policy from. You might have to expand OUs (choose the ![\[Gray cloud icon representing cloud computing or storage services.\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/console-expand.png)) to find the OU or account that you want. Choose the name of the Root, OU, or account.

1. On the **Policies** tab, choose the radio button next to the RCP that you want to detach, and then choose **Detach**. 

1. In the confirmation dialog box, choose **Detach policy**.

   The list of attached RCPs is updated. The policy change caused by detaching the RCP takes effect immediately. For example, detaching an RCP immediately affects the permissions of IAM users and roles in the formerly attached account or accounts under the formerly attached organization root or OU.

**To detach an RCP by navigating to the policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **Resource control policy** page, choose the name of the policy that you want to detach from a root, OU, or account.

1. On the **Targets** tab, choose the radio button next to the root, OU, or account that you want to detach the policy from. You might have to expand OUs (choose the ![\[Gray cloud icon representing cloud computing or storage services.\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/console-expand.png)) to find the OU or account that you want.

1. Choose **Detach**.

1. In the confirmation dialog box, choose **Detach**.

   The list of attached RCPs is updated. The policy change caused by detaching the RCP takes effect immediately. For example, detaching an RCP immediately affects the permissions of IAM users and roles in the formerly attached account or accounts under the formerly attached organization root or OU.

------
#### [ Declarative policies ]

You can detach a declarative policy by either navigating to the policy or to the root, OU, or account that you want to detach the policy from.

**To detach a declarative policy by navigating to the root, OU, or account it's attached to**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[AWS accounts](https://console.aws.amazon.com/organizations/v2/home/accounts)** page navigate to the Root, OU, or account that you want to detach a policy from. You might have to expand OUs (choose the ![\[Gray cloud icon representing cloud computing or storage services.\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/console-expand.png)) to find the OU or account that you want. Choose the name of the Root, OU, or account.

1. On the **Policies** tab, choose the radio button next to the declarative policy that you want to detach, and then choose **Detach**. 

1. In the confirmation dialog box, choose **Detach policy**.

   The list of attached declarative policies is updated. The policy change takes effect immediately.

**To detach a declarative policy by navigating to the policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the ** [Declarative policies](https://console.aws.amazon.com/organizations/v2/home/policies/declarative-policy-ec2)** page, choose the name of the policy that you want to detach from a root, OU, or account.

1. On the **Targets** tab, choose the radio button next to the root, OU, or account that you want to detach the policy from. You might have to expand OUs (choose the ![\[Gray cloud icon representing cloud computing or storage services.\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/console-expand.png)) to find the OU or account that you want.

1. Choose **Detach**.

1. In the confirmation dialog box, choose **Detach**.

   The list of attached declarative policies is updated. The policy change takes effect immediately.

------
#### [ Backup policies ]

You can detach a backup policy by either navigating to the policy or to the root, OU, or account that you want to detach the policy from.

**To detach a backup policy by navigating to the root, OU, or account it's attached to**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[AWS accounts](https://console.aws.amazon.com/organizations/v2/home/accounts)** page navigate to the Root, OU, or account that you want to detach a policy from. You might have to expand OUs (choose the ![\[Gray cloud icon representing cloud computing or storage services.\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/console-expand.png)) to find the OU or account that you want. Choose the name of the Root, OU, or account.

1. On the **Policies** tab, choose the radio button next to the backup policy that you want to detach, and then choose **Detach**. 

1. In the confirmation dialog box, choose **Detach policy**.

   The list of attached backup policies is updated. The policy change takes effect immediately.

**To detach a backup policy by navigating to the policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[Backup policies](https://console.aws.amazon.com/organizations/v2/home/policies/backup-policy)** page, choose the name of the policy that you want to detach from a root, OU, or account.

1. On the **Targets** tab, choose the radio button next to the root, OU, or account that you want to detach the policy from. You might have to expand OUs (choose the ![\[Gray cloud icon representing cloud computing or storage services.\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/console-expand.png)) to find the OU or account that you want.

1. Choose **Detach**.

1. In the confirmation dialog box, choose **Detach**.

   The list of attached backup policies is updated. The policy change takes effect immediately.

------
#### [ Tag policies ]

You can detach a tag policy by either navigating to the policy or to the root, OU, or account that you want to detach the policy from.

**To detach a tag policy by navigating to the root, OU, or account it's attached to**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[AWS accounts](https://console.aws.amazon.com/organizations/v2/home/accounts)** page navigate to the Root, OU, or account that you want to detach a policy from. You might have to expand OUs (choose the ![\[Gray cloud icon representing cloud computing or storage services.\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/console-expand.png)) to find the OU or account that you want. Choose the name of the Root, OU, or account.

1. On the **Policies** tab, choose the radio button next to the tag policy that you want to detach, and then choose **Detach**. 

1. In the confirmation dialog box, choose **Detach policy**.

   The list of attached tag policies is updated. The policy change takes effect immediately.

**To detach a tag policy by navigating to the policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[Tag policies](https://console.aws.amazon.com/organizations/v2/home/policies/tag-policy)** page, choose the name of the policy that you want to detach from a root, OU, or account.

1. On the **Targets** tab, choose the radio button next to the root, OU, or account that you want to detach the policy from. You might have to expand OUs (choose the ![\[Gray cloud icon representing cloud computing or storage services.\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/console-expand.png)) to find the OU or account that you want.

1. Choose **Detach**.

1. In the confirmation dialog box, choose **Detach**.

   The list of attached tag policies is updated. The policy change takes effect immediately.

------
#### [ Chat applications policies ]

You can detach a chat applications policy by either navigating to the policy or to the root, OU, or account that you want to detach the policy from.

**To detach a chat applications policy by navigating to the root, OU, or account it's attached to**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[AWS accounts](https://console.aws.amazon.com/organizations/v2/home/accounts)** page navigate to the Root, OU, or account that you want to detach a policy from. You might have to expand OUs (choose the ![\[Gray cloud icon representing cloud computing or storage services.\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/console-expand.png)) to find the OU or account that you want. Choose the name of the Root, OU, or account.

1. On the **Policies** tab, choose the radio button next to the chat applications policy that you want to detach, and then choose **Detach**. 

1. In the confirmation dialog box, choose **Detach policy**.

   The list of attached chat applications policies is updated. The policy change takes effect immediately.

**To detach a chat applications policy by navigating to the policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[Chatbot policies](https://console.aws.amazon.com/organizations/v2/home/policies/chatbot-policy)** page, choose the name of the policy that you want to detach from a root, OU, or account.

1. On the **Targets** tab, choose the radio button next to the root, OU, or account that you want to detach the policy from. You might have to expand OUs (choose the ![\[Gray cloud icon representing cloud computing or storage services.\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/console-expand.png)) to find the OU or account that you want.

1. Choose **Detach**.

1. In the confirmation dialog box, choose **Detach**.

   The list of attached chat applications policies is updated. The policy change takes effect immediately.

------
#### [ AI services opt-out policies ]

You can detach an AI services opt-out policy by either navigating to the policy or to the root, OU, or account that you want to detach the policy from.

**To detach an AI services opt-out policy by navigating to the root, OU, or account it's attached to**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[AWS accounts](https://console.aws.amazon.com/organizations/v2/home/accounts)** page navigate to the Root, OU, or account that you want to detach a policy from. You might have to expand OUs (choose the ![\[Gray cloud icon representing cloud computing or storage services.\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/console-expand.png)) to find the OU or account that you want. Choose the name of the Root, OU, or account.

1. On the **Policies** tab, choose the radio button next to the AI services opt-out policy that you want to detach, and then choose **Detach**. 

1. In the confirmation dialog box, choose **Detach policy**.

   The list of attached AI services opt-out policies is updated. The policy change takes effect immediately.

**To detach an AI services opt-out policy by navigating to the policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[AI services opt-out policies](https://console.aws.amazon.com/organizations/v2/home/policies/aiservices-opt-out-policy)** page, choose the name of the policy that you want to detach from a root, OU, or account.

1. On the **Targets** tab, choose the radio button next to the root, OU, or account that you want to detach the policy from. You might have to expand OUs (choose the ![\[Gray cloud icon representing cloud computing or storage services.\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/console-expand.png)) to find the OU or account that you want.

1. Choose **Detach**.

1. In the confirmation dialog box, choose **Detach**.

   The list of attached AI services opt-out policies is updated. The policy change takes effect immediately.

------
#### [ Security Hub policies ]

You can detach a Security Hub policy by either navigating to the policy or to the root, OU, or account that you want to detach the policy from.

**To detach a Security Hub policy by navigating to the root, OU, or account it's attached to**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[AWS accounts](https://console.aws.amazon.com/organizations/v2/home/accounts)** page navigate to the Root, OU, or account that you want to detach a policy from. You might have to expand OUs (choose the ![\[Gray cloud icon representing cloud computing or storage services.\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/console-expand.png)) to find the OU or account that you want. Choose the name of the Root, OU, or account.

1. On the **Policies** tab, choose the radio button next to the Security Hub policy that you want to detach, and then choose **Detach**. 

1. In the confirmation dialog box, choose **Detach policy**.

   The list of attached Security Hub policies is updated. The policy change takes effect immediately.

**To detach a Security Hub policy by navigating to the policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[Security Hub policies](https://console.aws.amazon.com/organizations/v2/home/policies/securityhub-policy)** page, choose the name of the policy that you want to detach from a root, OU, or account.

1. On the **Targets** tab, choose the radio button next to the root, OU, or account that you want to detach the policy from. You might have to expand OUs (choose the ![\[Gray cloud icon representing cloud computing or storage services.\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/console-expand.png)) to find the OU or account that you want.

1. Choose **Detach**.

1. In the confirmation dialog box, choose **Detach**.

   The list of attached Security Hub policies is updated. The policy change takes effect immediately.

------

### AWS CLI & AWS SDKs
<a name="detach_policy_cli_sdk"></a>

**To attach a policy**

The following code examples show how to use `DetachPolicy`.

------
#### [ .NET ]

**SDK for .NET**  
 There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/dotnetv3/Organizations#code-examples). 

```
    using System;
    using System.Threading.Tasks;
    using Amazon.Organizations;
    using Amazon.Organizations.Model;

    /// <summary>
    /// Shows how to detach a policy from an AWS Organizations organization,
    /// organizational unit, or account.
    /// </summary>
    public class DetachPolicy
    {
        /// <summary>
        /// Initializes the Organizations client object and uses it to call
        /// DetachPolicyAsync to detach the policy.
        /// </summary>
        public static async Task Main()
        {
            // Create the client object using the default account.
            IAmazonOrganizations client = new AmazonOrganizationsClient();

            var policyId = "p-00000000";
            var targetId = "r-0000";

            var request = new DetachPolicyRequest
            {
                PolicyId = policyId,
                TargetId = targetId,
            };

            var response = await client.DetachPolicyAsync(request);

            if (response.HttpStatusCode == System.Net.HttpStatusCode.OK)
            {
                Console.WriteLine($"Successfully detached policy with Policy Id: {policyId}.");
            }
            else
            {
                Console.WriteLine("Could not detach the policy.");
            }
        }
    }
```
+  For API details, see [DetachPolicy](https://docs.aws.amazon.com/goto/DotNetSDKV3/organizations-2016-11-28/DetachPolicy) in *AWS SDK for .NET API Reference*. 

------
#### [ CLI ]

**AWS CLI**  
**To detach a policy from a root, OU, or account**  
The following example shows how to detach a policy from an OU:  

```
aws organizations  detach-policy  --target-id ou-examplerootid111-exampleouid111 --policy-id p-examplepolicyid111
```
+  For API details, see [DetachPolicy](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/organizations/detach-policy.html) in *AWS CLI Command Reference*. 

------
#### [ Python ]

**SDK for Python (Boto3)**  
 There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/python/example_code/organizations#code-examples). 

```
def detach_policy(policy_id, target_id, orgs_client):
    """
    Detaches a policy from a target.

    :param policy_id: The ID of the policy to detach.
    :param target_id: The ID of the resource where the policy is currently attached.
    :param orgs_client: The Boto3 Organizations client.
    """
    try:
        orgs_client.detach_policy(PolicyId=policy_id, TargetId=target_id)
        logger.info("Detached policy %s from target %s.", policy_id, target_id)
    except ClientError:
        logger.exception(
            "Couldn't detach policy %s from target %s.", policy_id, target_id
        )
        raise
```
+  For API details, see [DetachPolicy](https://docs.aws.amazon.com/goto/boto3/organizations-2016-11-28/DetachPolicy) in *AWS SDK for Python (Boto3) API Reference*. 

------
#### [ SAP ABAP ]

**SDK for SAP ABAP**  
 There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/sap-abap/services/org#code-examples). 

```
    TRY.
        lo_org->detachpolicy(
          iv_policyid = iv_policy_id
          iv_targetid = iv_target_id ).
        MESSAGE 'Policy detached from target.' TYPE 'I'.
      CATCH /aws1/cx_orgaccessdeniedex.
        MESSAGE 'You do not have permission to detach the policy.' TYPE 'E'.
      CATCH /aws1/cx_orgpolicynotfoundex.
        MESSAGE 'The specified policy does not exist.' TYPE 'E'.
      CATCH /aws1/cx_orgtargetnotfoundex.
        MESSAGE 'The specified target does not exist.' TYPE 'E'.
      CATCH /aws1/cx_orgpolicynotattex.
        MESSAGE 'The policy is not attached to the target.' TYPE 'E'.
    ENDTRY.
```
+  For API details, see [DetachPolicy](https://docs.aws.amazon.com/sdk-for-sap-abap/v1/api/latest/index.html) in *AWS SDK for SAP ABAP API reference*. 

------

The policy change takes effect immediately, affecting the permissions of IAM users and roles and resources, if applicable, in the attached account or all accounts under the attached root or OU.

# Getting information about your organization's policies
<a name="orgs_manage_policies_info-operations"></a>

This topic describes various ways to get details about the policies in your organization. These procedures apply to *all* policy types. You must enable a policy type on the organization root before you can attach policies of that type to any entities in that organization root. 

**Topics**
+ [Listing all policies](#list-all-pols-in-org)
+ [Listing attached policies](#list-all-pols-in-entity)
+ [Listing all attachments](#list-all-entities-attached-to-pol)
+ [Getting details about a policy](#get-details-about-pol)

## Listing all policies
<a name="list-all-pols-in-org"></a>

**Minimum permissions**  
To list the policies within your organization, you must have the following permission:  
`organizations:ListPolicies`

You can view the policies in your organization in the AWS Management Console or by using an AWS Command Line Interface (AWS CLI) command or an AWS SDK operation.

### AWS Management Console
<a name="list-all-pols-in-org-console"></a><a name="proc-list-all-pols-in-org"></a>

**To list all of the policies in your organization**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[Policies](https://console.aws.amazon.com/organizations/v2/home/policies)** page, choose the policy type that you want to list.

   If the specified policy type is enabled, the console displays a list of all of the policies of that type that are currently available in the organization.

1. Return to the **[Policies](https://console.aws.amazon.com/organizations/v2/home/policies)** page and repeat for each policy type.

### AWS CLI & AWS SDKs
<a name="list-all-pols-in-org-cli-sdk"></a>

The following code examples show how to use `ListPolicies`.

------
#### [ .NET ]

**SDK for .NET**  
 There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/dotnetv3/Organizations#code-examples). 

```
    using System;
    using System.Threading.Tasks;
    using Amazon.Organizations;
    using Amazon.Organizations.Model;

    /// <summary>
    /// Shows how to list the AWS Organizations policies associated with an
    /// organization.
    /// </summary>
    public class ListPolicies
    {
        /// <summary>
        /// Initializes an Organizations client object, and then calls its
        /// ListPoliciesAsync method.
        /// </summary>
        public static async Task Main()
        {
            // Create the client object using the default account.
            IAmazonOrganizations client = new AmazonOrganizationsClient();

            // The value for the Filter parameter is required and must must be
            // one of the following:
            //     AISERVICES_OPT_OUT_POLICY
            //     BACKUP_POLICY
            //     SERVICE_CONTROL_POLICY
            //     TAG_POLICY
            var request = new ListPoliciesRequest
            {
                Filter = "SERVICE_CONTROL_POLICY",
                MaxResults = 5,
            };

            var response = new ListPoliciesResponse();
            try
            {
                do
                {
                    response = await client.ListPoliciesAsync(request);
                    response.Policies.ForEach(p => DisplayPolicies(p));
                    if (response.NextToken is not null)
                    {
                        request.NextToken = response.NextToken;
                    }
                }
                while (response.NextToken is not null);
            }
            catch (AWSOrganizationsNotInUseException ex)
            {
                Console.WriteLine(ex.Message);
            }
        }

        /// <summary>
        /// Displays information about the Organizations policies associated
        /// with an organization.
        /// </summary>
        /// <param name="policy">An Organizations policy summary to display
        /// information on the console.</param>
        private static void DisplayPolicies(PolicySummary policy)
        {
            string policyInfo = $"{policy.Id} {policy.Name}\t{policy.Description}";

            Console.WriteLine(policyInfo);
        }
    }
```
+  For API details, see [ListPolicies](https://docs.aws.amazon.com/goto/DotNetSDKV3/organizations-2016-11-28/ListPolicies) in *AWS SDK for .NET API Reference*. 

------
#### [ CLI ]

**AWS CLI**  
**To retrieve a list of all policies in an organization of a certain type**  
The following example shows you how to get a list of SCPs, as specified by the filter parameter:  

```
aws organizations list-policies --filter SERVICE_CONTROL_POLICY
```
The output includes a list of policies with summary information:  

```
{
        "Policies": [
                {
                        "Type": "SERVICE_CONTROL_POLICY",
                        "Name": "AllowAllS3Actions",
                        "AwsManaged": false,
                        "Id": "p-examplepolicyid111",
                        "Arn": "arn:aws:organizations::111111111111:policy/service_control_policy/p-examplepolicyid111",
                        "Description": "Enables account admins to delegate permissions for any S3 actions to users and roles in their accounts."
                },
                {
                        "Type": "SERVICE_CONTROL_POLICY",
                        "Name": "AllowAllEC2Actions",
                        "AwsManaged": false,
                        "Id": "p-examplepolicyid222",
                        "Arn": "arn:aws:organizations::111111111111:policy/service_control_policy/p-examplepolicyid222",
                        "Description": "Enables account admins to delegate permissions for any EC2 actions to users and roles in their accounts."
                },
                {
                        "AwsManaged": true,
                        "Description": "Allows access to every operation",
                        "Type": "SERVICE_CONTROL_POLICY",
                        "Id": "p-FullAWSAccess",
                        "Arn": "arn:aws:organizations::aws:policy/service_control_policy/p-FullAWSAccess",
                        "Name": "FullAWSAccess"
                }
        ]
}
```
+  For API details, see [ListPolicies](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/organizations/list-policies.html) in *AWS CLI Command Reference*. 

------
#### [ Python ]

**SDK for Python (Boto3)**  
 There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/python/example_code/organizations#code-examples). 

```
def list_policies(policy_filter, orgs_client):
    """
    Lists the policies for the account, limited to the specified filter.

    :param policy_filter: The kind of policies to return.
    :param orgs_client: The Boto3 Organizations client.
    :return: The list of policies found.
    """
    try:
        response = orgs_client.list_policies(Filter=policy_filter)
        policies = response["Policies"]
        logger.info("Found %s %s policies.", len(policies), policy_filter)
    except ClientError:
        logger.exception("Couldn't get %s policies.", policy_filter)
        raise
    else:
        return policies
```
+  For API details, see [ListPolicies](https://docs.aws.amazon.com/goto/boto3/organizations-2016-11-28/ListPolicies) in *AWS SDK for Python (Boto3) API Reference*. 

------
#### [ SAP ABAP ]

**SDK for SAP ABAP**  
 There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/sap-abap/services/org#code-examples). 

```
    TRY.
        oo_result = lo_org->listpolicies(       " oo_result is returned for testing purposes. "
          iv_filter = iv_filter ).
        DATA(lt_policies) = oo_result->get_policies( ).
        MESSAGE 'Retrieved list of policies.' TYPE 'I'.
      CATCH /aws1/cx_orgaccessdeniedex.
        MESSAGE 'You do not have permission to list policies.' TYPE 'E'.
      CATCH /aws1/cx_orgawsorgsnotinuseex.
        MESSAGE 'Your account is not a member of an organization.' TYPE 'E'.
    ENDTRY.
```
+  For API details, see [ListPolicies](https://docs.aws.amazon.com/sdk-for-sap-abap/v1/api/latest/index.html) in *AWS SDK for SAP ABAP API reference*. 

------

## Listing the policies attached to a root, OU, or account
<a name="list-all-pols-in-entity"></a>

**Minimum permissions**  
To list the policies that are attached to a root, organizational unit (OU), or account within your organization, you must have the following permission:  
`organizations:ListPoliciesForTarget` with a `Resource` element in the same policy statement that includes the Amazon Resource Name (ARN) of the specified target (or "\$1")

------
#### [ AWS Management Console ]

**To list all policies that are attached directly to a specified root, OU, or account**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[AWS accounts](https://console.aws.amazon.com/organizations/v2/home/accounts)** page, choose the name of the root, OU, or account whose policies you want to view. You might have to expand OUs (choose the ![\[Gray cloud icon representing cloud computing or storage services.\]](http://docs.aws.amazon.com/organizations/latest/userguide/images/console-expand.png)) to find the OU that you want.

1. On the Root, OU, or account page, choose the **Policies** tab.

   The **Policies** tab displays all of the policies attached to that root, OU, or account, grouped by policy type.

------
#### [ AWS CLI & AWS SDKs ]

**To list all policies that are attached directly to a specified root, OU, or account**  
You can use one of the following commands to list policies that are attached to an entity:
+ AWS CLI: [list-policies-for-target](https://docs.aws.amazon.com/cli/latest/reference/organizations/list-policies-for-target.html)

  The following example lists all of the service control policies attached to the specified OU. You must specify both the ID of the root, OU, or account, and the type of policy that you want to list.

  ```
  $ aws organizations list-policies-for-target \
      --target-id ou-a1b2-f6g7h222 \
      --filter SERVICE_CONTROL_POLICY
  {
      "Policies": [
          {
              "Id": "p-FullAWSAccess",
              "Arn": "arn:aws:organizations::aws:policy/service_control_policy/p-FullAWSAccess",
              "Name": "FullAWSAccess",
              "Description": "Allows access to every operation",
              "Type": "SERVICE_CONTROL_POLICY",
              "AwsManaged": true
          }
      ]
  }
  ```
+ AWS SDKs: [ListPoliciesForTarget](https://docs.aws.amazon.com/organizations/latest/APIReference/API_ListPoliciesForTarget.html)

------

## Listing all roots, OUs, and accounts that a policy is attached to
<a name="list-all-entities-attached-to-pol"></a>

**Minimum permissions**  
To list the entities that a policy is attached to, you must have the following permission:  
`organizations:ListTargetsForPolicy` with a `Resource` element in the same policy statement that includes the ARN of the specified policy (or "\$1")

------
#### [ AWS Management Console ]

**To list all roots, OUs, and accounts that have a specified policy attached**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[Policies](https://console.aws.amazon.com/organizations/v2/home/policies)** page, choose the policy type, and then choose the name of the policy whose attachments you want to examine.

1. Choose the **Targets** tab, to display a table of every root, OU, and account that the chosen policy is attached to.

------
#### [ AWS CLI & AWS SDKs ]

**To list all roots, OUs, and accounts that have a specified policy attached**  
You can use one of the following commands to list entities that have a policy:
+ AWS CLI: [list-targets-for-policy](https://docs.aws.amazon.com/cli/latest/reference/organizations/list-targets-for-policy.html)

  The following example shows all of the attachments to root, OUs, and accounts for the specified policy.

  ```
  $ aws organizations list-targets-for-policy \
      --policy-id p-FullAWSAccess
  {
      "Targets": [
          {
              "TargetId": "ou-a1b2-f6g7h111",
              "Arn": "arn:aws:organizations::123456789012:ou/o-aa111bb222/ou-a1b2-f6g7h111",
              "Name": "testou2",
              "Type": "ORGANIZATIONAL_UNIT"
          },
          {
              "TargetId": "ou-a1b2-f6g7h222",
              "Arn": "arn:aws:organizations::123456789012:ou/o-aa111bb222/ou-a1b2-f6g7h222",
              "Name": "testou1",
              "Type": "ORGANIZATIONAL_UNIT"
          },
          {
              "TargetId": "123456789012",
              "Arn": "arn:aws:organizations::123456789012:account/o-aa111bb222/123456789012",
              "Name": "My Management Account (bisdavid)",
              "Type": "ACCOUNT"
          },
          {
              "TargetId": "r-a1b2",
              "Arn": "arn:aws:organizations::123456789012:root/o-aa111bb222/r-a1b2",
              "Name": "Root",
              "Type": "ROOT"
          }
      ]
  }
  ```
+ AWS SDKs: [ListTargetsForPolicy](https://docs.aws.amazon.com/organizations/latest/APIReference/API_ListTargetsForPolicy.html)

------

## Getting details about a policy
<a name="get-details-about-pol"></a>

**Minimum permissions**  
To display the details of a policy, you must have the following permission:  
`organizations:DescribePolicy` with a `Resource` element in the same policy statement that includes the ARN of the specified policy (or "\$1")

### AWS Management Console
<a name="get-details-about-pol-console"></a>

**To get details about a policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[Policies](https://console.aws.amazon.com/organizations/v2/home/policies)** page, choose the policy type of the policy that you want to examine, and then choose the name of the policy.

   The policy page displays the available information about the policy, including its ARN, description, and attached targets. 
   + The **Content** tab shows the current contents of the policy in JSON format.
   + The **Targets** tab shows a list of the roots, OUs, and accounts to which the policy is attached.
   + The **Tags** tab shows the tags attached to the policy. Note: the Tags tab is not available for AWS managed policies.

   To edit the policy, choose **Edit policy**. Because each policy type has different editing requirements, see the instructions for creating and updating policies of your specified policy type.

### AWS CLI & AWS SDKs
<a name="orgs_manage_accounts_create-new-cli-sdk"></a>

The following code examples show how to use `DescribePolicy`.

------
#### [ CLI ]

**AWS CLI**  
**To get information about a policy**  
The following example shows how to request information about a policy:  

```
aws organizations describe-policy --policy-id p-examplepolicyid111
```
The output includes a policy object that contains details about the policy:  

```
{
        "Policy": {
                "Content": "{\n  \"Version\": \"2012-10-17\",\n  \"Statement\": [\n    {\n      \"Effect\": \"Allow\",\n      \"Action\": \"*\",\n      \"Resource\": \"*\"\n    }\n  ]\n}",
                "PolicySummary": {
                        "Arn": "arn:aws:organizations::111111111111:policy/o-exampleorgid/service_control_policy/p-examplepolicyid111",
                        "Type": "SERVICE_CONTROL_POLICY",
                        "Id": "p-examplepolicyid111",
                        "AwsManaged": false,
                        "Name": "AllowAllS3Actions",
                        "Description": "Enables admins to delegate S3 permissions"
                }
        }
}
```
+  For API details, see [DescribePolicy](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/organizations/describe-policy.html) in *AWS CLI Command Reference*. 

------
#### [ Python ]

**SDK for Python (Boto3)**  
 There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/python/example_code/organizations#code-examples). 

```
def describe_policy(policy_id, orgs_client):
    """
    Describes a policy.

    :param policy_id: The ID of the policy to describe.
    :param orgs_client: The Boto3 Organizations client.
    :return: The description of the policy.
    """
    try:
        response = orgs_client.describe_policy(PolicyId=policy_id)
        policy = response["Policy"]
        logger.info("Got policy %s.", policy_id)
    except ClientError:
        logger.exception("Couldn't get policy %s.", policy_id)
        raise
    else:
        return policy
```
+  For API details, see [DescribePolicy](https://docs.aws.amazon.com/goto/boto3/organizations-2016-11-28/DescribePolicy) in *AWS SDK for Python (Boto3) API Reference*. 

------
#### [ SAP ABAP ]

**SDK for SAP ABAP**  
 There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/sap-abap/services/org#code-examples). 

```
    TRY.
        oo_result = lo_org->describepolicy(     " oo_result is returned for testing purposes. "
          iv_policyid = iv_policy_id ).
        DATA(lo_policy) = oo_result->get_policy( ).
        MESSAGE 'Retrieved policy details.' TYPE 'I'.
      CATCH /aws1/cx_orgaccessdeniedex.
        MESSAGE 'You do not have permission to describe the policy.' TYPE 'E'.
      CATCH /aws1/cx_orgpolicynotfoundex.
        MESSAGE 'The specified policy does not exist.' TYPE 'E'.
    ENDTRY.
```
+  For API details, see [DescribePolicy](https://docs.aws.amazon.com/sdk-for-sap-abap/v1/api/latest/index.html) in *AWS SDK for SAP ABAP API reference*. 

------

# Deleting organization policies with AWS Organizations
<a name="orgs_policies_delete"></a>

When you no longer need a policy and after you detach it from all organizational units (OUs) and accounts, you can delete it.

This topic describes how to delete policies with AWS Organizations. A *policy* defines the controls that you want to apply to a group of AWS accounts.

**Topics**
+ [Delete policies](#delete_policy)

## Delete policies with AWS Organizations
<a name="delete_policy"></a>

When you sign in to your organization's management account, you can delete a policy that you no longer need in your organization. 

Before you can delete a policy, you must first detach it from all attached entities.

**Note**  
You can't delete any AWS managed SCP such as the SCP named `FullAWSAccess`.
You can't delete any AWS managed RCP such as the RCP named `RCPFullAWSAccess`.

**Minimum permissions**  
To delete a policy, you need permission to run the following action:  
`organizations:DeletePolicy`

### AWS Management Console
<a name="delete_policy_console"></a>

------
#### [ Service control policies (SCPs) ]

**To delete an SCP**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[Service control policies](https://console.aws.amazon.com/organizations/v2/home/policies/service-control-policy)** page, choose the name of the SCP that you want to delete.

1. You must first detach the policy that you want to delete from all roots, OUs, and accounts. Choose the **Targets** tab, choose the radio button next to each root, OU, or account that is shown in the **Targets** list, and then choose **Detach**. In the confirmation dialog box, choose **Detach**. Repeat until you remove all targets.

1. Choose **Delete** at the top of the page.

1. On the confirmation dialog box, enter the name of the policy, and then choose **Delete**.

------
#### [ Resource control policies (RCPs) ]

**To delete an RCP**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[Resource control policies](https://console.aws.amazon.com/organizations/v2/home/policies/resource-control-policy)** page, choose the name of the RCP that you want to delete.

1. You must first detach the policy that you want to delete from all roots, OUs, and accounts. Choose the **Targets** tab, choose the radio button next to each root, OU, or account that is shown in the **Targets** list, and then choose **Detach**. In the confirmation dialog box, choose **Detach**. Repeat until you remove all targets.

1. Choose **Delete** at the top of the page.

1. On the confirmation dialog box, enter the name of the policy, and then choose **Delete**.

------
#### [ Declarative policies ]

**To delete a declarative policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the ** [Declarative policies](https://console.aws.amazon.com/organizations/v2/home/policies/declarative-policy-ec2)** page, choose the name of the policy that you want to delete.

1. You must first detach the policy that you want to delete from all roots, OUs, and accounts. Choose the **Targets** tab, choose the radio button next to each root, OU, or account that is shown in the **Targets** list, and then choose **Detach**. In the confirmation dialog box, choose **Detach**. Repeat until you remove all targets.

1. Choose **Delete** at the top of the page.

1. On the confirmation dialog box, enter the name of the policy, and then choose **Delete**.

------
#### [ Backup policies ]

**To delete a backup policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[Backup policies](https://console.aws.amazon.com/organizations/v2/home/policies/backup-policy)** page, choose the name of the backup policy that you want to delete.

1. You must first detach the backup policy that you want to delete from all roots, OUs, and accounts. Choose the **Targets** tab, choose the radio button next to each root, OU, or account that is shown in the **Targets** list, and then choose **Detach**. In the confirmation dialog box, choose **Detach**. Repeat until you remove all targets.

1. Choose **Delete** at the top of the page.

1. On the confirmation dialog box, enter the name of the policy, and then choose **Delete**.

------
#### [ Tag policies ]

**To delete a tag policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the ****[Tag policies](https://console.aws.amazon.com/organizations/v2/home/policies/tag-policy)** page**, choose the policy that you want to delete. 

1. You must first detach the policy that you want to delete from all roots, OUs, and accounts. Choose the **Targets** tab, choose the radio button next to each root, OU, or account that's shown in the **Targets** list, and then choose **Detach**. In the confirmation dialog box, choose **Detach**. Repeat until you remove all targets.

1. Choose **Delete** at the top of the page.

1. On the confirmation dialog box, enter the name of the policy, and then choose **Delete**.

------
#### [ Chat applications policies ]

**To delete a chat applications policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[Chatbot policies](https://console.aws.amazon.com/organizations/v2/home/policies/chatbot-policy)** page, choose the name of the policy that you want to delete.

1. You must first detach the policy that you want to delete from all roots, OUs, and accounts. Choose the **Targets** tab, choose the radio button next to each root, OU, or account that is shown in the **Targets** list, and then choose **Detach**. In the confirmation dialog box, choose **Detach**. Repeat until you remove all targets.

1. Choose **Delete** at the top of the page.

1. On the confirmation dialog box, enter the name of the policy, and then choose **Delete**.

------
#### [ AI services opt-out policies ]

**To delete an AI services opt-out policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[AI services opt-out policies](https://console.aws.amazon.com/organizations/v2/home/policies/aiservices-opt-out-policy)** page, choose the name of the policy that you want to delete.

1. You must first detach the policy that you want to delete from all roots, OUs, and accounts. Choose the **Targets** tab, choose the radio button next to each root, OU, or account that is shown in the **Targets** list, and then choose **Detach**. In the confirmation dialog box, choose **Detach**. Repeat until you remove all targets.

1. Choose **Delete** at the top of the page.

1. On the confirmation dialog box, enter the name of the policy, and then choose **Delete**.

------
#### [ Security Hub policies ]

**To delete a Security Hub policy**

1. Sign in to the [AWS Organizations console](https://console.aws.amazon.com/organizations/v2). You must sign in as an IAM user, assume an IAM role, or sign in as the root user ([not recommended](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#lock-away-credentials)) in the organization’s management account.

1. On the **[Security Hub policies](https://console.aws.amazon.com/organizations/v2/home/policies/securityhub-policy)** page, choose the name of the policy that you want to delete.

1. You must first detach the policy that you want to delete from all roots, OUs, and accounts. Choose the **Targets** tab, choose the radio button next to each root, OU, or account that is shown in the **Targets** list, and then choose **Detach**. In the confirmation dialog box, choose **Detach**. Repeat until you remove all targets.

1. Choose **Delete** at the top of the page.

1. On the confirmation dialog box, enter the name of the policy, and then choose **Delete**.

------

### AWS CLI & AWS SDKs
<a name="delete_policy_cli_sdk"></a>

**To delete an a policy**

The following code examples show how to use `DeletePolicy`.

------
#### [ .NET ]

**SDK for .NET**  
 There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/dotnetv3/Organizations#code-examples). 

```
    using System;
    using System.Threading.Tasks;
    using Amazon.Organizations;
    using Amazon.Organizations.Model;

    /// <summary>
    /// Deletes an existing AWS Organizations policy.
    /// </summary>
    public class DeletePolicy
    {
        /// <summary>
        /// Initializes the Organizations client object and then uses it to
        /// delete the policy with the specified policyId.
        /// </summary>
        public static async Task Main()
        {
            // Create the client object using the default account.
            IAmazonOrganizations client = new AmazonOrganizationsClient();

            var policyId = "p-00000000";

            var request = new DeletePolicyRequest
            {
                PolicyId = policyId,
            };

            var response = await client.DeletePolicyAsync(request);

            if (response.HttpStatusCode == System.Net.HttpStatusCode.OK)
            {
                Console.WriteLine($"Successfully deleted Policy: {policyId}.");
            }
            else
            {
                Console.WriteLine($"Could not delete Policy: {policyId}.");
            }
        }
    }
```
+  For API details, see [DeletePolicy](https://docs.aws.amazon.com/goto/DotNetSDKV3/organizations-2016-11-28/DeletePolicy) in *AWS SDK for .NET API Reference*. 

------
#### [ CLI ]

**AWS CLI**  
**To delete a policy**  
The following example shows how to delete a policy from an organization. The example assumes that you previously detached the policy from all entities:  

```
aws organizations delete-policy --policy-id p-examplepolicyid111
```
+  For API details, see [DeletePolicy](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/organizations/delete-policy.html) in *AWS CLI Command Reference*. 

------
#### [ Python ]

**SDK for Python (Boto3)**  
 There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/python/example_code/organizations#code-examples). 

```
def delete_policy(policy_id, orgs_client):
    """
    Deletes a policy.

    :param policy_id: The ID of the policy to delete.
    :param orgs_client: The Boto3 Organizations client.
    """
    try:
        orgs_client.delete_policy(PolicyId=policy_id)
        logger.info("Deleted policy %s.", policy_id)
    except ClientError:
        logger.exception("Couldn't delete policy %s.", policy_id)
        raise
```
+  For API details, see [DeletePolicy](https://docs.aws.amazon.com/goto/boto3/organizations-2016-11-28/DeletePolicy) in *AWS SDK for Python (Boto3) API Reference*. 

------
#### [ SAP ABAP ]

**SDK for SAP ABAP**  
 There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/sap-abap/services/org#code-examples). 

```
    TRY.
        lo_org->deletepolicy(
          iv_policyid = iv_policy_id ).
        MESSAGE 'Policy deleted.' TYPE 'I'.
      CATCH /aws1/cx_orgaccessdeniedex.
        MESSAGE 'You do not have permission to delete the policy.' TYPE 'E'.
      CATCH /aws1/cx_orgpolicynotfoundex.
        MESSAGE 'The specified policy does not exist.' TYPE 'E'.
      CATCH /aws1/cx_orgpolicyinuseex.
        MESSAGE 'The policy is still attached to one or more targets.' TYPE 'E'.
    ENDTRY.
```
+  For API details, see [DeletePolicy](https://docs.aws.amazon.com/sdk-for-sap-abap/v1/api/latest/index.html) in *AWS SDK for SAP ABAP API reference*. 

------