

# Cross-account cross-Region profiles centralization in Amazon CloudWatch

Amazon CloudWatch profiles centralization copies profiles from multiple source accounts and Regions into a single destination account within your AWS Organizations organization. You control what is copied by creating a centralization rule. Profiles centralization uses the same centralization rules as logs and metrics centralization.

## Profiles centralization concepts
<a name="profiles-centralization-concepts"></a>

Before you begin using CloudWatch profiles centralization, familiarize yourself with the following concepts:

**Source account**  
The AWS account where profile data originates.

**Destination account**  
The AWS account that receives the copied profiles. The destination account stores and queries a copied profile like a profile that it ingested itself.

**Centralization rule**  
A rule, created in the management account or a delegated administrator account of the organization, that defines the source accounts and Regions and the destination account and Region. A rule copies profiles only when it includes profiles configuration.

**Account and Region labels**  
In a copied profile, `@aws.account` and `@aws.region` identify the destination account and Region that received the copy. `@resource.cloud.account.id` and `@resource.cloud.region` identify the source account and Region where the resource is deployed, when the sender sets them. For which senders set them, see [Recommended resource attributes for correlation](omni-profiles-get-started.md#omni-profiles-get-started-attributes).

**Backup Region**  
An optional second Region in the destination account. CloudWatch copies profiles to both the destination Region and the backup Region continuously. The backup Region is a second copy, not a failover target.

## How profiles centralization works
<a name="profiles-centralization-how-it-works"></a>

**Copying is opt-in**  
CloudWatch copies profiles only for centralization rules that include profiles configuration (`SourceProfilesConfiguration`). Existing centralization rules for logs or metrics do not start copying profiles unless you add profiles configuration to them.

**All profiles from the selected sources are copied**  
A rule copies all profiles from the source accounts and Regions that it selects. You can't select a subset of profiles.

**Only new profiles are copied**  
CloudWatch copies profiles that it receives after the rule takes effect. Profiles that were ingested before the rule existed are not copied.

**Copies can cross accounts and Regions**  
The destination Region can be different from the source Region. You can also centralize a single account's profiles from one Region into another Region of the same account. CloudWatch does not copy profiles from an account into the same account and Region.

**No copy loops**  
You don't get copy loops: CloudWatch does not copy profiles that it already centralized, even when a destination account is also a source account.

**Copies are owned by the destination account**  
After a profile is copied, the copy belongs to the destination account and is stored in the `default` dataset of the destination account in each destination Region.

**Changes take a few minutes to take effect**  
When you create, update, or delete a rule, or when an account joins or leaves the organization, CloudWatch typically applies the change within about 15 minutes. Until then, profiles can continue to be copied under the previous configuration.

## Security of centralized profiles
<a name="profiles-centralization-security"></a>

### Account responsibilities
<a name="profiles-centralization-responsibilities"></a>

**Management or delegated administrator account**  
Enables trusted access for CloudWatch in AWS Organizations, and creates, updates, and deletes centralization rules. Only an organization-level rule can centralize profiles. Account-level rules that include profiles configuration are rejected.

**Source accounts**  
Send profiles to CloudWatch as usual. Source accounts need no additional configuration, roles, or permissions for their profiles to be centralized.

**Destination account**  
Owns the copies and controls who can query them through IAM, and how they are encrypted at rest through the configuration of its `default` dataset.

### Where copies can go
<a name="profiles-centralization-isolation"></a>

CloudWatch copies a source account's profiles only to the destination accounts and Regions named in the organization's centralization rules. Before writing a copy, CloudWatch verifies that the profile belongs to the source account that the rule selects. Copies are sent to the destination Region over TLS.

### Encryption of centralized profiles
<a name="profiles-centralization-encryption"></a>
+ A copied profile is encrypted at rest with the encryption configuration of the destination account's `default` dataset in the destination Region. If you associate a customer-managed AWS KMS key with that dataset, the key applies to the copies. Otherwise, the copies are encrypted with an AWS owned key.
+ The encryption configuration of the source account does not apply to the copy. If a source dataset uses a customer-managed key, that key is not used for, and is not copied to, the destination.
+ Centralization rules have no profiles encryption setting. To control encryption of the copies, configure the destination account's `default` dataset. If you use a backup Region, configure the `default` dataset in that Region as well.
+ You do not need to grant the centralization process access to your customer-managed keys, in either the source or the destination account. Profiles centralization adds no requirements to your key policies.

For information about dataset encryption and the key policy that it requires, see [Encryption at rest for OpenTelemetry metrics and profiles](cmk-encryption.md).

## Setting up profiles centralization
<a name="profiles-centralization-setup"></a>

### Prerequisites
<a name="profiles-centralization-prerequisites"></a>
+ You must set up AWS Organizations, and the source and destination accounts must belong to the same organization.
+ You must enable trusted access for CloudWatch in AWS Organizations. Profiles centralization uses the same trusted access as metrics centralization. For more information, see [Cross-account cross-Region metrics centralization](CloudWatchMetrics_Centralization.md).

### Creating a centralization rule for profiles
<a name="profiles-centralization-create-rule"></a>

To centralize profiles, include `SourceProfilesConfiguration` in the rule source. Run the following command in the management account or a delegated administrator account of the organization. Replace each placeholder with your own value.

```bash
aws observabilityadmin create-centralization-rule-for-organization \
    --rule-name {{profiles-to-monitoring}} \
    --rule '{
        "Source": {
            "Regions": ["{{aa-example-1}}", "{{aa-example-2}}"],
            "Scope": "OrganizationId = '"'{{o-exampleorgid}}'"'",
            "SourceProfilesConfiguration": {}
        },
        "Destination": {
            "Account": "{{111122223333}}",
            "Region": "{{aa-example-3}}"
        }
    }'
```

{{profiles-to-monitoring}}  
A name for the rule.

{{aa-example-1}}, {{aa-example-2}}  
The source Regions to copy profiles from.

{{o-exampleorgid}}  
Your organization ID.

{{111122223333}}  
The destination account ID.

{{aa-example-3}}  
The destination Region.

To also keep a backup copy, add `DestinationProfilesConfiguration` to the rule destination, and replace {{aa-example-4}} with the backup Region:

```json
"DestinationProfilesConfiguration": {
    "BackupConfiguration": { "Region": "{{aa-example-4}}" }
}
```

To turn on profiles centralization for the rule, use an empty `SourceProfilesConfiguration` object. A rule can include profiles configuration together with logs or metrics configuration, or on its own.

To stop copying profiles, remove `SourceProfilesConfiguration` from the rule with `UpdateCentralizationRuleForOrganization`, or delete the rule with `DeleteCentralizationRuleForOrganization`.

## Monitoring profiles centralization
<a name="profiles-centralization-monitoring"></a>

**Rule changes**  
CloudTrail records calls to the centralization rule APIs, such as `CreateCentralizationRuleForOrganization`, `UpdateCentralizationRuleForOrganization`, and `DeleteCentralizationRuleForOrganization`, in the account that made the call.

**Copied profiles**  
When CloudWatch writes copied profiles into a destination account, CloudTrail records a `PutOtelProfiles` data event in the destination account. The event has the resource type `AWS::CloudWatch::Dataset`, the ARN of the destination account's `default` dataset, and names the centralization service principal in `userIdentity.invokedBy`. CloudTrail doesn't log data events by default. To record them, enable data events for the `AWS::CloudWatch::Dataset` resource type. For more information, see [CloudWatch data events in CloudTrail](logging_cw_api_calls.md#CloudWatch-data-plane-events).

**Rule health**  
Use `GetCentralizationRuleForOrganization` to check the health status of a rule. If trusted access is not enabled, or the destination account is not in the organization, the rule is `UNHEALTHY` and no profiles are copied.

## Related resources
<a name="profiles-centralization-related-resources"></a>
+ [Cross-account cross-Region metrics centralization](CloudWatchMetrics_Centralization.md)
+ [Encryption at rest for OpenTelemetry metrics and profiles](cmk-encryption.md)
+ [Configure CloudWatch integration with AWS Organizations](https://docs.aws.amazon.com/organizations/latest/userguide/services-that-can-integrate-cloudwatch.html)
+ [Amazon CloudWatch Pricing](https://aws.amazon.com/cloudwatch/pricing/) on the AWS website