CreateService#

Description#

Request to create a PaaS service

Request Parameters#

Required parameters#

  • highAvailability — Indicates whether to start an high-availability service.

    • Type: Boolean

    • Required: Yes

  • instanceType — The type of instance.

    • Type: String

    • Required: Yes

  • name — The service name.

    • Type: String

    • Required: Yes

  • parameters — PaaS service parameters.

    • Type: Dict

    • Required: Yes

    • Valid values: Depend on service type (see PaaS Parameters)

  • rootVolumeType — The type of instance boot volume.

    • Type: String

    • Required: Yes

    • Valid values: st2 | gp2 | io2

  • rootVolumeSize — The size of the instance boot volume size, in GiB.

    • Type: Integer

    • Required: Yes

  • securityGroupIds — List of security group IDs.

    • Type: Array of strings

    • Required: Yes

  • serviceClass — The PaaS service class.

    • Type: String

    • Required: Yes

    • Valid values for a specifc service type:

      • mysql: database

      • pgsql: database

      • redis: database | cacher

      • memcached: cacher

      • mongodb: database

      • elasticsearch: search

      • rabbitmq: message_broker

  • serviceType — PaaS service type.

    • Type: String

    • Required: Yes

    • Valid values: mysql | pgsql | redis | memcached | mongodb | elasticsearch | rabbitmq

Optional parameters#

  • arbitratorRequired — Indicates whether to create a cluster with arbitrator.

    • Type: Boolean

    • Required: No

  • backupSettings — Backup settings.

  • dataVolumeIops — Number of read/write operations per second for data volume.

    • Type: Integer

    • Required: Yes, if the io2 type is specified for the data volume

  • dataVolumeSize — The size of of the data volume, in GiB.

    • Type: Integer

    • Required: No

  • dataVolumeType — The type of the data volume.

    • Type: String

    • Required: No

    • Valid values: st2 | gp2 | io2

  • networkInterfaceIds — List of network interface IDs.

    • Type: Array of strings

    • Required: Yes, if subnet ID list is not specified

  • rootVolumeIops — Number of read/write operations per second for the instance boot volume.

    • Type: Integer

    • Required: Yes, if io2 type is specified for the instance boot volume

  • sshKeyName — The name of the SSH key for accessing instances.

    • Type: String

    • Required: No

  • subnetIds — List of subnet IDs.

    • Type: Array of strings

    • Required: Yes, if network interface ID list is not specified

  • userData — User data.

    • Type: String

    • Required: Yes, if userDataContentType is specified

  • userDataContentType — The type of userData.

    • Type: String

    • Required: Yes, if userData is specified

    • Valid values: cloud-config | x-shellscript

Response Elements#

  • service — Detailed description of a service.

Examples#

Managing PaaS services in NGN Cloud via API requires a customized version of the boto3 library:

import boto3

session = boto3.Session(
   aws_access_key_id="<AWS_ACCESS_KEY_ID>",
   aws_secret_access_key="<AWS_SECRET_ACCESS_KEY>",
   region_name="ngn",
)

paas_client = session.client(
   'paas',
   endpoint_url='https://paas.cloud.ngn.com.tr/',
)

paas_client.create_service(
   name='production-database',
   serviceType='redis',
   serviceClass='database',
   subnetIds=['subnet-0A17D740'],
   securityGroupIds=['sg-F10FB1F3'],
   rootVolumeType='st2',
   rootVolumeSize=32,
   dataVolumeType='st2',
   dataVolumeSize=32
   instanceType='t1.large',
   parameters={
      'version': '6',
      'monitoring': False,
   },
   highAvailability=False,
)

Or c2-paas utility from CROC Cloud API Client software suite:

c2-paas CreateService name production-database serviceType redis serviceClass database subnetIds.1 subnet-0A17D740 securityGroupIds.1 sg-F10FB1F3 rootVolumeType st2 rootVolumeSize 32 dataVolumeType st2 dataVolumeSize 32 instanceType t1.large parameters.version 6 parameters.monitoring false highAvailability false