开发者社区> CodeSample> 正文

创建一个云数据库实例

简介: 本文介绍如何使用Terraform创建一个云数据库实例。

前提条件

在开始之前,请您确保完成以下操作:

操作步骤

  1. 创建terraform.tf文件,输入以下内容,并保存在当前的执行目录中。
    说明 需要为每个Terraform项目创建一个独立的执行目录。
    resource "alicloud_db_instance" "instance" {
    engine = "MySQL"
    engine_version = "5.6"
    instance_type = "rds.mysql.t1.small"
    instance_storage = "10"
    }
  2. 运行terraform apply开始创建。出现类似下面的日志,说明创建成功。
    alicloud_db_instance.instance: Creating...
      connection_string:    "" => "<computed>"
      engine:               "" => "MySQL"
      engine_version:       "" => "5.6"
      instance_charge_type: "" => "Postpaid"
      instance_storage:     "" => "10"
      instance_type:        "" => "rds.mysql.t1.small"
      parameters.#:         "" => "<computed>"
      port:                 "" => "<computed>"
      security_ips.#:       "" => "<computed>"
      zone_id:              "" => "<computed>"
    alicloud_db_instance.instance: Still creating... (10s elapsed)
    alicloud_db_instance.instance: Still creating... (20s elapsed)
    alicloud_db_instance.instance: Still creating... (30s elapsed)
    alicloud_db_instance.instance: Still creating... (40s elapsed)
    alicloud_db_instance.instance: Still creating... (50s elapsed)
    alicloud_db_instance.instance: Creation complete after 54s (ID: rm-bp146322j394658x4)
分享:
若有任何问题或疑惑,请反馈给我们 立即提问
相关文档
阿里云数据库
使用钉钉扫一扫加入圈子
+ 订阅

让用户数据永远在线,让数据无缝的自由流动

官方博客
最新文章
相关文章
阿里云数据库产品