# AWS Cost Explorer by HTTP ## Overview The template to monitor AWS Cost Explorer by HTTP via Zabbix, which works without any external scripts. Most of the metrics are collected in one go, thanks to Zabbix bulk data collection. *NOTE* This template uses the Cost Explorer API calls to list and retrieve metrics. For more information, please refer to the (Cost Explorer pricing)[https://aws.amazon.com/aws-cost-management/aws-cost-explorer/pricing/] page. ## Requirements Zabbix version: 7.0 and higher. ## Tested versions This template has been tested on: - AWS by HTTP ## Configuration > Zabbix should be configured according to the instructions in the [Templates out of the box](https://www.zabbix.com/documentation/7.0/manual/config/templates_out_of_the_box) section. ## Setup Before using the template, you need to create an IAM policy for the Zabbix role in your AWS account with the necessary permissions. * [IAM policies for AWS Cost Management](https://docs.aws.amazon.com/cost-management/latest/userguide/billing-permissions-ref.html) Add the following required permissions to your Zabbix IAM policy in order to collect metrics. ```json { "Version": "2012-10-17", "Statement": [ { "Action": [ "ce:*" ], "Effect": "Allow", "Resource": "*" } ] } ``` Set macros {$AWS.ACCESS.KEY.ID}, {$AWS.SECRET.ACCESS.KEY}. For more information about managing access keys, see the [official documentation](https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys). Also, see the Macros section for a list of macros used in LLD filters. Additional information about metrics and used API methods: * [Describe AWS Cost Explore API actions](https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_Operations.html) ### Macros used |Name|Description|Default| |----|-----------|-------| |{$AWS.PROXY}|

Sets HTTP proxy value. If this macro is empty, then no proxy is used.

|| |{$AWS.ACCESS.KEY.ID}|

Access key ID.

|| |{$AWS.SECRET.ACCESS.KEY}|

Secret access key.

|| |{$AWS.BILLING.REGION}|

Amazon Billing region code.

|`us-east-1`| |{$AWS.BILLING.MONTH}|

Months to get historical data from AWS Cost Explore API, no more than 12 months.

|`11`| |{$AWS.BILLING.LLD.FILTER.SERVICE.MATCHES}|

Filter of discoverable discovered billing service by name.

|`.*`| |{$AWS.BILLING.LLD.FILTER.SERVICE.NOT_MATCHES}|

Filter to exclude discovered billing service by name.

|`CHANGE_IF_NEEDED`| ### Items |Name|Description|Type|Key and additional info| |----|-----------|----|-----------------------| |AWS Cost: Get monthly costs||Script|aws.get.monthly.costs

**Preprocessing**

| |AWS Cost: Get daily costs|

Get raw data on the daily costs by service

|Script|aws.get.daily.costs

**Preprocessing**

| ### LLD rule AWS daily costs by services discovery |Name|Description|Type|Key and additional info| |----|-----------|----|-----------------------| |AWS daily costs by services discovery|

Discovery of daily blended costs by services.

|Dependent item|aws.daily.services.costs.discovery

**Preprocessing**

| ### Item prototypes for AWS daily costs by services discovery |Name|Description|Type|Key and additional info| |----|-----------|----|-----------------------| |AWS Cost: Service ["{#AWS.BILLING.SERVICE.NAME}"]: Blended daily cost|

The daily blended cost of the {#AWS.BILLING.SERVICE.NAME} service for the previous day.

|Dependent item|aws.daily.service.cost["{#AWS.BILLING.SERVICE.NAME}"]

**Preprocessing**

| ### LLD rule AWS monthly costs by services discovery |Name|Description|Type|Key and additional info| |----|-----------|----|-----------------------| |AWS monthly costs by services discovery|

Discovery of monthly costs by services.

|Dependent item|aws.cost.service.monthly.discovery

**Preprocessing**

| ### Item prototypes for AWS monthly costs by services discovery |Name|Description|Type|Key and additional info| |----|-----------|----|-----------------------| |AWS Cost: ["{#AWS.BILLING.SERVICE.NAME}"]: Month ["{#AWS.BILLING.MONTH}"] Blended cost|

The monthly cost by service {#AWS.BILLING.SERVICE.NAME}.

|Dependent item|aws.monthly.service.cost["{#AWS.BILLING.SERVICE.NAME}", "{#AWS.BILLING.MONTH}"]

**Preprocessing**

| ### LLD rule AWS monthly costs discovery |Name|Description|Type|Key and additional info| |----|-----------|----|-----------------------| |AWS monthly costs discovery|

Discovery of monthly costs.

|Dependent item|aws.monthly.cost.discovery

**Preprocessing**

| ### Item prototypes for AWS monthly costs discovery |Name|Description|Type|Key and additional info| |----|-----------|----|-----------------------| |AWS Cost: ["{#AWS.BILLING.MONTH}"]: Blended cost per month|

The blended cost by month {#AWS.BILLING.MONTH}.

|Dependent item|aws.monthly.cost["{#AWS.BILLING.MONTH}"]

**Preprocessing**

| ## Feedback Please report any issues with the template at [`https://support.zabbix.com`](https://support.zabbix.com) You can also provide feedback, discuss the template, or ask for help at [`ZABBIX forums`](https://www.zabbix.com/forum/zabbix-suggestions-and-feedback)