

# Billing groups
<a name="tagging-iot-billing-groups"></a>

Amazon IoT doesn't allow you to directly apply tags to individual things, but it does allow you to place things in billing groups and to apply tags to these. For Amazon IoT, allocation of cost and usage data based on tags is limited to billing groups.

Amazon IoT Core for LoRaWAN resources, such as wireless devices and gateways, can't be added to billing groups. However, they can be associated with Amazon IoT things, which can be added to billing groups.

The following commands are available:
+ [AddThingToBillingGroup](https://docs.amazonaws.cn//iot/latest/apireference/API_AddThingToBillingGroup) adds a thing to a billing group.
+ [CreateBillingGroup](https://docs.amazonaws.cn//iot/latest/apireference/API_CreateBillingGroup) creates a billing group.
+ [DeleteBillingGroup](https://docs.amazonaws.cn//iot/latest/apireference/API_DeleteBillingGroup) deletes the billing group.
+ [DescribeBillingGroup](https://docs.amazonaws.cn//iot/latest/apireference/API_DescribeBillingGroup) returns information about a billing group.
+ [ListBillingGroups](https://docs.amazonaws.cn//iot/latest/apireference/API_ListBillingGroups) lists the billing groups you have created.
+ [ListThingsInBillingGroup](https://docs.amazonaws.cn//iot/latest/apireference/API_ListThingsInBillingGroup) lists the things you have added to the given billing group.
+ [RemoveThingFromBillingGroup](https://docs.amazonaws.cn//iot/latest/apireference/API_RemoveThingFromBillingGroup) removes the given thing from the billing group.
+ [UpdateBillingGroup](https://docs.amazonaws.cn//iot/latest/apireference/API_UpdateBillingGroup) updates information about the billing group.
+ [CreateThing](https://docs.amazonaws.cn//iot/latest/apireference/API_CreateThing) allows you to specify a billing group for the thing when you create it.
+ [DescribeThing](https://docs.amazonaws.cn//iot/latest/apireference/API_DescribeThing) returns the description of a thing including the billing group the thing belongs to, if any.

The Amazon IoT Wireless API provides these actions to associate wireless devices and gateways with Amazon IoT things.
+ [AssociateWirelessDeviceWithThing](https://docs.amazonaws.cn//iot-wireless/latest/apireference/API_AssociateWirelessDeviceWithThing.html)
+ [AssociateWirelessGatewayWithThing](https://docs.amazonaws.cn//iot-wireless/latest/apireference/API_AssociateWirelessGatewayWithThing.html)

## Viewing cost allocation and usage data
<a name="tagging-iot-billing-groups-costs"></a>

You can use billing group tags to categorize and track your costs. When you apply tags to billing groups (and so to the things they include), Amazon generates a cost allocation report as a comma-separated value (CSV) file with your usage and costs aggregated by your tags. You can apply tags that represent business categories (such as cost centers, application names, or owners) to organize your costs across multiple services. For more information about using tags for cost allocation, see [ Use Cost Allocation Tags](https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/cost-alloc-tags.html) in the [Amazon Billing and Cost Management User Guide](https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/).

**Note**  
To accurately associate usage and cost data with those things you have placed in billing groups, each device or application must:  
Be registered as a thing in Amazon IoT. For more information, see [Managing devices with Amazon IoT](iot-thing-management.md).
Connect to the Amazon IoT message broker through MQTT using only the thing's name as the client ID. For more information, see [Device communication protocols](protocols.md). If you client ID doesn't match the thing name, you can enable the exclusive thing attachment to establish the association. For more information, see [Associating an Amazon IoT thing to an MQTT client connection](exclusive-thing.md).
Authenticate using a client certificate associated with the thing.

The following pricing dimensions are available for billing groups (based on the activity of things associated with the billing group):
+ Connectivity (based on the thing name used as the client ID to connect).
+ Messaging (based on messages inbound from, and outbound to, a thing; MQTT only).
+ Shadow operations (based on the thing whose message triggered a shadow update).
+ Rules triggered (based on the thing whose inbound message triggered the rule; does not apply to those rules triggered by MQTT lifecycle events).
+ Thing index updates (based on the thing that was added to the index). 
+ Remote actions (based on the thing updated).
+ [Amazon IoT Device Defender detect](https://docs.amazonaws.cn/iot-device-defender/latest/devguide/device-defender-detect.html) reports (based on the thing whose activity is reported).

Cost and usage data based on tags (and reported for a billing group) doesn't reflect the following activities:
+ Device registry operations (including updates to things, thing groups, and thing types). For more information, see [Managing devices with Amazon IoT](iot-thing-management.md)).
+ Thing group index updates (when adding a thing group).
+ Index search queries.
+ [Device provisioning](iot-provision.md).
+ [Amazon IoT Device Defender audit](https://docs.amazonaws.cn/iot-device-defender/latest/devguide/device-defender-audit.html) reports. 