我已经检查了支持的gcp类型和支持的资源类型,但我认为没有任何可能性
Deployment Manager支持PostgreSQL。
您需要指定backendType
为SECOND_GEN
,databaseVersion
为POSTGRES_9_6
,tier
为db-custom-1-3840
。
文档
示例(创建postgresql实例.jinja(:
{% set deployment_name = env['deployment'] %}
{% set instance_name = deployment_name + '-instance' %}
{% set database_name = deployment_name + '-db' %}
{% set region = 'us-central1' %}
{% set tier = 'db-custom-1-3840' %}
resources:
- name: {{ instance_name }}
type: gcp-types/sqladmin-v1beta4:instances
properties:
region: {{ region }}
backendType: SECOND_GEN
databaseVersion: POSTGRES_9_6
settings:
tier: {{ tier }}
backupConfiguration:
enabled: true
- name: {{ database_name }}
type: gcp-types/sqladmin-v1beta4:databases
properties:
name: {{ database_name }}
instance: $(ref.{{ instance_name }}.name)
charset: utf8
部署:
gcloud deployment-manager deployments create mydb --template create-postgresql-instance.jinja
PostgresSQL 部署管理器Jinja模板
{% set deployment_name = env['deployment'] %}
{% set instance_name = deployment_name + '-instance' %}
{% set database_name = deployment_name + '-db' %}
{% set region = 'us-central1' %}
{% set tier = 'db-n1-standard-1' %}
{% set databaseVersion = 'POSTGRES_11' %}
resources:
- name: {{ instance_name }}
type: gcp-types/sqladmin-v1beta4:instances
properties:
region: us-central1
databaseVersion: POSTGRES_9_6
instanceType: CLOUD_SQL_INSTANCE
settings:
tier: db-f1-micro
backupConfiguration:
startTime: '02:00'
enabled: true
locationPreference:
zone: us-central1-c
- name: {{ database_name }}
type: gcp-types/sqladmin-v1beta4:databases
properties:
name: {{ database_name }}
databaseVersion: POSTGRES_12
instance: $(ref.{{ instance_name }}.name)
charset: utf8