An open API service indexing awesome lists of open source software.

https://github.com/notharshhaa/aws-billing-alert-terraform

๐“๐ก๐ข๐ฌ ๐ซ๐ž๐ฉ๐จ๐ฌ๐ข๐ญ๐จ๐ซ๐ฒ ๐œ๐จ๐ง๐ญ๐š๐ข๐ง๐ฌ ๐š ๐“๐ž๐ซ๐ซ๐š๐Ÿ๐จ๐ซ๐ฆ ๐ฆ๐จ๐๐ฎ๐ฅ๐ž ๐ญ๐ก๐š๐ญ ๐ก๐ž๐ฅ๐ฉ๐ฌ ๐ฌ๐ž๐ญ ๐ฎ๐ฉ ๐€๐–๐’ ๐›๐ข๐ฅ๐ฅ๐ข๐ง๐  ๐š๐ฅ๐ž๐ซ๐ญ๐ฌ
https://github.com/notharshhaa/aws-billing-alert-terraform

aws aws-billing aws-terraform terraform terraform-modules

Last synced: about 1 year ago
JSON representation

๐“๐ก๐ข๐ฌ ๐ซ๐ž๐ฉ๐จ๐ฌ๐ข๐ญ๐จ๐ซ๐ฒ ๐œ๐จ๐ง๐ญ๐š๐ข๐ง๐ฌ ๐š ๐“๐ž๐ซ๐ซ๐š๐Ÿ๐จ๐ซ๐ฆ ๐ฆ๐จ๐๐ฎ๐ฅ๐ž ๐ญ๐ก๐š๐ญ ๐ก๐ž๐ฅ๐ฉ๐ฌ ๐ฌ๐ž๐ญ ๐ฎ๐ฉ ๐€๐–๐’ ๐›๐ข๐ฅ๐ฅ๐ข๐ง๐  ๐š๐ฅ๐ž๐ซ๐ญ๐ฌ

Awesome Lists containing this project

README

          

# ๐Ÿš€ AWS Billing Alert Terraform Module

