返回顶部
a

aws-price-csvAWS价格CSV生成

Generate AWS cost CSVs from a user-provided service list. Use when someone supplies an item list + AWS region and needs per-item pricing plus totals via AWS Price List API or bulk pricing JSON.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
295
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

aws-price-csv

AWS 价格 CSV 技能

概述

将用户提供的 AWS 服务列表(实例、卷、S3 存储桶等)转换为定价 CSV。该脚本可以查询 AWS 价格列表 API(通过 aws-cli)或重用缓存的批量 JSON 文件。它支持按需和预留实例条款,并自动计算每个项目及总成本。

快速开始

  1. 1. 准备一个包含 name、servicecode、filters、term 和 usage 字段的 YAML/JSON 文件(参见 references/apireference.md 中的示例)。
  2. 选择数据源:
- API 模式 – 需要 aws pricing get-products 权限和互联网连接。 - 批量模式 – 无需 IAM 访问权限;脚本会下载/缓存公共批量 JSON 文件。
  1. 3. 使用区域和所需选项运行脚本:
bash python3 scripts/generatepricingcsv.py \ --input inputs/sample.yml \ --region ap-northeast-1 \ --source bulk \ --cache-dir ~/.cache/aws-price-csv \ --output quotes/apac_quote.csv
  1. 4. 检查 CSV(每个行项目 + 总计),如有需要可与原始请求一起交付。

工作流程

1. 准备输入列表

  • - 使用 references/api_reference.md 中的 YAML/JSON 模板。
  • filters 必须映射到 AWS 定价属性(instanceType、regionCode、volumeApiName、usagetype、termType 等)。
  • term.type:OnDemand 或 Reserved(RI)。
  • term.attributes(可选)过滤预留价格(LeaseContractLength、PurchaseOption、OfferingClass 等)。
  • usage.quantity 表示要乘的数值(小时、GB-月、请求数等)。

2. 选择数据源
模式使用场景说明
API(--source api)已有 IAM 凭证且需要实时数据在 us-east-1 区域使用 aws pricing get-products
批量(--source bulk)
离线、无 IAM 或需要缓存 | 脚本检查 --cache-dir(默认 ~/.cache/aws-price-csv);30 天内的缓存文件会被重用,否则重新下载 |

仍可通过 --bulk-files ServiceCode=/path/to/file.json 覆盖;这些文件优先级高于缓存。

3. 生成 CSV

  • - 脚本路径:scripts/generatepricingcsv.py
  • 关键参数:
- --input:YAML/JSON 列表 - --region:AWS 区域代码(位置名称会自动添加到过滤条件中) - --output:CSV 路径(默认 aws_pricing.csv) - --source:api(默认)或 bulk - --cache-dir:批量缓存目录(默认 ~/.cache/aws-price-csv) - --force-refresh:忽略缓存的批量文件并重新下载 - --bulk-files:ServiceCode=/path/to/file.json 覆盖缓存
  • - 输出列:itemname, servicecode, termtype, region, location, quantity, usageunit, priceunit, priceperunitusd, cost_usd, description,外加一个 TOTAL 行。

4. 验证并交付

  • - 检查 CSV 确保每个行项目都有定价和描述。
  • 确认 TOTAL 符合预期。
  • 如有需要,附上源列表或任何支持文档。

故障排除
问题解决方法
aws pricing 返回空结果仔细检查过滤条件(location、regionCode、termType 等),或回退到批量模式
缺少 aws CLI
安装 aws-cli v2,配置凭证,或依赖批量模式 |

| 需要刷新缓存数据 | 使用 --force-refresh 或删除缓存的 JSON 文件以重新下载 | | 缺少 PyYAML | pip install pyyaml 或将输入转换为 JSON | | 未找到预留价格 | 在 term.attributes 中添加 LeaseContractLength、PurchaseOption、OfferingClass |

资源

  • - scripts/generatepricingcsv.py – 主脚本,支持 API/批量模式、缓存逻辑以及按需/预留实例处理。
  • references/api_reference.md – 价格列表 API 示例、批量下载指南、区域/位置表以及示例输入模板(包括 gp3 和 RI 案例)。

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 aws-price-csv-1776207245 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 aws-price-csv-1776207245 技能

通过命令行安装

skillhub install aws-price-csv-1776207245

下载

⬇ 下载 aws-price-csv v1.0.0(免费)

文件大小: 16.64 KB | 发布时间: 2026-4-15 13:52

v1.0.0 最新 2026-4-15 13:52
Initial release of aws-price-csv.

- Generate AWS pricing CSVs from user-supplied service/item lists and regions.
- Supports both live AWS Price List API and bulk JSON pricing queries.
- Handles On-Demand and Reserved pricing terms, including key filters and contract types.
- Outputs detailed cost breakdowns per item plus a total row in CSV format.
- Includes caching and offline mode with cache refresh/override options.
- Supports YAML/JSON input files and customizable output paths.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部