Google Cloud Pricing Cost Calculator 项目使用指南
1. 项目目录结构及介绍
google-cloud-pricing-cost-calculator/
├── build/
├── gcosts/
├── img/
├── tools/
├── usage/
├── .editorconfig
├── .gitignore
├── .gitpod.yml
├── .golangci.yml
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── cloud-shell-tutorial.md
└── pricing.yml
目录结构说明
- build/: 构建相关文件。
- gcosts/: 项目的主要代码文件,包含CLI程序的实现。
- img/: 项目中使用的图片资源。
- tools/: 项目中使用的工具脚本。
- usage/: 用户自定义的YAML配置文件存放目录。
- .editorconfig: 编辑器配置文件,用于统一代码风格。
- .gitignore: Git忽略文件配置。
- .gitpod.yml: Gitpod配置文件。
- .golangci.yml: GolangCI配置文件。
- CODE_OF_CONDUCT.md: 行为准则文件。
- CONTRIBUTING.md: 贡献指南文件。
- LICENSE: 项目许可证文件。
- README.md: 项目介绍和使用说明文件。
- cloud-shell-tutorial.md: 云Shell教程文件。
- pricing.yml: 价格信息配置文件。
2. 项目启动文件介绍
项目的启动文件是gcosts
,这是一个命令行工具,用于计算Google Cloud Platform产品的预计月度成本。
启动文件说明
- gcosts: 这是一个可执行文件,支持Linux、macOS和Windows操作系统。用户可以通过命令行运行此文件来启动成本计算工具。
启动命令示例
-
Linux/macOS:
./gcosts help
-
Windows:
.\gcosts.exe help
3. 项目的配置文件介绍
主要配置文件
- pricing.yml: 这个文件包含了Google Cloud Platform产品的价格信息。用户可以通过下载最新的
pricing.yml
文件来获取最新的价格数据。
用户自定义配置文件
- usage/: 用户可以在这个目录下创建自己的YAML配置文件,定义资源的使用情况。例如:
region: europe-west4 project: my-first-project instances: - name: app-server type: e2-standard-8 os: rhel commitment: 3 disks: - name: disk-boot type: ssd data: 75
配置文件使用示例
-
下载价格信息文件:
curl -L "https://github.com/Cyclenerd/google-cloud-pricing-cost-calculator/raw/master/pricing.yml" -o "pricing.yml"
-
运行成本计算工具:
./gcosts calc --pricing pricing.yml
通过以上步骤,用户可以轻松地配置和使用Google Cloud Pricing Cost Calculator项目来计算Google Cloud Platform产品的预计月度成本。