createCloudMysqlInstance

Prev Next

VPC環境で利用できます。

Cloud DB for MySQLインスタンスを作成します。

リクエスト

リクエスト形式を説明します。リクエスト形式は次の通りです。

メソッド URI
GET, POST /createCloudMysqlInstance

リクエストヘッダ

Cloud DB for MySQL (VPC) APIで共通して使用されるヘッダの詳細は、Cloud DB for MySQL (VPC)のリクエストヘッダをご参照ください。

リクエストパラメータ

パラメータの説明は次の通りです。

フィールド タイプ 必須の有無 説明
regionCode String Optional リージョンコード
  • 作成対象の Cloud DB for MySQLインスタンスのリージョンコード
  • getRegionListを通じて確認
  • getRegionList照会結果の最初のリージョン(デフォルト)
vpcNo String Required Cloud DB for MySQLインスタンス作成対象の VPC番号
cloudMysqlImageProductCode String Optional Cloud DB for MySQLイメージ商品コード
cloudMysqlProductCode String Optional Cloud DB for MySQL商品コード
  • 作成対象の Cloud DB for MySQLインスタンスのサーバスペックを決める
  • getCloudMysqlProductListを通じて確認
  • 最小スペック(デフォルト)
  • 最小スペックの基準: 1. メモリ 2. CPUの順で決める
dataStorageTypeCode String Optional データストレージタイプコード
  • インストール後、データストレージタイプは変更不可
  • SSD | HDD | CB2
  • cloudMysqlImageProductCodeの generationCodeに応じてデフォルト値が異なる
    • G2の場合: SSD
    • G3の場合: CB2
isHa Boolean Optional 高可用性の有無
  • true(デフォルト) | false
  • true(高可用性を選択)の場合、Standby Masterサーバを含めて2台のサーバが作成され、追加料金が発生
  • falseの場合、isMultiZonestandbyMasterSubnetNoパラメータは使用されない
isMultiZone Boolean Conditional Multi Zoneかどうか
  • true | false(デフォルト)
  • 高可用性の有無(isHa)がtrueの場合、必ず入力
  • trueの場合、Masterサーバと Standby Masterサーバを異なるゾーンに作成してより高い可用性を提供
isStorageEncryption Boolean Optional データストレージ暗号化の適用有無(今後適用)
  • true | false(デフォルト)
  • 高可用性の有無(isHa)がtrueの場合にのみ暗号化を適用可能
  • 暗号化を適用すると、DBデータは暗号化されストレージに保存
  • Cloud DB for MySQLインスタンスの作成後、ストレージ暗号化の設定は変更不可
isBackup Boolean Optional MySQLのバックアップ設定の有無
  • true(デフォルト) | false
  • 高可用性の有無(isHa)がtrueの場合、バックアップの有無(isBackup)はtrueに固定される
backupFileRetentionPeriod Integer Optional バックアップファイルの保管期間(日)
  • 1(デフォルト)
  • InnoDBエンジンで作成されたテーブルのみバックアップをサポート
  • バックアップは毎日行われ、バックアップファイルは別途ストレージに保存
backupTime String Conditional バックアップ時点を設定
  • true(デフォルト) | false
  • バックアップの有無(isBackup)がtrue、バックアップ時間自動設定の有無(isAutomaticBackup)がfalseの場合、必ず入力
  • <例>01:15(選択した時間 + 15分の間に Backupが開始)
isAutomaticBackup Boolean Optional バックアップ時点を自動設定するかどうか
  • true(デフォルト) | false
  • 設定値がtrueの場合、backupTimeは入力不可
cloudMysqlServiceName String Required 作成する Cloud DB for MySQLサービス名
  • 英数字、ハングル、記号の「-」のみ使用して3~30文字以内で入力
cloudMysqlServerNamePrefix String Required 作成する Cloud DB for MySQLサーバ名の接頭辞
  • 英数字、記号の「-」を使用して3~20文字以内で入力、先頭文字は英字に、末尾文字は英字または数字にする
  • 接頭辞の末尾に3桁の数字が自動で付き、ホスト名の重複防止のために任意のテキストが追加され作成される
  • <例> 接頭辞が test-123の場合: test-123-001-4y1v
cloudMysqlUserName String Required DB Userアカウント ID
  • 英数字、記号の「-」、「_」を使用して4~16文字以内で入力、先頭文字は英字にする
  • あらかじめ定義した予約語は使用不可
