launch_spec#

State module for managing Ocean AWS LaunchSpec.

async idem_spotinst.states.spotinst.ocean.aws.launch_spec.present(hub, ctx, name: str, image_id: str, ocean_id: str, resource_id: str = None, iam_instance_profile: Dict = None, taints: List = None, tags: List = None, subnet_ids: List = None, user_data: str = None, security_group_ids: List = None, root_volume_size: int = None, strategy: Dict = None, restrict_scale_down: bool = None, resource_limits: Dict = None, labels: List = None, instance_types: List = None, preferred_spot_types: List = None, elastic_ip_pool: Dict = None, auto_scale: Dict = None, block_device_mappings: List = None, associate_public_ip_address: bool = None, scheduling: Dict = None, instance_metadata_options: Dict = None) Dict[str, Any][source]#

Create a Launch Spec(Virtual Node Group).

Refer the Spot Create Launch Spec(Virtual Node Group) documentation to get insight of functionality and input parameters

Parameters:
  • name (str) – launch specification name.

  • image_id (str) – AWS image identifier.

  • ocean_id (str) – The Ocean cluster identifier. Required for Launch Spec creation

  • resource_id (str, Optional) – The virtual node group identifier.

  • iam_instance_profile (dict, Optional) – The instance profile iamRole object.

  • taints (list, Optional) – Add taints to Launch Spec.

  • tags (list, Optional) – List of kay-value pairs of tags.

  • subnet_ids (list, Optional) – Set subnets in launchSpec. Each element in the array is a subnet identifier.

  • user_data (str, Optional) – Set user data script.

  • security_group_ids (list, Optional) – Set security groups. Each element in the array is a security group identifier.

  • root_volume_size (int, Optional) – Set root volume size (in GB). This field and blockDeviceMappings cannot be used in the same specification.

  • strategy (dict, Optional) – Similar to a strategy for an Ocean cluster, but applying only to a virtual node group.

  • restrict_scale_down (bool, Optional) – When set to “True”, VNG nodes will be treated as if all pods running have the restrict-scale-down label. Therefore, Ocean will not scale nodes down unless empty.

  • resource_limits (dict, Optional) – Option to set a maximum/minimum number of instances per launch specification.

  • labels (list, Optional) – An array of labels to add to the VNG nodes. Only custom user labels are allowed, and not Kubernetes built-in labels or Spot internal labels.

  • instance_types (list, Optional) – A list of instance types allowed to be provisioned for pods pending for the launch specification.

  • preferred_spot_types (list, Optional) – When Ocean scales up instances, it takes your preferred types into consideration while maintaining a variety of machine types running for optimized distribution.

  • elastic_ip_pool (dict, Optional) – Assign an Elastic IP to the instances launched by the launch spec.

  • auto_scale (dict, Optional) – Object specifying the automatic scaling of an Ocean VNG.

  • block_device_mappings (list, Optional) – Block devices that are exposed to the instance. You can specify virtual devices and EBS volumes. This parameter and rootVolumeSize cannot be in the spec at the same time. This parameter can be null, but if not null, it must contain at least one block device.

  • associate_public_ip_address (bool, Optional) – Configure public IP address allocation.

  • scheduling (dict, Optional) – An object used to define scheduled tasks such as a manual headroom update.

  • instance_metadata_options (dict, Optional) – Ocean instance metadata options object for IMDSv2.

