pulumi
Pulumi 是一个开源工具,用于配置和管理云基础架构和资源。
安装
https://www.pulumi.com/docs/iac/download-install/
pulumi 火山引擎使用
Pulumi 是一个开源工具,用于配置和管理云基础架构和资源。
火山引擎 详细参考
https://www.pulumi.com/registry/packages/volcengine
创建 postgres 使用 python 代码示例
初始化, 也可以手动 pip 安装 pulumi1
2
3
4
5
6
7
8mkdir volcengine && cd volcengine
pulumi new python
source venv/bin/activate
pip install pulumi-volcengine
pulumi config set volcengine:accessKey <your_secret_id> --secret
pulumi config set volcengine:secretKey <your_secret_key> --secret
pulumi config set volcengine:region cn-beijing # cn-shanghai
postgres
创建1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32import pulumi
import pulumi_volcengine as volcengine
foo_instance = volcengine.rds_postgresql.Instance("fooInstance",
db_engine_version="PostgreSQL_14",
node_spec="rds.postgres.1c2g",
primary_zone_id='cn-shanghai-a',
secondary_zone_id='cn-shanghai-a',
storage_space=40,
subnet_id='subnet-22jqp154rgum87r2qr1lfsh2i',
instance_name="test-1",
charge_info=volcengine.rds_postgresql.InstanceChargeInfoArgs(
charge_type="PostPaid",
),
project_name="default",
tags=[volcengine.rds_postgresql.InstanceTagArgs(
key="tfk1",
value="tfv1",
)],
parameters=[
volcengine.rds_postgresql.InstanceParameterArgs(
name="auto_explain.log_analyze",
value="off",
),
volcengine.rds_postgresql.InstanceParameterArgs(
name="auto_explain.log_format",
value="text",
),
])
pulumi.export('foo_instance', foo_instance) # 查看信息
创建1
pulumi up
查看已有实例信息
1 | import pulumi |
执行1
pulumi up
返回信息
1 | - postgres_instance_id: { |
删除
1 | pulumi destroy |
iam
1 | """火山引擎 IAM 用户和用户组管理模块 |