cloudMysqlUserPassword String Required DB Userアカウントパスワード
  • 英数字、記号をそれぞれ1文字以上含めて8~20文字以内で入力
  • 記号の「` & + \ " ' /」とスペースは使用不可
  • Password pluginが有効になっている状態では、プラグインで設定したポリシーにも従わなければならない
hostIp String Required MySQL Serverにアクセスする IPアドレス
  • すべてのアクセスを許可: %
  • 特定の IPアドレスからのアクセスを許可: <例> 1.1.1.1
  • IPアドレス帯域からのアクセスを許可: <例> 1.1.1.%
  • CIDRを許可: <例> 1.1.1.0/24
  • GETメソッド使用時、%は%25に URLエンコードが必要
cloudMysqlPort Integer Optional Cloud DB for MySQLインスタンスアクセス用 TCPポート番号
  • 3306(デフォルト)
  • 指定範囲: 10000~20000
  • 一度指定したポート番号は変更不可
cloudMysqlDatabaseName String Required Cloud DB for MySQLインスタンスにデフォルトで作成する DB名
  • 英数字、記号の「\ _ , -」を使用して1~30文字以内で入力、先頭文字は英字にする
subnetNo String Required Cloud DB for MySQLインスタンスで使用するデフォルトのネットワークインターフェースの Subnet番号
  • getCloudMysqlTargetSubnetListを通じて確認
  • Publicドメインは、Public Subnetに作成された DBサーバでのみ申し込み可能
  • Cloud DB for MySQLインスタンス作成後に Subnetの移転はできない
standbyMasterSubnetNo String Conditional Standby Masterサーバの Subnet番号
  • Multi Zoneの Cloud DB for MySQLの場合、必ず入力
  • Masterサーバの Subnetとは Zoneが異なるように、Publicまたは Privateは同じようにする
  • getCloudMysqlTargetSubnetListを通じて確認
isPrivateSubDomain Boolean Optional Private Subドメインの使用有無
  • true | false
  • 設定値がtrueの場合、privateSubDomainPrefixを指定可能
privateSubDomainPrefix String Conditional Privateドメインに追加する Subドメインを入力
  • 英数字、記号の「-」のみ使用して3~15文字以内で入力、先頭文字は英字、末尾文字は英字または数字のみ使用可能
  • Private Subドメインの使用有無(isPrivateSubDomain)がtrueの場合、必須
  • Slaveや Recoveryの追加時にも同じ Subドメインポリシーが追加される
engineVersionCode String Conditional DBエンジンのバージョン
isDeleteProtection Boolean Optional クラスタ返却保護するかどうか
  • true | false(デフォルト)
    • true: クラスタ返却不可
    • false: クラスタ返却可能
responseFormatType String Optional レスポンス結果の形式
  • xml(デフォルト) | json

リクエスト例

リクエストのサンプルコードは次の通りです。

curl --location --request GET 'https://ncloud.apigw.ntruss.com/vmysql/v2/createCloudMysqlInstance
?regionCode=KR
&vpcNo=****83
&cloudMysqlImageProductCode=SW.VDBAS.DBAAS.LNX64.CNTOS.0708.MYSQL.8025.B050
&cloudMysqlProductCode=SVR.VDBAS.STAND.C002.M008.NET.HDD.B050.G002
&dataStorageTypeCode=SSD
&isHa=true
&isMultiZone=true
&isStorageEncryption=true
&isBackup=true
&backupFileRetentionPeriod=10
&backupTime=02:00
&isAutomaticBackup=false
&cloudMysqlServiceName=test-****
&cloudMysqlServerNamePrefix=test-****
&cloudMysqlUserName=test-****
&cloudMysqlUserPassword=********
&hostIp=192.168.0.%
&cloudMysqlPort=13306
&cloudMysqlDatabaseName=test-****
&subnetNo=****91
&standbyMasterSubnetNo=****93'
--header 'x-ncp-apigw-timestamp: {Timestamp}' 
--header 'x-ncp-iam-access-key: {Access Key}' 
--header 'x-ncp-apigw-signature-v2: {API Gateway Signature}'

レスポンス

レスポンス形式を説明します。

レスポンスボディ

レスポンスボディの詳細は、CloudMysqlInstanceListをご参照ください。

レスポンスステータスコード

NAVERクラウドプラットフォームで共通して使用されるレスポンスステータスコードの詳細は、Ncloud APIのレスポンスステータスコードをご参照ください。

レスポンス例

レスポンスのサンプルコードは次の通りです。

  • responseFormatType=jsonの場合
{
    "createCloudMysqlInstanceResponse": {
        "totalRows": 1,
        "cloudMysqlInstanceList": [
            {
                "cloudMysqlInstanceNo": "****890",
                "cloudMysqlServiceName": "test-****",
                "cloudMysqlInstanceStatusName": "creating",
                "cloudMysqlInstanceStatus": {
                    "code": "INIT",
                    "codeName": "CLOUD DATABASE(VPC) Init State"
                },
                "cloudMysqlInstanceOperation": {
                    "code": "CREAT",
                    "codeName": "CLOUD DATABASE(VPC) Creat OP"
                },
                "cloudMysqlImageProductCode": "SW.VDBAS.DBAAS.LNX64.CNTOS.0708.MYSQL.8025.B050",
                "engineVersion": "MYSQL8.0.25",
                "license": {
                    "code": "GPL",
                    "codeName": "General Public License"
                },
                "cloudMysqlPort": 13306,
                "isHa": true,
                "isMultiZone": true,
                "isBackup": true,
                "backupFileRetentionPeriod": 10,
                "backupTime": "02:00",
                "generationCode": "G2",
                "createDate": "2024-05-23T11:25:09+0900",
                "accessControlGroupNoList": [],
                "cloudMysqlConfigList": [],
                "cloudMysqlServerInstanceList": [
                    {
                        "cloudMysqlServerName": "test-****-001-e04",
                        "cloudMysqlServerRole": {
                            "code": "M",
                            "codeName": "Master"
                        },
                        "cloudMysqlServerInstanceStatusName": "creating",
                        "cloudMysqlServerInstanceStatus": {
                            "code": "PEND",
                            "codeName": "CLOUD DATABASE(VPC) Server Pending State"
                        },
                        "cloudMysqlServerInstanceOperation": {
                            "code": "CREAT",
                            "codeName": "CLOUD DATABASE(VPC) Server Create OP"
                        },
                        "cloudMysqlProductCode": "SVR.VDBAS.STAND.C002.M008.NET.HDD.B050.G002",
                        "regionCode": "KR",
                        "zoneCode": "KR-1",
                        "vpcNo": "****83",
                        "subnetNo": "****91",
                        "isPublicSubnet": true,
                        "dataStorageType": {
                            "code": "SSD",
                            "codeName": "SSD"
                        },
                        "isStorageEncryption": true,
                        "dataStorageSize": 10737418240,
                        "cpuCount": 2,
                        "memorySize": 8589934592,
                        "createDate": "2024-05-23T11:25:09+0900"
                    },
                    {
                        "cloudMysqlServerName": "test-****-002-e05",
                        "cloudMysqlServerRole": {
                            "code": "H",
                            "codeName": "Standby Master"
                        },
                        "cloudMysqlServerInstanceStatusName": "creating",
                        "cloudMysqlServerInstanceStatus": {
                            "code": "PEND",
                            "codeName": "CLOUD DATABASE(VPC) Server Pending State"
                        },
                        "cloudMysqlServerInstanceOperation": {
                            "code": "CREAT",
                            "codeName": "CLOUD DATABASE(VPC) Server Create OP"
                        },
                        "cloudMysqlProductCode": "SVR.VDBAS.STAND.C002.M008.NET.HDD.B050.G002",
                        "regionCode": "KR",
                        "zoneCode": "KR-2",
                        "vpcNo": "****83",
                        "subnetNo": "****93",
                        "isPublicSubnet": true,
                        "dataStorageType": {
                            "code": "SSD",
                            "codeName": "SSD"
                        },
                        "isStorageEncryption": true,
                        "dataStorageSize": 10737418240,
                        "cpuCount": 2,
                        "memorySize": 8589934592,
                        "createDate": "2024-05-23T11:25:09+0900"
                    }
                ]
            }
        ],
        "requestId": "a3d093cf-****-****-****-394da22ea7f8",
        "returnCode": "0",
        "returnMessage": "success"
    }
}
  • responseFormatType=xml(デフォルト)の場合
<?xml version="1.0" encoding="UTF-8"?>
<createCloudMysqlInstanceResponse>
  <requestId>a3d093cf-****-****-****-394da22ea7f8</requestId>
  <returnCode>0</returnCode>
  <returnMessage>success</returnMessage>
  <totalRows>1</totalRows>
  <cloudMysqlInstanceList>
    <cloudMysqlInstance>
      <cloudMysqlInstanceNo>****890</cloudMysqlInstanceNo>
      <cloudMysqlServiceName>test-****</cloudMysqlServiceName>
      <cloudMysqlInstanceStatusName>creating</cloudMysqlInstanceStatusName>
      <cloudMysqlInstanceStatus>
        <code>INIT</code>
        <codeName>CLOUD DATABASE(VPC) Init State</codeName>
      </cloudMysqlInstanceStatus>
      <cloudMysqlInstanceOperation>
        <code>CREAT</code>
        <codeName>CLOUD DATABASE(VPC) Creat OP</codeName>
      </cloudMysqlInstanceOperation>
      <cloudMysqlImageProductCode>SW.VDBAS.DBAAS.LNX64.CNTOS.0708.MYSQL.8025.B050</cloudMysqlImageProductCode>
      <engineVersion>MYSQL8.0.25</engineVersion>
      <license>
        <code>GPL</code>
        <codeName>General Public License</codeName>
      </license>
      <cloudMysqlPort>13306</cloudMysqlPort>
      <isHa>true</isHa>
      <isMultiZone>true</isMultiZone>
      <isBackup>true</isBackup>
      <backupFileRetentionPeriod>10</backupFileRetentionPeriod>
      <backupTime>02:00</backupTime>
      <generationCode>G2</generationCode>
      <createDate>2024-05-23T11:25:09+0900</createDate>
      <accessControlGroupNoList />
      <cloudMysqlConfigList />
      <cloudMysqlServerInstanceList>
        <cloudMysqlServerInstance>
          <cloudMysqlServerName>test-****-001-4y1v</cloudMysqlServerName>
          <cloudMysqlServerRole>
            <code>M</code>
            <codeName>Master</codeName>
          </cloudMysqlServerRole>
          <cloudMysqlServerInstanceStatusName>creating</cloudMysqlServerInstanceStatusName>
          <cloudMysqlServerInstanceStatus>
            <code>PEND</code>
            <codeName>CLOUD DATABASE(VPC) Server Pending State</codeName>
          </cloudMysqlServerInstanceStatus>
          <cloudMysqlServerInstanceOperation>
            <code>CREAT</code>
            <codeName>CLOUD DATABASE(VPC) Server Create OP</codeName>
          </cloudMysqlServerInstanceOperation>
          <cloudMysqlProductCode>SVR.VDBAS.STAND.C002.M008.NET.HDD.B050.G002</cloudMysqlProductCode>
          <regionCode>KR</regionCode>
          <zoneCode>KR-1</zoneCode>
          <vpcNo>****83</vpcNo>
          <subnetNo>****91</subnetNo>
          <isPublicSubnet>true</isPublicSubnet>
          <dataStorageType>
            <code>SSD</code>
            <codeName>SSD</codeName>
          </dataStorageType>
          <isStorageEncryption>true</isStorageEncryption>
          <dataStorageSize>10737418240</dataStorageSize>
          <cpuCount>2</cpuCount>
          <memorySize>8589934592</memorySize>
          <createDate>2024-05-23T11:25:09+0900</createDate>
        </cloudMysqlServerInstance>
        <cloudMysqlServerInstance>
          <cloudMysqlServerName>test-****-002-e05</cloudMysqlServerName>
          <cloudMysqlServerRole>
            <code>H</code>
            <codeName>Standby Master</codeName>
          </cloudMysqlServerRole>
          <cloudMysqlServerInstanceStatusName>creating</cloudMysqlServerInstanceStatusName>
          <cloudMysqlServerInstanceStatus>
            <code>PEND</code>
            <codeName>CLOUD DATABASE(VPC) Server Pending State</codeName>
          </cloudMysqlServerInstanceStatus>
          <cloudMysqlServerInstanceOperation>
            <code>CREAT</code>
            <codeName>CLOUD DATABASE(VPC) Server Create OP</codeName>
          </cloudMysqlServerInstanceOperation>
          <cloudMysqlProductCode>SVR.VDBAS.STAND.C002.M008.NET.HDD.B050.G002</cloudMysqlProductCode>
          <regionCode>KR</regionCode>
          <zoneCode>KR-2</zoneCode>
          <vpcNo>****83</vpcNo>
          <subnetNo>****93</subnetNo>
          <isPublicSubnet>true</isPublicSubnet>
          <dataStorageType>
            <code>SSD</code>
            <codeName>SSD</codeName>
          </dataStorageType>
          <isStorageEncryption>true</isStorageEncryption>
          <dataStorageSize>10737418240</dataStorageSize>
          <cpuCount>2</cpuCount>
          <memorySize>8589934592</memorySize>
          <createDate>2024-05-23T11:25:09+0900</createDate>
        </cloudMysqlServerInstance>
      </cloudMysqlServerInstanceList>
    </cloudMysqlInstance>
  </cloudMysqlInstanceList>
</createCloudMysqlInstanceResponse>