---
title: "Create Cluster"
method: POST
path: "/ocean/aws/k8s/cluster"
tags: ["Ocean AWS"]
---

# Create Cluster

`POST /ocean/aws/k8s/cluster`

**Prerequisites**

The Ocean Controller is used to monitor the cluster resources and report back to Ocean. The Ocean Controller is required for Ocean Cloud.<br />

To install the Ocean Controller, complete and run the following script on a machine with the kubectl command line tool installed and configured:

```
#!/usr/bin/env bash
curl -fsSL http://spotinst-public.s3.amazonaws.com/integrations/kubernetes/cluster-controller/scripts/init.sh | \
SPOTINST_TOKEN=<ENTER YOUR TOKEN HERE> \
SPOTINST_ACCOUNT=<ENTER YOUR SPOTINST ACCOUNT ID HERE> \
SPOTINST_CLUSTER_IDENTIFIER=<ENTER YOUR CLUSTER IDENTIFIER HERE> \
bash
```

## Parameters

- `#/paths/~1azure~1costs/get/parameters/0` — unresolved $ref

## Request body

- object
  - `cluster` object, required — The object specifying the configuration of the Ocean cluster.
    - `id` string — The Ocean cluster identifier.
    - `name` string, required — Add a name for the Ocean cluster.
    - `controllerClusterId` string, required — Enter the reporting identifier for the Ocean Controller.
    - `region` string, required — Select the region for the Ocean cluster to run in.
    - `autoScaler` object — The automatic scaling mechanism used in Ocean for Kubernetes.
      - `isEnabled` boolean — Enable the Ocean Kubernetes autoscaler.
      - `cooldown` integer — A period of time (in seconds) that Ocean waits from the end of a scaling action until starting another scaling action.
      - `resourceLimits` object — Option to set upper and lower bounds on the resource usage of the cluster.
        - `maxMemoryGib` integer — The maximum memory (in GiB) that can be allocated to the cluster.
        - `maxVCpu` integer — The maximum CPU (in vCPU units) that can be allocated to the cluster.
      - `down` object — Autoscaling scale down operations.
        - `evaluationPeriods` integer — Deprecated — no longer used.
        - `maxScaleDownPercentage` integer — Represents the maximum percent of your instances to scale down in a single scale-down action. Number between 1-100.
        - `aggressiveScaleDown` object — Enable and configure the Accelerated Scale Down feature to allow the Ocean autoscaler to immediately scale down eligible nodes without any waiting period.
          - `isEnabled` boolean — When set to 'true', Accelerated Scale Down is enabled.
      - `headroom` object — Spare resource capacity management enabling fast assignment of pods without waiting for new resources to launch.
        - `cpuPerUnit` integer — Option to configure the number of CPUs to allocate the headroom. CPUs are denoted in millicores, where 1000 millicores = 1 vCPU.
        - `memoryPerUnit` integer — Option to configure the amount of memory (MiB) to allocate the headroom.
        - `gpuPerUnit` integer — Amount of GPU to allocate for headroom.
        - `numOfUnits` integer — The number of units to retain as headroom, where each unit has the defined headroom CPU and memory.
      - `isAutoConfig` boolean — Use automatic headroom. When set to true, the values under cluster.autoScaler.headroom are not effective, as Ocean configures and optimizes headroom automatically.
      - `autoHeadroomPercentage` integer — Dynamic (automatic) buffer of spare capacity, i.e., vCPU, memory, and GPU resources. Expressed as a percent of the overall cluster capacity with valid values from 0-200. Optional. Relevant when isAutoConfig=true.
      - `enableAutomaticAndManualHeadroom` boolean — When set to true, both automatic and per-VNG manual headroom to be saved concurrently and independently in the cluster. prerequisite: isAutoConfig must be true
      - `extendedResourceDefinitions` string[] — List of Ocean extended resource definitions to use in this cluster.
    - `capacity` object — The overall capability of the Ocean cluster expressed as number of instances and specified with a minimum, a maximum, and a target number of running instances.
      - `minimum` integer — The lower limit of instances that the cluster can scale down to.
      - `maximum` integer — The upper limit of instances that the cluster can scale up to.
      - `target` integer — Number of instances to launch and maintain in the cluster.
    - `strategy` object — An object defining the cluster strategy with regard to waiting periods and utilization of on-demand and reserved instances.
      - `utilizeReservedInstances` boolean — If reserved instances exist, Ocean will utilize them before launching spot instances.
      - `fallbackToOd` boolean — If no spot instance markets are available, enable Ocean to launch on-demand instances instead.
      - `spotPercentage` integer — The desired percentage of Spot instances out of all running instances.\ Only available when the field is **not** set in any VNG directly (launchSpec.strategy.spotPercentage).
      - `maxReplacementLimitPercentage` integer — Limits the percentage of instances that can be replaced at once during a run cycle.
      - `gracePeriod` integer — The amount of time, in seconds, from the time the instance has launched to the time its first health check starts.
      - `drainingTimeout` integer — The configurable amount of time that Ocean will wait for the draining process to complete before terminating an instance. If you have not defined a draining timeout, the default of 300 seconds will be used.
      - `utilizeCommitments` boolean — If savings plans commitment has available capacity, Ocean will utilize them alongside RIs (if exist) to maximize cost efficiency.
      - `clusterOrientation` object
        - `availabilityVsCost` 'costOriented' | 'balanced' | 'cheapest' — You can control the approach that Ocean takes while launching nodes by configuring this value.
      - `spreadNodesBy` 'vcpu' | 'count' — Ocean will spread the nodes across markets by this value.
    - `scheduling` object — An object used to define times for a task such as a shutdown to be activated.
      - `tasks` object[]
        - `isEnabled` boolean, required — Describes whether the task is enabled. When True, the task runs. When False, it does not run. Required for cluster.scheduling.tasks.
        - `cronExpression` string — A valid cron expression. For example : " * * * * * ". The cron job runs in UTC time and is in Unix cron format (See the Cron Expression Validator Script). Required field for taskType "clusterRoll", optional field for taskType "amiAutoUpdate" (if Cron Expression is not provided for amiAutoUpdate task, the task will run once a day).
        - `taskType` 'clusterRoll' | 'amiAutoUpdate', required — The activity that you are scheduling. Valid values: "clusterRoll", "amiAutoUpdate". Required for cluster.scheduling.tasks.
        - `parameters` object, required — This field will be compatible to the task type field. If taskType is defined as "clusterRoll", use cluster roll object in parameters.
          - `clusterRoll` object
            - `batchSizePercentage` integer — Value as a percent to set the size of a batch in a roll. Valid values are 0-100.
            - `comment` string — Add a comment description for the roll. The comment is limited to 256 chars
            - `batchMinHealthyPercentage` integer — Indicates the threshold of minimum healthy instances in single batch. If the amount of healthy instances in single batch is under the threshold, the cluster roll will fail. If exists, the parameter value will be in range of 1-100. In case of null as value, the default value in the backend will be 50%. Value of param should represent the number in percentage (%) of the batch.
            - `respectPdb` boolean — During the roll, if the parameter is set to true we honor PDB during the instance replacement.
          - `amiAutoUpdate` object
            - `patch` boolean — When set to 'true', the auto-update process will update the VNGs’ images with the latest security patches. either "patch" or "minorVersion" must be true.
            - `minorVersion` boolean — When set to 'true', the auto-update process will update the VNGs’ AMI with the AMI to match the Kubernetes control plane version. either "patch" or "minorVersion" must be true.
            - `applyRoll` boolean — This parameter is optional. When the AMI is updated according to the configuration set, a cluster roll can be triggered.
            - `clusterRoll` object
              - …
      - `shutdownHours` object — An object used to specify times that the nodes in the cluster will be taken down.
        - `timeWindows` string[], required — The times that the shutdown hours will apply.
        - `isEnabled` boolean — Flag to enable or disable the shutdown hours mechanism. When False, the mechanism is deactivated, and the cluster remains in its current state.
      - `optimizationWindows` OptimizationWindows — unresolved $ref
    - `security` object — Object for cluster security features.
      - `containerImage` object
        - `approvedImages` string[] — Set a permitted list of repositories for container images.
    - `compute` Compute, required — unresolved $ref
    - `logging` Logging — unresolved $ref
    - `createdAt` string, date-time — A timestamp of the cluster creation.
    - `updatedAt` string, date-time — A timestamp of the latest cluster update.

## Other responses

- `400` — Bad Request

---

[API](https://skmtc.net/spot/apis/spot-by-flexera-api.md) · [All operations](https://skmtc.net/spot/apis/spot-by-flexera-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/spot/spot-by-flexera-api/revisions/72813baf8d47/schema)
