fbpx
POSThttps://api.spotinst.io/aws/ec2/managedInstance?accountId={ACCOUNT_ID}

Create a new Managed Instance resource.

URL Parameters

Parameter Type Description
ACCOUNT_ID String

Your Spotinst accountId associated with your token

Example: act-123abc
Request

Headers
{
    "Content-Type": "application/json",
    "Authorization": "Bearer ${token}"
}
Body
Copied!
Downloaded!
{
  "managedInstance": {
    "name": "mi-test",
    "description": "This is my Managed Instance",
    "region": "us-east-1",
    "strategy": {
      "lifeCycle": "spot",
      "orientation": "availabilityOriented",
      "drainingTimeout": null,
      "fallbackToOd": true,
      "utilizeReservedInstances": false,
      "optimizationWindows": [
        "Mon:03:00-Wed:02:30"
      ],
      "revertToSpot": {
        "performAt": "timeWindow"
      }
    },
    "persistence": {
      "blockDevicesMode": "reattach",
      "persistRootDevice": true,
      "persistBlockDevices": true,
      "persistPrivateIp": true
    },
    "healthCheck": {
      "type": "EC2",
      "autoHealing": true,
      "gracePeriod": 120,
      "unhealthyDuration": 120
    },
    "compute": {
      "subnetIds": [
        "subnet-79da021e",
        "subnet-1ba25052"
      ],
      "vpcId": "vpc-111",
      "elasticIp": "ip",
      "privateIp": "ip",
      "launchSpecification": {
        "instanceTypes": {
	    "preferredType": "t2.micro",
	    "types": [
	      "t2.micro",
	      "t3.micro"
	    ]
        },
        "ebsOptimized": false,
        "monitoring": false,
        "tenancy": "default",
        "iamRole": {
          "arn": "arn",
          "name": "name"
        },
        "securityGroupIds": [
          "sg-0dfc2c8760df6fec7"
        ],
        "imageId": "ami-01e24be29428c15b2",
        "keyPair": "labs-oregon",
        "tags": [
          {
            "tagKey": "Creator",
            "tagValue": "test1@spotinst.com"
          }
        ],
        "userData": "dXNlcmJhc2g2NGVuY29kZWQ=",
        "shutdownScript": "dXNlcmJhc2g2NGVuY29kZWQ=",
        "creditSpecification": 
          {
            "cpuCredits": "unlimited"
          },
        "networkInterfaces": [
          {
            "deviceIndex": 0,
            "associatePublicIpAddress": true,
            "associateIpv6Address": true
          }
          ]
      }
    },
    "integrations": {
      "loadBalancersConfig": {
        "loadBalancers": [
          {
            "name": "Yarden-Test",
            "type": "CLASSIC"
          },
          {
            "targetSetId": "ts-046a2692b1b2",
            "balancerId": "lb-98db2e76ac5c",
            "autoWeight": true,
            "azAwareness": false,
            "type": "MULTAI_TARGET_SET"
          },
          {
            "name": "metrics",
            "type": "TARGET_GROUP",
            "arn": "arn"
          }
        ]
      },
      "route53": {
        "domains": [
          {
            "hostedZoneId": "",
            "spotinstAccountId": "act-111",
            "recordSets": [
              {
                "name": "test.spotinst.com",
                "usePublicIp": true
              }
            ]
          }
        ]
      }
    },
    "scheduling": {
      "tasks": [
        {
          "taskType": "recycle",
          "startTime": "2019-05-23T10:55:09Z",
          "cronExpression": "0 20 * * *",
          "isEnabled": true
        }
      ]
    }
  }
}