![AWS-billing](https://imgur.com/wtaBi16.png)

Welcome to the **AWS Billing Alert Terraform module!** This module helps you set up automatic billing alerts for your AWS account. Once configured, you'll receive notifications when your AWS charges exceed specified amounts, helping you stay on top of your costs. ๐Ÿ’ฐ

---

## ๐Ÿ› ๏ธ Prerequisites

> [!IMPORTANT]
> **Before you begin, make sure you have the following:**
>
> - ๐Ÿงฐ **Terraform (v1.5.0 or later)** installed on your local machine.
> - ๐ŸŒ **An AWS account** with appropriate permissions.
> - ๐Ÿ”‘ **AWS CLI** configured with the necessary credentials.

---

## ๐Ÿ” Understanding the AWS Services

### ๐ŸŒŸ AWS CloudWatch

[AWS CloudWatch](https://aws.amazon.com/cloudwatch/) is a monitoring and observability service that collects and tracks metrics, collects and monitors log files, and sets alarms. This module uses CloudWatch to monitor your AWS billing and trigger an alarm when specified thresholds are exceeded.

### ๐Ÿ“ข AWS SNS (Simple Notification Service)

[AWS SNS](https://aws.amazon.com/sns/) is a fully managed messaging service. It allows you to send notifications to multiple subscribers. In this module, SNS is used to send billing alerts via email, SMS, or other supported channels when the CloudWatch alarm is triggered.

### ๐Ÿงพ AWS Billing

[AWS Billing](https://aws.amazon.com/aws-cost-management/aws-bill/) provides tools to manage your AWS costs and budget. This module automates the monitoring of your AWS billing, so you're notified before your bill goes beyond your expectations.

---

## ๐Ÿš€ New Features & Improvements [07-03-2025]

โœ… **Multiple Email Alerts** โ€“ Supports multiple recipients by allowing a list of emails.
โœ… **SNS Dead-Letter Queue (DLQ)** โ€“ Ensures failed notifications are retried.
โœ… **Per-Service Billing Alerts** โ€“ Monitors spending on individual AWS services like EC2, S3, etc.
โœ… **Enhanced CloudWatch Filters** โ€“ Improved billing log monitoring for better cost visibility.
โœ… **CloudWatch Dashboard** โ€“ Provides an overview of billing trends and cost insights.

---

## ๐Ÿ“ฆ Setup Instructions

### 1๏ธโƒฃ Clone the Repository

1. Open your terminal or command prompt.
2. Navigate to the directory where you'd like to place the project:

```bash
cd /path/to/your/directory
```

3. Clone the repository:

```bash
git clone https://github.com/NotHarshhaa/aws-billing-alert-terraform.git
```

4. Move into the directory:

```bash
cd aws-billing-alert-terraform
```

---

### 2๏ธโƒฃ Install Terraform

Follow the steps in your system documentation to install **Terraform** or use the quick instructions for Amazon Linux:

```bash
sudo yum install -y yum-utils shadow-utils
sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/AmazonLinux/hashicorp.repo
sudo yum -y install terraform
terraform --version
```

---

### 3๏ธโƒฃ Initialize Terraform

Prepare Terraform for use:

```bash
terraform init
```

---

### 4๏ธโƒฃ Configure and Apply Changes

#### Update Configuration Variables:

With the recent changes, you can now:

- Set custom **AWS regions** using `aws_region`.
- Configure **currencies** for billing alerts.
- Automatically confirm **email subscriptions** for ease of setup during testing.
- Configure **per-service billing alerts** to track costs for specific AWS services.
- Enable **SNS DLQ** for better message reliability.
- Visualize billing trends via the **CloudWatch Dashboard**.

Update the `terraform.tfvars` file with your settings:

```hcl
aws_region = "us-east-1"
alert_thresholds = [100, 150, 200]
currency = "USD"
email_endpoints = ["your-email@example.com", "team@example.com"]
auto_confirm_subscription = true
```

#### Apply the Configuration:

```bash
terraform apply
```

---

## ๐Ÿ”ง Customization

### Billing Thresholds

Modify the `alert_thresholds` in your variables file to configure additional thresholds for your billing alerts:

```hcl
alert_thresholds = [100, 150, 200, 250]
```

### Email Subscription Auto-Confirmation

For testing purposes, you can enable automatic email confirmation by setting:

```hcl
auto_confirm_subscription = true
```

> [!IMPORTANT]
> **Use this option only in test environments with proper permissions.**

---

## ๐Ÿ“ฌ Notifications

This module supports email alerts via **AWS SNS**. Update the `email_endpoints` variable with your preferred email addresses to receive billing notifications.

---

## ๐Ÿ“ Example Usage

Hereโ€™s an example configuration:

```hcl
module "billing_alert" {
source = "github.com/NotHarshhaa/aws-billing-alert-terraform"
aws_region = "us-west-2"
alert_thresholds = [100, 150, 200]
email_endpoints = ["my-email@example.com", "finance@example.com"]
auto_confirm_subscription = true
currency = "USD"
}
```

---

## ๐ŸŽฏ Usage

This module is flexible and supports dynamic region, currency, and threshold configurations. Customize the `alert.tf` file as needed and reapply the configuration using `terraform apply`.

---

## ๐Ÿ™Œ Feedback and Contributions

> [!TIP]
> _We'd love to hear your thoughts! Whether it's feedback, bug reports, or pull requests, feel free to get involved. Your contributions help make this module better for everyone._

## โญ Hit the Star

> [!IMPORTANT]
> _If you find this repository helpful for learning or in practice, **please hit the star button on GitHub.** โญ It helps others find this resource too!_

### ๐Ÿ‘ค Author

![banner](https://imgur.com/2j7GSPs.png)

> [!TIP]
> **Join Our [Telegram Community](https://t.me/prodevopsguy) || [Follow me on GitHub](https://github.com/NotHarshhaa) for more DevOps content!**