Request Syntax:
[spotinst.ocean.aws.launch_spec-resource-id]:
    spotinst.ocean.aws.launch_spec.present:
       - name: 'string'
       - resource_id: 'string'
       - taints:
         - effect: 'string'
           key: 'string'
           value: 'string'
       - tags:
         - tagKey: 'string'
           tagValue: 'string'
         - tagKey: 'string'
           tagValue: 'string'
       - subnet_ids:
         - 'string'
       - user_data: 'string'
       - security_group_ids:
         - 'string'
       - root_volume_size: Integer
       - resource_limits:
           maxInstanceCount: Integer
       - ocean_id: 'string'
       - labels:
         - key: 'string'
           value: 'string'
         - key: 'string'
           value: 'string'
       - instance_types:
         - 'string'
       - image_id: 'string'
       - iam_instance_profile:
           arn: 'string'
       - associate_public_ip_address: true/false
       - preferred_spot_types:
         - 'string'
       - elastic_ip_pool:
           tagSelector:
             tagKey: 'string'
             tagValue: 'string'
       - auto_scale:
           headrooms:
            - cpuPerUnit: Integer
              memoryPerUnit: Integer
              numOfUnits: Integer
       - block_device_mappings:
        - deviceName: 'string'
          ebs:
            deleteOnTermination: true/false
            encrypted: true/false
            volumeSize: Integer
            volumeType: 'string'
        - scheduling:
            tasks:
              - isEnabled: true/false
                cronExpression: 'string'
                taskType: 'string'
            shutdownHours:
              timeWindows:
                - 'string'
            isEnabled: true/false
        - instanceMetadataOptions:
                    httpTokens: 'string'
                    httpPutResponseHopLimit: Integer
Returns:

Dict[str, Any]

Examples

ols-77e27034:
  spotinst.ocean.aws.launch_spec.present:
  - name: cluster-arm
  - resource_id: ols-77e27034
  - taints:
    - effect: NoSchedule
      key: dedicated
      value: idem-test-value
  - tags:
    - tagKey: tag-key-1
      tagValue: tag-value-1
    - tagKey: tag-key-2
      tagValue: tag-value-2
  - subnet_ids:
    - subnet-111122223333abcd
    - subnet-444455556666abcd
  - user_data: /etc/eks/idem-test.sh
  - security_group_ids:
    - sg-111122223333abcd
    - sg-444455556666abcd
  - root_volume_size: 8
  - resource_limits:
      maxInstanceCount: 1
  - ocean_id: o-b78b1d69
  - labels:
    - key: autoscale
      value: 'false'
    - key: dedicated
      value: idem-test-value
  - instance_types:
    - t2.micro
  - image_id: ami-111122223333abcd
  - iam_instance_profile:
      arn: arn:aws:iam::111122223333:instance-profile/spotinst-eks-stack-NodeInstanceProfile
  - auto_scale:
      headrooms:
       - cpuPerUnit: 1024
         memoryPerUnit: 512
         numOfUnits: 3
  - block_device_mappings:
   - deviceName: /dev/xvda
     ebs:
       deleteOnTermination: true
       encrypted: true
       volumeSize: 30
       volumeType: gp2
   - scheduling:
       tasks:
         - isEnabled: true
           cronExpression: '0 1 * * *'
           taskType: manualHeadroomUpdate
       shutdownHours:
         timeWindows:
           - "Sat:08:00-Sun:08:00"
       isEnabled: true
   - instanceMetadataOptions:
               httpTokens: optional
               httpPutResponseHopLimit: 12
async idem_spotinst.states.spotinst.ocean.aws.launch_spec.absent(hub, ctx, name: str, resource_id: str = None) Dict[str, Any][source]#

Deletes the specified launch Spec.

When this call completes, the launch configuration is no longer available for use.

Refer the Spot Delete Launch Spec(Virtual Node Group) documentation to get insight of functionality and input parameters

Parameters:
  • name (str) – An idem name of the launch spec.

  • resource_id (str, Optional) – The AWS ID of the launch spec.

Request Syntax:
[launch_spec-resource-id]:
       spotinst.ocean.aws.launch_spec.absent:
       - name: 'string'
       - resource_id: 'string'
Returns:

Dict[str, Any]

Examples

idem-test-launch_spec:
  spotinst.ocean.aws.launch_spec.absent:
    - name: idem-test-launch_spec
    - resource_id: idem-test-launch_spec
async idem_spotinst.states.spotinst.ocean.aws.launch_spec.describe(hub, ctx) Dict[str, Dict[str, Any]][source]#

Describe the resource in a way that can be recreated/managed with the corresponding “present” function.

Gets information about the virtual node groups for the cluster.

Please refer the Spot Listing Launch Spec(Virtual Node Group) documentation to get insight of functionality and input parameters

Returns:

Dict[str, Dict[str, Any]]

Examples

$ idem describe spotinst.ocean.aws.launch_spec