Body Attributes


  • managedInstance * Object
  • managedInstance.name * String
    Managed Instance name
  • managedInstance.description String
    Describe your Managed Instance resource
  • managedInstance.region * String
    The AWS region your resource will be created in.
  • managedInstance.strategy Object
    Set strategy settings
  • managedInstance.strategy.lifeCycle String
    Set lifecycle, valid values: “spot”, “on_demand”
    Default: spot
  • managedInstance.strategy.orientation String
    The strategy orientation. valid values: “costOriented”, “availabilityOriented”, “balanced”, “cheapest”
    Default: availabilityOriented
  • managedInstance.strategy.drainingTimeout Integer
    The time in seconds to allow the instance be drained from incoming TCP connections and detached from ELB before terminating it, during a scale down operation
  • managedInstance.strategy.fallbackToOd Boolean
    In case of no spots available, Managed Instance will launch an On-demand instance instead
    Default: true
  • managedInstance.strategy.utilizeReservedInstances Boolean
    In case of any available Reserved Instances, Managed Instance will utilize them before purchasing Spot instances
    Default: false
  • managedInstance.strategy.optimizationWindows Array<String>
    When performAt is 'timeWindow': must specify a list of 'timeWindows' with at least one time window Each string is in the format of - ddd:hh:mm-ddd:hh:mm ddd = day of week = Sun | Mon | Tue | Wed | Thu | Fri | Sat hh = hour 24 = 0 -23 mm = minute = 0 - 59
  • managedInstance.strategy.revertToSpot Object
  • managedInstance.strategy.revertToSpot..strategy.performAt String
    Valid values: “always”, “never”, "timeWindow"
    Example: never
    Default: never
  • managedInstance.persistence Object
    Persistence settings. Should omit at least one of the persist options below.
  • managedInstance.persistence.persistPrivateIp Boolean
    Should the instance maintain its private IP
  • managedInstance.persistence.persistBlockDevices Boolean
    Should the instance maintain its Data volumes
  • managedInstance.persistence.persistRootDevice Boolean
    Should the instance maintain its root device volumes
  • managedInstance.persistence.blockDevicesMode String
    Determine the way we attach the data volumes to the data devices. Valid values: ‘reattach’, ‘onLaunch’
    Default: onLaunch
  • managedInstance.healthCheck Object
  • managedInstance.healthCheck.type String
    The service to use for the health check. Valid values: “EC2”, “ELB”, “TARGET_GROUP”, “MULTAI_TARGET_SET”
    Default: EC2
  • managedInstance.healthCheck.autoHealing Boolean
    Enable the auto healing which auto replaces the instance in case the health check fails
    Default: true
  • managedInstance.healthCheck.gracePeriod Integer
    The amount of time, in seconds, after the instance has launched to starts and check its health.
    Default: 120
  • managedInstance.healthCheck.unhealthyDuration Integer
    The amount of time, in seconds, an existing instance should remain active after becoming unhealthy. After the set time out the instance will be replaced
    Default: 120
  • managedInstance.compute Object
    Set compute settings
  • managedInstance.compute.subnetIds * Array<String>
    A comma-separated list of subnet identifiers for your instance.
  • managedInstance.compute.vpcId * String
    VPC id for your instance.
  • managedInstance.compute.elasticIp String
    Elastic IP Allocation Id to associate to the instance
  • managedInstance.compute.privateIp String
    Private IP Allocation Id to associate to the instance
  • managedInstance.compute.launchSpecification * Object
  • managedInstance.compute.launchSpecification.instanceTypes * Object
    Set instance types settings
  • managedInstance.compute.launchSpecification.instanceTypes.preferredType * String
    Preferred instance types for the instance. We will automatically select optional similar instance types to ensure optimized cost efficiency
  • managedInstance.compute.launchSpecification.instanceTypes.instanceTypes String
    Comma separated list of available instance types for instance
  • managedInstance.compute.launchSpecification.ebsOptimized Boolean
    Enable EBS optimization for supported instance which is not enabled by default. Note - additional charges will be applied.
    Default: false
  • managedInstance.compute.launchSpecification.monitoring Boolean
    Describes whether instance Enhanced Monitoring is enabled.
    Default: false
  • managedInstance.compute.launchSpecification.tenancy String
    Valid values: "default", "dedicated"
    Default: default
  • managedInstance.compute.launchSpecification.iamRole Object
    Set IAM profile to instance. Set only one of ARN or Name.
  • managedInstance.compute.launchSpecification.iamRole.arn String
    Set IAM by ARN
  • managedInstance.compute.launchSpecification.iamRole.name String
    Set IAM by name
  • managedInstance.compute.launchSpecification.securityGroupIds Array<String>
    One or more security group IDs.
  • managedInstance.compute.launchSpecification.imageId * String
    The ID of the image used to launch the instance.
  • managedInstance.compute.launchSpecification.keyPair String
    Specify a Key Pair to attach to the instances.
  • managedInstance.compute.launchSpecification.tags Array<Object>
    Set tags for the instance. Items should be unique.
  • managedInstance.compute.launchSpecification.tags.tagKey String
    Tag's key
  • managedInstance.compute.launchSpecification.tags.tagName String
    Tag's name
  • managedInstance.compute.launchSpecification.userData Base64
    The Base64-encoded MIME user data to make available to the instances
  • managedInstance.compute.launchSpecification.shutdownScript Base64
    The Base64-encoded shutdown script to execute prior to instance termination
  • managedInstance.compute.launchSpecification.creditSpecification Object
    creditSpecification is a parameter that indicates in what mode t2/t3 instances will be launched with. It consists of one key: cpuCredits (String)
  • managedInstance.compute.launchSpecification.creditSpecification.cpuCredits String
    cpuCredits can have one of two values: “unlimited”, “standard”
    Default: unlimited
  • managedInstance.compute.launchSpecification.networkInterfaces Array<Object>
    List of network interfaces in an EC2 instance.
  • managedInstance.compute.launchSpecification.networkInterfaces.deviceIndex * Integer
    The position of the network interface in the attachment order. A primary network interface has a device index of 0. If you specify a network interface when launching an instance, you must specify the device index.
  • managedInstance.compute.launchSpecification.networkInterfaces.associatePublicIpAddress Boolean
    Indicates whether to assign a public IPv4 address to an instance you launch in a VPC. The public IP address can only be assigned to a network interface for eth0, and can only be assigned to a new network interface, not an existing one. You cannot specify more than one network interface in the request. If launching into a default subnet, the default value is true.
  • managedInstance.compute.launchSpecification.networkInterfaces.associateIpv6Address Boolean
    Indicates whether to assign an IPv6 address. Amazon EC2 chooses the IPv6 addresses from the range of the subnet.
    Default: false
  • managedInstance.integrations Object
    Instance integrations object.
  • managedInstance.integrations.loadBalancersConfig String
    LB integration object.
  • managedInstance.integrations.loadBalancersConfig.loadBalancers Array<Object>
    List of load balancers configs.
  • managedInstance.integrations.loadBalancersConfig.loadBalancers.name String
    The AWS resource name. Required for Classic Load Balancer. Optional for Application Load Balancer.
  • managedInstance.integrations.loadBalancersConfig.loadBalancers.arn String
    The AWS resource ARN (Required only for ALB target groups)
  • managedInstance.integrations.loadBalancersConfig.loadBalancers.type String
    The resource type. Valid Values: CLASSIC, TARGET_GROUP, MULTAI_TARGET_SET
  • managedInstance.integrations.loadBalancersConfig.loadBalancers.balancerId String
    The Multai load balancer ID
    Default: lb-123456
  • managedInstance.integrations.loadBalancersConfig.loadBalancers.targetSetId String
    The Multai load target set ID
    Default: ts-123456
  • managedInstance.integrations.loadBalancersConfig.loadBalancers.azAwerness Boolean
    “AZ Awareness” will ensure that instances within the same AZ are using the corresponding MLB runtime instance in the same AZ. This feature reduces multi-zone data transfer fees
  • managedInstance.integrations.loadBalancersConfig.loadBalancers.autoWeight Boolean
    “Auto Weight” will automatically provide a higher weight for instances that are larger as appropriate. For example, if you have configured your Elastigroup with m4.large and m4.xlarge instances the m4.large will have half the weight of an m4.xlarge. This ensures that larger instances receive a higher number of MLB requests
  • managedInstance.integrations.route53 Object
    Route53 integration object
  • managedInstance.integrations.route53.domains Array<Object>
    Route 53 Domain configurations.
  • managedInstance.integrations.route53.domains.hostedZoneId String
    The Route 53 Hosted Zone Id for the registered Domain.
  • managedInstance.integrations.route53.domains.spotinstAccountId String
    The Spotinst account ID that is linked to the AWS account that holds the Route 53 hosted Zone Id. The default is the user Spotinst account provided as a URL parameter.
  • managedInstance.integrations.route53.domains.recordSets Array<Object>
    List of record sets
  • managedInstance.integrations.route53.domains.recordSets.name String
  • managedInstance.integrations.route53.domains.recordSets.usePublicIp Boolean
  • managedInstance.scheduling Object
  • managedInstance.scheduling.tasks Array<Object>
    The scheduling tasks for the instance
  • managedInstance.scheduling.tasks.taskType * String
    The task type to run. Valid Values: "pause", "resume", "recycle"
  • managedInstance.scheduling.tasks.startTime String
    DATETIME in ISO-8601 format. Sets a start time for scheduled actions. If "frequency" or "cronExpression" are not used - the task will run only once at the start time and will then be deleted from the instance configuration
    Example: 2019-05-23T10:55:09Z
  • managedInstance.scheduling.tasks.cronExpression String
    A valid cron expression. For example : " * * * * * ".The cron is running in UTC time zone and is in Unix cron format Cron Expression Validator Script. Only one of ‘frequency’ or ‘cronExpression’ should be used at a time.
    Example: 0 1 * * *
  • managedInstance.scheduling.tasks.isEnabled * Boolean
    Describes whether the task is enabled. When true the task should run when false it should not run.
  • managedInstance.scheduling.tasks.frequency * String
    Set frequency for the task. Valid values: "hourly", "daily", "weekly", "continuous"
