Skip to content

Commit 121138e

Browse files
NLB-7299: NginxaaS cost analysis tool for standardv3 plan
1 parent 04e2a5a commit 121138e

File tree

2 files changed

+531
-0
lines changed

2 files changed

+531
-0
lines changed

content/nginxaas-azure/billing/usage-and-cost-estimator.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,3 +145,129 @@ Max(
145145
</div>
146146
<script type="module" src="/nginxaas-azure/js/cost-calculator_v2.js"></script>
147147
{{< /raw-html >}}
148+
149+
<h2>Cost Analysis Tool for Standard V3 Plan</h2>
150+
151+
<h3>Overview</h3>
152+
153+
The NGINXaaS for Azure cost analysis tool provides a detailed hourly cost breakdown of your NGINXaaS deployment usage for each component (NCU, WAF, Ports, Data). It fetches real-time metrics directly from Azure Monitor using the Azure SDK and calculates costs based on actual usage.
154+
155+
<h3>Prerequisites</h3>
156+
157+
Before using the cost analysis script:
158+
159+
1. **Python 3.7+** installed on your system
160+
2. **pip3** (Python package manager) installed
161+
3. **Azure SDK for Python** installed:
162+
163+
```bash
164+
pip3 install azure-identity azure-mgmt-monitor
165+
```
166+
167+
4. **NGINXaaS for Azure deployment** with monitoring enabled
168+
5. **Azure AD Tenant ID** (required for authentication)
169+
6. **Monitoring Reader permissions** on your NGINXaaS resource
170+
171+
<h4>Setting up Azure Permissions</h4>
172+
173+
<strong>Get Tenant ID:</strong>
174+
175+
1. Go to Azure Portal → Microsoft Entra ID → Overview
176+
2. Copy the <strong>Tenant ID</strong>
177+
178+
<strong>Grant Access:</strong>
179+
180+
1. Go to your NGINX resource → Access control (IAM) → Add role assignment
181+
2. Role: <strong>Monitoring Reader</strong> → Assign to your user account
182+
183+
<h3>Download and Usage</h3>
184+
185+
#### Download Script
186+
187+
{{<icon "download">}} {{<link "/scripts/nginxaas_cost_analysis.py" "Download nginxaas_cost_analysis.py script">}}
188+
189+
#### Basic Usage
190+
191+
Run the script with the required parameters:
192+
193+
```bash
194+
python3 nginxaas_cost_analysis.py \
195+
--resource-id "/subscriptions/xxx/resourceGroups/my-rg/providers/Nginx.NginxPlus/nginxDeployments/my-nginx" \
196+
--location "eastus2" \
197+
--date-range "2025-11-18T00:00:00Z/2025-11-19T23:59:59Z" \
198+
--tenant-id "your-tenant-id" \
199+
--output "my-cost-analysis.csv"
200+
```
201+
202+
#### Required Parameters
203+
204+
| Parameter | Description | Example |
205+
|-------------------|---------------------------------------------|----------------------------------------------|
206+
| `--resource-id` | Azure resource ID of NGINXaaS deployment | `/subscriptions/.../my-nginx` |
207+
| `--location` | Azure region for pricing tier | `eastus2`, `westus2` |
208+
| `--date-range` | Analysis period (max 30 days) | `2025-11-18T00:00:00Z/2025-11-19T23:59:59Z` |
209+
| `--tenant-id` | Azure AD Tenant ID (required for login) | `12345678-1234-...` |
210+
| `--output` | Output CSV filename (optional) | `my-cost-analysis.csv` |
211+
212+
#### Sample Output
213+
214+
{{< details "View sample output" >}}
215+
216+
```
217+
🌐 Using InteractiveBrowserCredential with tenant: d106871e-7b91-4733-8423-f98586303b68
218+
📈 Processing 72 hours of data...
219+
============================================================
220+
📈 COST ANALYSIS SUMMARY
221+
============================================================
222+
Total Analysis Period: 72 hours
223+
Total Cost: $32.40
224+
225+
🕐 HOURLY COST BREAKDOWN (First 5 hours):
226+
------------------------------------------------------------
227+
Hour 1 - 2025-11-18T00:00:00Z
228+
Fixed: $0.250 | WAF: $0.000 | NCU: $0.160
229+
Ports: $0.000 | Data: $0.000 | Total: $0.410
230+
231+
Hour 2 - 2025-11-18T01:00:00Z
232+
Fixed: $0.250 | WAF: $0.000 | NCU: $0.160
233+
Ports: $0.000 | Data: $0.000 | Total: $0.410
234+
235+
Hour 3 - 2025-11-18T02:00:00Z
236+
Fixed: $0.250 | WAF: $0.000 | NCU: $0.160
237+
Ports: $0.000 | Data: $0.000 | Total: $0.410
238+
239+
Hour 4 - 2025-11-18T03:00:00Z
240+
Fixed: $0.250 | WAF: $0.000 | NCU: $0.160
241+
Ports: $0.000 | Data: $0.000 | Total: $0.410
242+
243+
Hour 5 - 2025-11-18T04:00:00Z
244+
Fixed: $0.250 | WAF: $0.000 | NCU: $0.160
245+
Ports: $0.000 | Data: $0.000 | Total: $0.410
246+
247+
... and 67 more hours
248+
249+
✅ Cost breakdown exported to nginxaas_cost_breakdown.csv
250+
📊 Summary: 72 hours, Total cost: $32.40
251+
✅ Cost analysis completed successfully!
252+
```
253+
254+
{{< /details >}}
255+
256+
<h3>Understanding the Results</h3>
257+
258+
<h4>Cost Components</h4>
259+
260+
- **Fixed costs**: Fixed deployment cost (varies by region and WAF usage)
261+
- **NCU costs**: Variable costs based on actual NCU consumption
262+
- **WAF costs**: Additional costs when Web Application Firewall is enabled
263+
- **Port costs**: Additional costs for listen ports beyond the first 5
264+
- **Data processing**: Costs for data processed ($0.005/GB across all regions)
265+
266+
<h3>Additional Billing Resources</h3>
267+
268+
For comprehensive billing information and cost planning, refer to these additional resources:
269+
270+
- **[Usage and Cost Estimator]({{< relref "usage-and-cost-estimator.md" >}})**: Interactive tool for planning and estimating costs before deployment
271+
- **[Billing Overview]({{< relref "overview.md" >}})**: Complete billing model explanation and pricing details
272+
273+
This cost analysis tool helps you understand your actual NGINX for Azure spending by analyzing real usage metrics, enabling you to optimize costs and plan future deployments effectively.

0 commit comments

Comments
 (0)