248 lines
11 KiB
Python
248 lines
11 KiB
Python
import os
|
|
from dotenv import load_dotenv
|
|
|
|
# 加载环境变量
|
|
load_dotenv()
|
|
|
|
# AWS EBS定价(GP3)
|
|
AWS_PRICING_EBS = {
|
|
"us-east-1": 0.08,
|
|
"us-east-2": 0.08,
|
|
"us-west-1": 0.096,
|
|
"us-west-2": 0.08,
|
|
"af-south-1": 0.1047,
|
|
"ap-east-1": 0.1056,
|
|
"ap-south-1": 0.0912,
|
|
"ap-northeast-3": 0.096,
|
|
"ap-northeast-2": 0.0912,
|
|
"ap-southeast-1": 0.096,
|
|
"ap-southeast-2": 0.096,
|
|
"ap-northeast-1": 0.096,
|
|
"ca-central-1": 0.088,
|
|
"eu-central-1": 0.0952,
|
|
"eu-west-1": 0.088,
|
|
"eu-west-2": 0.0928,
|
|
"eu-west-3": 0.0928,
|
|
"eu-north-1": 0.0836,
|
|
"me-central-1": 0.0968,
|
|
"sa-east-1": 0.152,
|
|
}
|
|
|
|
# 区域中文名称映射
|
|
AWS_REGION_NAMES = {
|
|
"af-south-1": "非洲 (开普敦)",
|
|
"ap-northeast-1": "亚太地区 (东京)",
|
|
"ap-northeast-2": "亚太地区 (首尔)",
|
|
"ap-northeast-3": "亚太地区 (大阪)",
|
|
"ap-east-1": "亚太地区 (香港)",
|
|
"ap-south-1": "亚太地区 (孟买)",
|
|
"ap-south-2": "亚太地区 (海得拉巴)",
|
|
"ap-southeast-1": "亚太地区 (新加坡)",
|
|
"ap-southeast-2": "亚太地区 (悉尼)",
|
|
"ap-southeast-3": "亚太地区 (雅加达)",
|
|
"ap-southeast-4": "亚太地区 (墨尔本)",
|
|
"ap-southeast-5": "亚太地区 (马来西亚)",
|
|
"ap-southeast-7": "亚太地区 (泰国)",
|
|
"ca-central-1": "加拿大 (中部)",
|
|
"ca-west-1": "加拿大西部 (卡尔加里)",
|
|
"eu-central-1": "欧洲 (法兰克福)",
|
|
"eu-central-2": "欧洲 (苏黎世)",
|
|
"eu-north-1": "欧洲 (斯德哥尔摩)",
|
|
"eu-south-1": "欧洲 (米兰)",
|
|
"eu-south-2": "欧洲 (西班牙)",
|
|
"eu-west-1": "欧洲 (爱尔兰)",
|
|
"eu-west-2": "欧洲 (伦敦)",
|
|
"eu-west-3": "欧洲 (巴黎)",
|
|
"il-central-1": "以色列 (特拉维夫)",
|
|
"me-central-1": "中东 (阿联酋)",
|
|
"me-south-1": "中东 (巴林)",
|
|
"mx-central-1": "墨西哥 (中部)",
|
|
"sa-east-1": "南美洲 (圣保罗)",
|
|
"us-east-1": "美国东部 (弗吉尼亚北部)",
|
|
"us-east-2": "美国东部 (俄亥俄)",
|
|
"us-east-2-mci-1": "美国东部 (堪萨斯城)",
|
|
"us-gov-east-1": "AWS GovCloud (美国东部)",
|
|
"us-gov-west-1": "AWS GovCloud (美国西部)",
|
|
"us-west-1": "美国西部 (加利福尼亚北部)",
|
|
"us-west-2": "美国西部 (俄勒冈)",
|
|
"ap-northeast-1-tpe-1": "亚太地区 (台湾)",
|
|
"ap-northeast-1-wl1-kix1": "亚太地区 (KDDI) - 大阪",
|
|
"ap-northeast-1-wl1-nrt1": "亚太地区 (KDDI) - 东京",
|
|
"ap-northeast-2-wl1-cjj1": "亚太地区 (SKT) - 大田",
|
|
"ap-northeast-2-wl1-sel1": "亚太地区 (SKT) - 首尔",
|
|
"ca-central-1-wl1-yto1": "加拿大 (BELL) - 多伦多",
|
|
"eu-central-1-wl1-ber1": "欧洲 (沃达丰) - 柏林",
|
|
"eu-central-1-wl1-dtm1": "欧洲 (沃达丰) - 多特蒙德",
|
|
"eu-central-1-wl1-muc1": "欧洲 (沃达丰) - 慕尼黑",
|
|
"eu-west-2-wl1-lon1": "欧洲 (沃达丰) - 伦敦",
|
|
"eu-west-2-wl1-man1": "欧洲 (沃达丰) - 曼彻斯特",
|
|
"eu-west-2-wl2-man1": "欧洲 (英国电信) - 曼彻斯特",
|
|
"eu-west-3-wl1-cmn1": "摩洛哥 (卡萨布兰卡)",
|
|
"us-east-1-wl1": "美国东部 (Verizon) - 波士顿",
|
|
"us-east-1-wl1-atl1": "美国东部 (Verizon) - 亚特兰大",
|
|
"us-east-1-wl1-bna1": "美国东部 (Verizon) - 纳什维尔",
|
|
"us-east-1-wl1-chi1": "美国东部 (Verizon) - 芝加哥",
|
|
"us-east-1-wl1-clt1": "美国东部 (Verizon) - 夏洛特",
|
|
"us-east-1-wl1-dfw1": "美国东部 (Verizon) - 达拉斯",
|
|
"us-east-1-wl1-dtw1": "美国东部 (Verizon) - 底特律",
|
|
"us-east-1-wl1-iah1": "美国东部 (Verizon) - 休斯顿",
|
|
"us-east-1-wl1-mia1": "美国东部 (Verizon) - 迈阿密",
|
|
"us-east-1-wl1-msp1": "美国东部 (Verizon) - 明尼阿波利斯",
|
|
"us-east-1-wl1-nyc1": "美国东部 (Verizon) - 纽约",
|
|
"us-east-1-wl1-tpa1": "美国东部 (Verizon) - 坦帕",
|
|
"us-east-1-wl1-was1": "美国东部 (Verizon) - 华盛顿特区",
|
|
"us-west-2-wl1": "美国西部 (Verizon) - 旧金山湾区",
|
|
"us-west-2-wl1-den1": "美国西部 (Verizon) - 丹佛",
|
|
"us-west-2-wl1-las1": "美国西部 (Verizon) - 拉斯维加斯",
|
|
"us-west-2-wl1-lax1": "美国西部 (Verizon) - 洛杉矶",
|
|
"us-west-2-wl1-phx1": "美国西部 (Verizon) - 凤凰城",
|
|
"us-west-2-wl1-sea1": "美国西部 (Verizon) - 西雅图",
|
|
"af-south-1-los-1": "尼日利亚 (拉各斯)",
|
|
"ap-south-1-ccu-1": "印度 (加尔各答)",
|
|
"ap-south-1-del-1": "印度 (德里)",
|
|
"ap-southeast-1-bkk-1": "泰国 (曼谷)",
|
|
"ap-southeast-1-mnl-1": "菲律宾 (马尼拉)",
|
|
"ap-southeast-2-akl-1": "新西兰 (奥克兰)",
|
|
"ap-southeast-2-per-1": "澳大利亚 (珀斯)",
|
|
"eu-central-1-ham-1": "德国 (汉堡)",
|
|
"eu-central-1-waw-1": "波兰 (华沙)",
|
|
"eu-north-1-cph-1": "丹麦 (哥本哈根)",
|
|
"eu-north-1-hel-1": "芬兰 (赫尔辛基)",
|
|
"me-south-1-mct-1": "阿曼 (马斯喀特)",
|
|
"us-east-1-atl-1": "美国东部 (亚特兰大)",
|
|
"us-east-1-bos-1": "美国东部 (波士顿)",
|
|
"us-east-1-bue-1": "阿根廷 (布宜诺斯艾利斯)",
|
|
"us-east-1-chi-1": "美国东部 (芝加哥)",
|
|
"us-east-1-dfw-1": "美国东部 (达拉斯)",
|
|
"us-east-1-iah-1": "美国东部 (休斯顿)",
|
|
"us-east-1-lim-1": "秘鲁 (利马)",
|
|
"us-east-1-mci-1": "美国东部 (堪萨斯城 2)",
|
|
"us-east-1-mia-1": "美国东部 (迈阿密)",
|
|
"us-east-1-msp-1": "美国东部 (明尼阿波利斯)",
|
|
"us-east-1-nyc-1": "美国东部 (纽约市)",
|
|
"us-east-1-phl-1": "美国东部 (费城)",
|
|
"us-east-1-qro-1": "墨西哥 (克雷塔罗)",
|
|
"us-east-1-scl-1": "智利 (圣地亚哥)",
|
|
"us-west-2-den-1": "美国西部 (丹佛)",
|
|
"us-west-2-hnl-1": "美国西部 (火奴鲁鲁)",
|
|
"us-west-2-las-1": "美国西部 (拉斯维加斯)",
|
|
"us-west-2-lax-1": "美国西部 (洛杉矶)",
|
|
"us-west-2-pdx-1": "美国西部 (波特兰)",
|
|
"us-west-2-phx-1": "美国西部 (凤凰城)",
|
|
"us-west-2-sea-1": "美国西部 (西雅图)"
|
|
}
|
|
|
|
|
|
AWS_REGION_NAMES_EN = {
|
|
"af-south-1": "Africa (Cape Town)",
|
|
"ap-northeast-1": "Asia Pacific (Tokyo)",
|
|
"ap-northeast-2": "Asia Pacific (Seoul)",
|
|
"ap-northeast-3": "Asia Pacific (Osaka)",
|
|
"ap-south-1": "Asia Pacific (Mumbai)",
|
|
"ap-east-1": "Asia Pacific (Hong Kong)",
|
|
"ap-south-2": "Asia Pacific (Hyderabad)",
|
|
"ap-southeast-1": "Asia Pacific (Singapore)",
|
|
"ap-southeast-2": "Asia Pacific (Sydney)",
|
|
"ap-southeast-3": "Asia Pacific (Jakarta)",
|
|
"ap-southeast-4": "Asia Pacific (Melbourne)",
|
|
"ap-southeast-5": "Asia Pacific (Malaysia)",
|
|
"ap-southeast-7": "Asia Pacific (Thailand)",
|
|
"ca-central-1": "Canada (Central)",
|
|
"ca-west-1": "Canada West (Calgary)",
|
|
"eu-central-1": "EU (Frankfurt)",
|
|
"eu-central-2": "EU (Zurich)",
|
|
"eu-north-1": "EU (Stockholm)",
|
|
"eu-south-1": "EU (Milan)",
|
|
"eu-south-2": "EU (Spain)",
|
|
"eu-west-1": "EU (Ireland)",
|
|
"eu-west-2": "EU (London)",
|
|
"eu-west-3": "EU (Paris)",
|
|
"il-central-1": "Israel (Tel Aviv)",
|
|
"me-central-1": "Middle East (UAE)",
|
|
"me-south-1": "Middle East (Bahrain)",
|
|
"mx-central-1": "Mexico (Central)",
|
|
"sa-east-1": "South America (Sao Paulo)",
|
|
"us-east-1": "US East (N. Virginia)",
|
|
"us-east-2": "US East (Ohio)",
|
|
"us-east-2-mci-1": "US East (Kansas City)",
|
|
"us-gov-east-1": "AWS GovCloud (US-East)",
|
|
"us-gov-west-1": "AWS GovCloud (US)",
|
|
"us-west-1": "US West (N. California)",
|
|
"us-west-2": "US West (Oregon)",
|
|
"ap-northeast-1-wl1-kix1": "Asia Pacific (KDDI) - Osaka",
|
|
"ap-northeast-1-wl1-nrt1": "Asia Pacific (KDDI) - Tokyo",
|
|
"ap-northeast-2-wl1-cjj1": "Asia Pacific (SKT) - Daejeon",
|
|
"ap-northeast-2-wl1-sel1": "Asia Pacific (SKT) - Seoul",
|
|
"ap-northeast-1-tpe-1": "Asia Pacific (Taiwan)",
|
|
"ca-central-1-wl1-yto1": "Canada (BELL) - Toronto",
|
|
"eu-central-1-wl1-ber1": "EU (Vodafone) - Berlin",
|
|
"eu-central-1-wl1-dtm1": "EU (Vodafone) - Dortmund",
|
|
"eu-central-1-wl1-muc1": "EU (Vodafone) - Munich",
|
|
"eu-west-2-wl1-lon1": "EU (Vodafone) - London",
|
|
"eu-west-2-wl1-man1": "EU (Vodafone) - Manchester",
|
|
"eu-west-2-wl2-man1": "EU (British Telecom) - Manchester",
|
|
"eu-west-3-wl1-cmn1": "Morocco (Casablanca)",
|
|
"us-east-1-wl1": "US East (Verizon) - Boston",
|
|
"us-east-1-wl1-atl1": "US East (Verizon) - Atlanta",
|
|
"us-east-1-wl1-bna1": "US East (Verizon) - Nashville",
|
|
"us-east-1-wl1-chi1": "US East (Verizon) - Chicago",
|
|
"us-east-1-wl1-clt1": "US East (Verizon) - Charlotte",
|
|
"us-east-1-wl1-dfw1": "US East (Verizon) - Dallas",
|
|
"us-east-1-wl1-dtw1": "US East (Verizon) - Detroit",
|
|
"us-east-1-wl1-iah1": "US East (Verizon) - Houston",
|
|
"us-east-1-wl1-mia1": "US East (Verizon) - Miami",
|
|
"us-east-1-wl1-msp1": "US East (Verizon) - Minneapolis",
|
|
"us-east-1-wl1-nyc1": "US East (Verizon) - New York",
|
|
"us-east-1-wl1-tpa1": "US East (Verizon) - Tampa",
|
|
"us-east-1-wl1-was1": "US East (Verizon) - Washington DC",
|
|
"us-west-2-wl1": "US West (Verizon) - San Francisco Bay Area",
|
|
"us-west-2-wl1-den1": "US West (Verizon) - Denver",
|
|
"us-west-2-wl1-las1": "US West (Verizon) - Las Vegas",
|
|
"us-west-2-wl1-lax1": "US West (Verizon) - Los Angeles",
|
|
"us-west-2-wl1-phx1": "US West (Verizon) - Phoenix",
|
|
"us-west-2-wl1-sea1": "US West (Verizon) - Seattle",
|
|
"af-south-1-los-1": "Nigeria (Lagos)",
|
|
"ap-south-1-ccu-1": "India (Kolkata)",
|
|
"ap-south-1-del-1": "India (Delhi)",
|
|
"ap-southeast-1-bkk-1": "Thailand (Bangkok)",
|
|
"ap-southeast-1-mnl-1": "Philippines (Manila)",
|
|
"ap-southeast-2-akl-1": "New Zealand (Auckland)",
|
|
"ap-southeast-2-per-1": "Australia (Perth)",
|
|
"eu-central-1-ham-1": "Germany (Hamburg)",
|
|
"eu-central-1-waw-1": "Poland (Warsaw)",
|
|
"eu-north-1-cph-1": "Denmark (Copenhagen)",
|
|
"eu-north-1-hel-1": "Finland (Helsinki)",
|
|
"me-south-1-mct-1": "Oman (Muscat)",
|
|
"us-east-1-atl-1": "US East (Atlanta)",
|
|
"us-east-1-bos-1": "US East (Boston)",
|
|
"us-east-1-bue-1": "Argentina (Buenos Aires)",
|
|
"us-east-1-chi-1": "US East (Chicago)",
|
|
"us-east-1-dfw-1": "US East (Dallas)",
|
|
"us-east-1-iah-1": "US East (Houston)",
|
|
"us-east-1-lim-1": "Peru (Lima)",
|
|
"us-east-1-mci-1": "US East (Kansas City 2)",
|
|
"us-east-1-mia-1": "US East (Miami)",
|
|
"us-east-1-msp-1": "US East (Minneapolis)",
|
|
"us-east-1-nyc-1": "US East (New York City)",
|
|
"us-east-1-phl-1": "US East (Philadelphia)",
|
|
"us-east-1-qro-1": "Mexico (Queretaro)",
|
|
"us-east-1-scl-1": "Chile (Santiago)",
|
|
"us-west-2-den-1": "US West (Denver)",
|
|
"us-west-2-hnl-1": "US West (Honolulu)",
|
|
"us-west-2-las-1": "US West (Las Vegas)",
|
|
"us-west-2-lax-1": "US West (Los Angeles)",
|
|
"us-west-2-pdx-1": "US West (Portland)",
|
|
"us-west-2-phx-1": "US West (Phoenix)",
|
|
"us-west-2-sea-1": "US West (Seattle)"
|
|
}
|
|
# 可以添加其他云平台的配置
|
|
AZURE_REGION_NAMES = {
|
|
# 待添加Azure区域
|
|
}
|
|
|
|
ALIYUN_REGION_NAMES = {
|
|
# 待添加阿里云区域
|
|
}
|
|
|
|
# 支持的平台列表
|
|
SUPPORTED_PLATFORMS = ["aws", "azure", "aliyun"] |