Response - 200

Headers
{
    "Content-Type": "application/json"
}
Body
Copied!
Downloaded!
{
  "request": {
    "id": "9ea37b98-32f7-48ea-8ec3-14e3f396e50e",
    "url": "/aws/ec2/managedInstance",
    "method": "POST",
    "timestamp": "2019-04-02T11:09:40.652Z"
  },
  "response": {
    "status": {
      "code": 200,
      "message": "OK"
    },
    "kind": "spotinst:aws:ec2:managedInstance",
    "items": [  
      {
        "managedInstance": {
          "id": "smi-111",
          "name": "mi-test",
          "description": "This is my Managed Instance",
          "region": "us-east-1",
          "createdAt": "2015-10-23T09:00:00.000Z",
          "updatedAt": "2018-08-01T14:11:39.000Z",
          "strategy": {
            "lifeCycle": "spot",
            "orientation": "availabilityOriented",
            "drainingTimeout": null,
            "fallbackToOd": true,
            "utilizeReservedInstances": false,
            "optimizationWindows": [
              "Mon:03:00-Wed:02:30"
            ],
            "revertToSpot": {
              "performAt": "timeWindow"
            }
          },
          "persistence": {
            "blockDevicesMode": "reattach",
            "persistRootDevice": true,
            "persistBlockDevices": true,
            "persistPrivateIp": true
          },
          "healthCheck": {
            "type": "EC2",
            "autoHealing": true,
            "gracePeriod": 120,
            "unhealthyDuration": 120
          },
          "compute": {
            "subnetIds": [
              "subnet-79da021e",
              "subnet-1ba25052"
            ],
            "vpcId": "vpc-111",
            "elasticIp": "ip",
            "privateIp": "ip",
            "launchSpecification": {
              "instanceTypes": {
      	    "preferredType": "t2.micro",
      	    "types": [
      	      "t2.micro",
      	      "t3.micro"
      	    ]
              },
              "ebsOptimized": false,
              "monitoring": false,
              "tenancy": "default",
              "iamRole": {
                "arn": "arn",
                "name": "name"
              },
              "securityGroupIds": [
                "sg-0dfc2c8760df6fec7"
              ],
              "imageId": "ami-01e24be29428c15b2",
              "keyPair": "labs-oregon",
              "tags": [
                {
                  "tagKey": "Creator",
                  "tagValue": "test1@spotinst.com"
                }
              ],
              "userData": "dXNlcmJhc2g2NGVuY29kZWQ=",
              "shutdownScript": "dXNlcmJhc2g2NGVuY29kZWQ=",
              "creditSpecification": 
                {
                  "cpuCredits": "unlimited"
                },
              "networkInterfaces": [
                {
                  "deviceIndex": 0,
                  "associatePublicIpAddress": true,
                  "associateIpv6Address": true
                }
                ]
            }
          },
          "integrations": {
            "loadBalancersConfig": {
              "loadBalancers": [
                {
                  "name": "Yarden-Test",
                  "type": "CLASSIC"
                },
                {
                  "targetSetId": "ts-046a2692b1b2",
                  "balancerId": "lb-98db2e76ac5c",
                  "autoWeight": true,
                  "azAwareness": false,
                  "type": "MULTAI_TARGET_SET"
                },
                {
                  "name": "metrics",
                  "type": "TARGET_GROUP",
                  "arn": "arn"
                }
              ]
            },
            "route53": {
              "domains": [
                {
                  "hostedZoneId": "",
                  "spotinstAccountId": "act-111",
                  "recordSets": [
                    {
                      "name": "test.spotinst.com",
                      "usePublicIp": true
                    }
                  ]
                }
              ]
            }
          },
          "scheduling": {
            "tasks": [
              {
                "taskType": "recycle",
                "startTime": "2019-05-23T10:55:09Z",
                "cronExpression": "0 20 * * *",
                "isEnabled": true
              }
            ]
          }
        }
      }
     ],
    "count": 1
  }
}