

# Logging and monitoring in AWS Billing Conductor
<a name="billing-security-logging"></a>

Monitoring is an important part of maintaining the reliability, availability, and performance of your AWS account. There are several tools available to monitor your AWS Billing Conductor usage.

## AWS Cost and Usage Reports
<a name="eb-security-logging-cur"></a>

AWS Cost and Usage Reports tracks your AWS usage and provides estimated charges associated with your account. Each report contains line items for each unique combination of AWS products, usage type, and operation that you use in your AWS account. You can customize the AWS Cost and Usage Reports to aggregate the information either by the hour or by the day.

For more information about AWS Cost and Usage Reports, see the [https://docs.aws.amazon.com/cur/latest/userguide/what-is-cur.html](https://docs.aws.amazon.com/cur/latest/userguide/what-is-cur.html).

# Logging AWS Billing Conductor API calls using AWS CloudTrail
<a name="logging-using-cloudtrail"></a>

AWS Billing Conductor is integrated with AWS CloudTrail, a service that provides a record of actions taken by a user, role, or an AWS service in AWS Billing Conductor. CloudTrail captures all API calls for AWS Billing Conductor as events. The calls captured include calls from the AWS Billing Conductor console and code calls to the AWS Billing Conductor API operations. If you create a trail, you can enable continuous delivery of CloudTrail events to an Amazon S3 bucket, including events for AWS Billing Conductor. If you don't configure a trail, you can still view the most recent events in the CloudTrail console in **Event history**. Using the information collected by CloudTrail, you can determine the request that was made to AWS Billing Conductor, the IP address from which the request was made, who made the request, when it was made, and additional details.

To learn more about CloudTrail, see the [AWS CloudTrail User Guide](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-user-guide.html).

## AWS Billing Conductor CloudTrail events
<a name="billing-cloudtrail-events"></a>

This section shows a full list of the CloudTrail events related to Billing and Cost Management.


****  

| Event name | Definition | 
| --- | --- | 
|  `AssociateAccounts`  |  Logs the association of accounts to a billing group.  | 
|  `AssociatePricingRules`  | Logs the association of pricing rules to a pricing plan. | 
|  `AutoAssociateAccount`  | Logs the automatic association of an account to a billing group.  | 
|  `AutoDisassociateAccount`  | Logs the automatic disassociation of an account from a billing group in the next billing period. | 
|  `BatchAssociateResourcesToCustomLineItem`  | Logs the batch association of resources to a percentage custom line item. | 
|  `BatchDisassociateResourcesFromCustomLineItem`  |  Logs the batch disassociation of resources from a percentage custom line item.  | 
|  `CreateBillingGroup`  | Logs the creation of a billing group. | 
|  `CreateCustomLineItem`  |  Logs the creation of a custom line item.  | 
|  `CreatePricingPlan`  | Logs the creation of a pricing plan. | 
|  `CreatePricingRule`  | Logs the creation of a pricing rule. | 
|  `DeleteBillingGroup`  | Logs the deletion of a billing group. | 
|  `DeleteCustomLineItem`  | Logs the deletion of a custom line item. | 
|  `DeletePricingPlan`  | Logs the deletion of a pricing plan. | 
|  `DeletePricingRule`  | Logs the deletion of a pricing rule. | 
|  `DisassociateAccounts`  | Logs the disassociation of accounts from a billing group. | 
|  `DisassociatePricingRules`  | Logs the disassociation of pricing rules from a pricing plan. | 
|  `ListAccountAssociations`  | Logs the access to the account ids in the billing group. | 
|  `ListBillingGroupCostReports`  | Logs the access to the actual AWS charges for the billing group. | 
|  `ListBillingGroups`  | Logs the access to the billing groups in a billing period. | 
|  `ListCustomLineItems`  | Logs the access to the custom line items in a billing period. | 
|  `ListCustomLineItemVersions`  | Logs the access to the versions of a custom line item. | 
|  `ListPricingPlans`  | Logs the access to the pricing plans in a billing period. | 
|  `ListPricingPlansAssociatedWithPricingRule`  | Logs the access to the pricing plans associated to a pricing rule. | 
|  `ListPricingRules`  |  Logs the access to the pricing rules in a billing period.  | 
|  `ListPricingRulesAssociatedToPricingPlan`  |  Logs the access to the pricing rules associated to a pricing plan.  | 
|  `ListResourcesAssociatedToCustomLineItem`  | Logs the access to the resources associated to a custom line item. | 
| `ListTagsForResource` |  Logs the access to the tags on a resource.  | 
|  `TagResource`  | Logs the association of tags on a resource. | 
|  `UpdateBillingGroup`  | Logs the update of a billing group. | 
|  `UpdateCustomLineItem`  | Logs the update of a custom line item. | 
|  `UpdatePricingPlan`  | Logs the update of a pricing plan. | 
|  `UpdatePricingRule`  | Logs the update of a pricing rule. | 

## AWS Billing Conductor information in CloudTrail
<a name="service-name-info-in-cloudtrail"></a>

CloudTrail is enabled on your AWS account when you create the account. When activity occurs in AWS Billing Conductor, that activity is recorded in a CloudTrail event along with other AWS service events in **Event history**. You can view, search, and download recent events in your AWS account. For more information, see [Viewing events with CloudTrail Event history](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/view-cloudtrail-events.html).

For an ongoing record of events in your AWS account, including events for AWS Billing Conductor, create a trail. A *trail* enables CloudTrail to deliver log files to an Amazon S3 bucket. By default, when you create a trail in the console, the trail applies to all AWS Regions. The trail logs events from all Regions in the AWS partition and delivers the log files to the Amazon S3 bucket that you specify. Additionally, you can configure other AWS services to further analyze and act upon the event data collected in CloudTrail logs. For more information, see the following:
+ [Overview for creating a trail](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-create-and-update-a-trail.html)
+ [CloudTrail supported services and integrations](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-aws-service-specific-topics.html)
+ [Configuring Amazon SNS notifications for CloudTrail](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/configure-sns-notifications-for-cloudtrail.html)
+ [Receiving CloudTrail log files from multiple regions](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/receive-cloudtrail-log-files-from-multiple-regions.html) and [Receiving CloudTrail log files from multiple accounts](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-receive-logs-from-multiple-accounts.html)

All AWS Billing Conductor actions are logged by CloudTrail and are documented in the [AWS Billing Conductor API Reference](https://docs.aws.amazon.com/billingconductor/latest/APIReference).

Every event or log entry contains information about who generated the request. The identity information helps you determine the following:
+ Whether the request was made with root or AWS Identity and Access Management (IAM) user credentials.
+ Whether the request was made with temporary security credentials for a role or federated user.
+ Whether the request was made by another AWS service.

For more information, see the [CloudTrail userIdentity element](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-event-reference-user-identity.html).

## Understanding AWS Billing Conductor log file entries
<a name="understanding-service-name-entries"></a>

A trail is a configuration that enables delivery of events as log files to an Amazon S3 bucket that you specify. CloudTrail log files contain one or more log entries. An event represents a single request from any source and includes information about the requested action, the date and time of the action, request parameters, and so on. CloudTrail log files aren't an ordered stack trace of the public API calls, so they don't appear in any specific order. 

**Topics**
+ [AutoAssociateAccount](#CT-example-auto)
+ [CreateBillingGroup](#CT-example-create)

### AutoAssociateAccount
<a name="CT-example-auto"></a>

The following example shows a CloudTrail log entry that demonstrates the `AutoAssociateAccount` action.

```
{
    "eventVersion": "1.09",
    "userIdentity": {
        "accountId": "111122223333",
        "invokedBy": "billingconductor.amazonaws.com"
    },
    "eventTime": "2024-02-23T00:22:08Z",
    "eventSource": "billingconductor.amazonaws.com",
    "eventName": "AutoAssociateAccount",
    "awsRegion": "us-east-1",
    "sourceIPAddress": "billingconductor.amazonaws.com",
    "userAgent": "billingconductor.amazonaws.com",
    "requestParameters": null,
    "responseElements": null,
    "requestID": "1v14d239-fe63-4d2b-b3cd-450905b6c33",
    "eventID": "14536982-geff-4fe8-bh18-f18jde35218d0",
    "readOnly": false,
    "eventType": "AwsServiceEvent",
    "managementEvent": true,
    "recipientAccountId": "111122223333",
    "serviceEventDetails": {
        "requestParameters": {
            "Arn": "arn:aws:billingconductor::111122223333:billinggroup/444455556666",
            "AccountIds": [
                "333333333333"
            ]
        },
        "responseElements": {
            "Arn": "arn:aws:billingconductor::111122223333:billinggroup/444455556666"
        }
    },
    "eventCategory": "Management"
}
```

### CreateBillingGroup
<a name="CT-example-create"></a>

The following example shows a CloudTrail log entry that demonstrates the `CreateBillingGroup` action.

```
{
    "eventVersion": "1.08",
    "userIdentity": {
        "accountId":"111122223333",
        "accessKeyId":"ASIAIOSFODNN7EXAMPLE"
    },
    "eventTime": "2024-01-24T20:30:03Z",
    "eventSource": "billingconductor.amazonaws.com",
    "eventName": "CreateBillingGroup",
    "awsRegion": "us-east-1",
    "sourceIPAddress": "100.100.10.10",
    "userAgent": "aws-internal/3 aws-sdk-java/1.11.465 Linux/4.9.124-0.1.ac.198.73.329.metal1.x86_64 OpenJDK_64-Bit_Server_VM/25.192-b12 java/1.8.0_192",
    "requestParameters": {
        "PrimaryAccountId": "444455556666",
        "ComputationPreference": {
            "PricingPlanArn": "arn:aws:billingconductor::111122223333:pricingplan/TqeITi5Bgh"
        },
        "X-Amzn-Client-Token": "32aafb5s-e5b6-47f5-9795-3a69935e9da4",
        "AccountGrouping": {
            "LinkedAccountIds": [
                "444455556666",
                "111122223333"
            ]
        },
        "Name": "***"
    },
    "responseElements": {
        "Access-Control-Expose-Headers": "x-amzn-RequestId,x-amzn-ErrorType,x-amzn-ErrorMessage,Date",
        "Arn": "arn:aws:billingconductor::111122223333:billinggroup/444455556666"
    },
    "requestID": "fb26ae47-3510-a833-98fe-3dc0f602gb49",
    "eventID": "3ab70d86-c63e-46fd8d-a33s-ce2970441a8",
    "readOnly": false,
    "eventType": "AwsApiCall",
    "managementEvent": true,
    "recipientAccountId": "111122223333",
    "eventCategory": "Management"
}
```

# Using Amazon EventBridge with AWS Billing Conductor
<a name="using-eventbridge"></a>

AWS Billing Conductor is integrated with Amazon EventBridge, an event bus service that you can use to connect your applications with data from a variety of sources. For more information, see the [https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-what-is.html](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-what-is.html).

You can use Amazon EventBridge to receive AWS Billing Conductor events. Then, based on rules that you create, Amazon EventBridge invokes one or more target actions when an event matches the values that you specify in a rule. Depending on the type of event, you can capture event information, send notifications, or perform other actions. To set up an Amazon EventBridge rule for AWS Billing Conductor events, see [Create a rule in Amazon EventBridge](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-get-started.html#eb-gs-create-rule) in the *Amazon EventBridge User Guide*.

## Example: Amazon EventBridge event for AWS Billing Conductor
<a name="using-eventbridge-example-event"></a>

AWS Billing Conductor emits a daily summary event with the `Billing Group Configuration Recommended for Billing Transfer` detail type when a billing transfer is accepted but no corresponding billing group is configured, or when a billing group associated with an active billing transfer is deleted. When a billing transfer is accepted, we recommend configuring a billing group for the bill source account's organization, which enables accounts in that organization to access pro forma cost data in Billing and Cost Management tools. Without a billing group, usage data remains available through CloudWatch, but configuring a billing group makes it easier for bill source account administrators to monitor costs, such as through budgets configuration.

**Note**  
This event type is currently only supported in the US East (N. Virginia) Region (`us-east-1`).

The following is a generalized example of this event. You can subscribe to Amazon EventBridge events (such as this one) using AWS User Notifications.

```
{
  "account": "<account ID>", // 12-digit account ID
  "region": "us-east-1", // Currently only us-east-1 is supported
  "detail-type": "Billing Group Configuration Recommended for Billing Transfer",
  "source": "aws.billingconductor",
  "version": "0",
  "time": "<date>", // Format: yyyy-MM-dd'T'HH:mm:ssZ
  "id": "<id>", // alphanumeric string
  "resources": [],
  "detail": {
    "targetDate": "<date>", // Format: yyyy-MM-dd
    "recipientId": "<account ID>", // 12-digit recipient account ID
    "eventBridgeEventId": "<event ID>", // unique event identifier
    "directTransfersAccepted": [
      {
        "transferArn": "<transfer ARN>", // ARN of the one-level billing transfer
        "billSourceAccountId": "<account ID>", // 12-digit bill source account ID
        "effectiveTimestamp": "<timestamp>", // Format: yyyy-MM-dd'T'HH:mm:ssZ
        "acceptedTimestamp": "<timestamp>" // Format: yyyy-MM-dd'T'HH:mm:ssZ
      }
    ],
    "indirectTransfersAccepted": [
      {
        "receiverTransferTransferArn": "<transfer ARN>", // ARN of the receiver's transfer
        "transferBillSourceTransferArn": "<transfer ARN>", // ARN of the bill source's transfer
        "billTransferAccountId": "<account ID>", // 12-digit bill transfer account ID
        "billSourceAccountId": "<account ID>", // 12-digit bill source account ID
        "effectiveTimestamp": "<timestamp>", // Format: yyyy-MM-dd'T'HH:mm:ssZ
        "acceptedTimestamp": "<timestamp>" // Format: yyyy-MM-dd'T'HH:mm:ssZ
      }
    ],
    "directBillingGroupsDeleted": [
      {
        "billingGroupArn": "<billing group ARN>", // ARN of the deleted billing group
        "billSourceAccountId": "<account ID>", // 12-digit bill source account ID
        "transferId": "<transfer ID>", // associated transfer ID
        "deletedTimestamp": "<timestamp>" // Format: yyyy-MM-dd'T'HH:mm:ssZ
      }
    ],
    "indirectBillingGroupsDeleted": [
      {
        "billingGroupArn": "<billing group ARN>", // ARN of the deleted billing group
        "billTransferAccountId": "<account ID>", // 12-digit bill transfer account ID
        "billSourceAccountId": "<account ID>", // 12-digit bill source account ID
        "receiverTransferTransferId": "<transfer ID>", // receiver's transfer ID
        "transferBillSourceTransferId": "<transfer ID>", // bill source's transfer ID
        "deletedTimestamp": "<timestamp>" // Format: yyyy-MM-dd'T'HH:mm:ssZ
      }
    ]
  }
}
```

# Using AWS User Notifications with AWS Billing Conductor
<a name="using-user-notifications"></a>

You can use [AWS User Notifications](https://docs.aws.amazon.com/notifications/latest/userguide/what-is-service.html) to set up delivery channels that notify you about AWS Billing Conductor events. You will receive a notification when an event matches a specified rule. You can receive notifications for events through multiple channels, including email, [Amazon Q Developer in chat applications](https://docs.aws.amazon.com/chatbot/latest/adminguide/what-is.html) such as Amazon Chime, Microsoft Teams, and Slack, or [AWS Console Mobile Application](https://docs.aws.amazon.com/consolemobileapp/latest/userguide/what-is-consolemobileapp.html) push notifications. You can also see notifications using the [Console Notifications Center](https://console.aws.amazon.com/notifications/) in the AWS User Notifications console.

AWS User Notifications also supports aggregation, which can reduce the number of notifications you receive during specific events. For more information, see the [AWS User Notifications User Guide](https://docs.aws.amazon.com/notifications/latest/userguide/what-is-service.html).

To use AWS User Notifications, you must have the correct AWS Identity and Access Management (IAM) permissions. For more information about configuring your IAM permissions, see [Creating a notification configuration](https://docs.aws.amazon.com/notifications/latest/userguide/getting-started.html#getting-started-step1) in the *AWS User Notifications User Guide*.

The following table lists the AWS Billing Conductor event types supported by AWS User Notifications.


**AWS Billing Conductor event types**  

| Event type | Description | 
| --- | --- | 
| Billing Group Configuration Recommended for Billing Transfer | A daily summary of billing transfer events where accepted transfers don't have a corresponding billing group configured, or where billing groups associated with active billing transfers were deleted. When a billing transfer is accepted, we recommend configuring a billing group for the bill source account's organization, which enables accounts in that organization to access pro forma cost data in Billing and Cost Management tools. Without a billing group, usage data remains available through CloudWatch, but configuring a billing group makes it easier for bill source account administrators to monitor costs, such as through budgets configuration. This event type is currently only supported in the US East (N. Virginia) Region (us-east-1). | 

## Example event
<a name="using-user-notifications-example-event"></a>

The following is an example of a `Billing Group Configuration Recommended for Billing Transfer` event from AWS Billing Conductor. This event is emitted to Amazon EventBridge with the source `aws.billingconductor`.

```
{
  "account": "<account ID>", // 12-digit account ID
  "region": "us-east-1", // Currently only us-east-1 is supported
  "detail-type": "Billing Group Configuration Recommended for Billing Transfer",
  "source": "aws.billingconductor",
  "version": "0",
  "time": "<date>", // Format: yyyy-MM-dd'T'HH:mm:ssZ
  "id": "<id>", // alphanumeric string
  "resources": [],
  "detail": {
    "targetDate": "<date>", // Format: yyyy-MM-dd
    "recipientId": "<account ID>", // 12-digit recipient account ID
    "eventBridgeEventId": "<event ID>", // unique event identifier
    "directTransfersAccepted": [
      {
        "transferArn": "<transfer ARN>", // ARN of the one-level billing transfer
        "billSourceAccountId": "<account ID>", // 12-digit bill source account ID
        "effectiveTimestamp": "<timestamp>", // Format: yyyy-MM-dd'T'HH:mm:ssZ
        "acceptedTimestamp": "<timestamp>" // Format: yyyy-MM-dd'T'HH:mm:ssZ
      }
    ],
    "indirectTransfersAccepted": [
      {
        "receiverTransferTransferArn": "<transfer ARN>", // ARN of the receiver's transfer
        "transferBillSourceTransferArn": "<transfer ARN>", // ARN of the bill source's transfer
        "billTransferAccountId": "<account ID>", // 12-digit bill transfer account ID
        "billSourceAccountId": "<account ID>", // 12-digit bill source account ID
        "effectiveTimestamp": "<timestamp>", // Format: yyyy-MM-dd'T'HH:mm:ssZ
        "acceptedTimestamp": "<timestamp>" // Format: yyyy-MM-dd'T'HH:mm:ssZ
      }
    ],
    "directBillingGroupsDeleted": [
      {
        "billingGroupArn": "<billing group ARN>", // ARN of the deleted billing group
        "billSourceAccountId": "<account ID>", // 12-digit bill source account ID
        "transferId": "<transfer ID>", // associated transfer ID
        "deletedTimestamp": "<timestamp>" // Format: yyyy-MM-dd'T'HH:mm:ssZ
      }
    ],
    "indirectBillingGroupsDeleted": [
      {
        "billingGroupArn": "<billing group ARN>", // ARN of the deleted billing group
        "billTransferAccountId": "<account ID>", // 12-digit bill transfer account ID
        "billSourceAccountId": "<account ID>", // 12-digit bill source account ID
        "receiverTransferTransferId": "<transfer ID>", // receiver's transfer ID
        "transferBillSourceTransferId": "<transfer ID>", // bill source's transfer ID
        "deletedTimestamp": "<timestamp>" // Format: yyyy-MM-dd'T'HH:mm:ssZ
      }
    ]
  }
}
```