aws定价的sdk
awspricing的Python项目详细描述
一个python库,用于使用'aws价目表查询api<;https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/pricing.html>;`.
` awspricing`使用boto3价目表查询api。
这需要价目表查询api iam角色:https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/billing-permissions-ref.html;示例策略pe api
2.0.0之前的版本使用aws价目表文件。
功能:
*特定于服务的帮助程序(因此仅限ec2和rds)far)
*本地缓存支持
代码块::sh
$pip安装一个spricing
用法
----
…代码块:python'mdkvajxmjgzfdjue'}
ec2_offer.reserved_hourly(
'c4.xlarge',
Operating_System='Linux',
Lease_Contract_Length='3YR',
Offering_class='Convertible',
Purchase_option='Partial Upfront',
region='us-east-1'
)0.10845205479452055
rds\u offer=awspricing.offer('amazonrds')
instance\u type='db.m4.large',
location='us east(n.virginia)”,
database\u engine='mysql',
license\u model='no license required',
多方位部署
{qpznr6myn432xtpu'}
rds-offer.ondemand每小时(
'db.m4.large',
'mysql',
license-model='no-license-mand'u每小时(
'db.m4.large',
多方位部署,
region='us-east-1'
0.35
<>
<>
<>
/>注**:aws提供了多方位部署的服务,aws定价表JSON格式,不保证格式更改。如果AWS的格式更改导致中断更改,则可以以“过时”定价为代价使用以下缓解措施。
…代码块::python
version='some廑other廑version')
要查找rds价目表版本,请参阅下面的脚本或下载https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/amazonrds/index.json
rds廑offer=awspricing.offer('amazonrds',version='some廑other廑version')
代码块::sh
$ec2
$curl https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/amazonec2/index.json python-m json.tool
$rds
$curl https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/amazonrds/index.json python-mjson.tool
配置
----
cache
~~~
>缓存可以通过以下环境变量配置:
``awspricing\u use\u cache``:是否使用简单的基于文件的缓存。有效值为“0 1”。默认值为“0”(false)。
``awspricing_cache路径`:写入缓存文件的前缀。默认为`/tmp/awspricing``。
``awspricing_cache_minutes``:保留缓存的分钟数。默认为“1440”(1天)。
代码块::sh
python setup.py develop
pip install-r test requirements.txt
命令可用于运行类型检查。注意,mypy需要一个``python3`
解释器。代码块:sh
pip install mypy
make test\u mypy
` awspricing`使用boto3价目表查询api。
这需要价目表查询api iam角色:https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/billing-permissions-ref.html;示例策略pe api
2.0.0之前的版本使用aws价目表文件。
功能:
*特定于服务的帮助程序(因此仅限ec2和rds)far)
*本地缓存支持
代码块::sh
$pip安装一个spricing
用法
----
…代码块:python'mdkvajxmjgzfdjue'}
ec2_offer.reserved_hourly(
'c4.xlarge',
Operating_System='Linux',
Lease_Contract_Length='3YR',
Offering_class='Convertible',
Purchase_option='Partial Upfront',
region='us-east-1'
)0.10845205479452055
rds\u offer=awspricing.offer('amazonrds')
location='us east(n.virginia)”,
database\u engine='mysql',
license\u model='no license required',
多方位部署
{qpznr6myn432xtpu'}
rds-offer.ondemand每小时(
'db.m4.large',
'mysql',
license-model='no-license-mand'u每小时(
'db.m4.large',
多方位部署,
region='us-east-1'
0.35
<>
<>
<>
/>注**:aws提供了多方位部署的服务,aws定价表JSON格式,不保证格式更改。如果AWS的格式更改导致中断更改,则可以以“过时”定价为代价使用以下缓解措施。
…代码块::python
version='some廑other廑version')
要查找rds价目表版本,请参阅下面的脚本或下载https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/amazonrds/index.json
rds廑offer=awspricing.offer('amazonrds',version='some廑other廑version')
代码块::sh
$ec2
$curl https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/amazonec2/index.json python-m json.tool
$rds
$curl https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/amazonrds/index.json python-mjson.tool
配置
----
cache
~~~
>缓存可以通过以下环境变量配置:
``awspricing\u use\u cache``:是否使用简单的基于文件的缓存。有效值为“0 1”。默认值为“0”(false)。
``awspricing_cache路径`:写入缓存文件的前缀。默认为`/tmp/awspricing``。
``awspricing_cache_minutes``:保留缓存的分钟数。默认为“1440”(1天)。
代码块::sh
python setup.py develop
pip install-r test requirements.txt
命令可用于运行类型检查。注意,mypy需要一个``python3`
解释器。代码块:sh
pip install mypy
make test\u mypy