All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.awsnative.autoscaling.kotlin.inputs.AutoScalingGroupMixedInstancesPolicyArgs.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.awsnative.autoscaling.kotlin.inputs

import com.pulumi.awsnative.autoscaling.inputs.AutoScalingGroupMixedInstancesPolicyArgs.builder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiNullFieldException
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.Suppress
import kotlin.Unit
import kotlin.jvm.JvmName

/**
 * Use this structure to launch multiple instance types and On-Demand Instances and Spot Instances within a single Auto Scaling group.
 *  A mixed instances policy contains information that Amazon EC2 Auto Scaling can use to launch instances and help optimize your costs. For more information, see [Auto Scaling groups with multiple instance types and purchase options](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-mixed-instances-groups.html) in the *Amazon EC2 Auto Scaling User Guide*.
 *  You can create a mixed instances policy for new and existing Auto Scaling groups. You must use a launch template to configure the policy. You cannot use a launch configuration.
 *  There are key differences between Spot Instances and On-Demand Instances:
 *   +  The price for Spot Instances varies based on demand
 *   +  Amazon EC2 can terminate an individual Spot Instance as the availability of, or price for, Spot Instances changes
 *  When a Spot Instance is terminated, Amazon EC2 Auto Scaling group attempts to launch a replacement instance to maintain the desired capacity for the group.
 *   ``MixedInstancesPolicy`` is a property of the [AWS::AutoScaling::AutoScalingGroup](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-autoscaling-autoscalinggroup.html) resource.
 * @property instancesDistribution The instances distribution.
 * @property launchTemplate One or more launch templates and the instance types (overrides) that are used to launch EC2 instances to fulfill On-Demand and Spot capacities.
 */
public data class AutoScalingGroupMixedInstancesPolicyArgs(
    public val instancesDistribution: Output? = null,
    public val launchTemplate: Output,
) :
    ConvertibleToJava {
    override fun toJava(): com.pulumi.awsnative.autoscaling.inputs.AutoScalingGroupMixedInstancesPolicyArgs =
        com.pulumi.awsnative.autoscaling.inputs.AutoScalingGroupMixedInstancesPolicyArgs.builder()
            .instancesDistribution(
                instancesDistribution?.applyValue({ args0 ->
                    args0.let({ args0 ->
                        args0.toJava()
                    })
                }),
            )
            .launchTemplate(
                launchTemplate.applyValue({ args0 ->
                    args0.let({ args0 ->
                        args0.toJava()
                    })
                }),
            ).build()
}

/**
 * Builder for [AutoScalingGroupMixedInstancesPolicyArgs].
 */
@PulumiTagMarker
public class AutoScalingGroupMixedInstancesPolicyArgsBuilder internal constructor() {
    private var instancesDistribution: Output? = null

    private var launchTemplate: Output? = null

    /**
     * @param value The instances distribution.
     */
    @JvmName("ckgalmivcttetrym")
    public suspend fun instancesDistribution(`value`: Output) {
        this.instancesDistribution = value
    }

    /**
     * @param value One or more launch templates and the instance types (overrides) that are used to launch EC2 instances to fulfill On-Demand and Spot capacities.
     */
    @JvmName("atcltkhpkokvyuwh")
    public suspend fun launchTemplate(`value`: Output) {
        this.launchTemplate = value
    }

    /**
     * @param value The instances distribution.
     */
    @JvmName("owicoeaggxlaomlw")
    public suspend fun instancesDistribution(`value`: AutoScalingGroupInstancesDistributionArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.instancesDistribution = mapped
    }

    /**
     * @param argument The instances distribution.
     */
    @JvmName("mvattwtkpdypqojp")
    public suspend fun instancesDistribution(argument: suspend AutoScalingGroupInstancesDistributionArgsBuilder.() -> Unit) {
        val toBeMapped = AutoScalingGroupInstancesDistributionArgsBuilder().applySuspend {
            argument()
        }.build()
        val mapped = of(toBeMapped)
        this.instancesDistribution = mapped
    }

    /**
     * @param value One or more launch templates and the instance types (overrides) that are used to launch EC2 instances to fulfill On-Demand and Spot capacities.
     */
    @JvmName("dyuriltiqpgsaybb")
    public suspend fun launchTemplate(`value`: AutoScalingGroupLaunchTemplateArgs) {
        val toBeMapped = value
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.launchTemplate = mapped
    }

    /**
     * @param argument One or more launch templates and the instance types (overrides) that are used to launch EC2 instances to fulfill On-Demand and Spot capacities.
     */
    @JvmName("iymnysstkpbhfelf")
    public suspend fun launchTemplate(argument: suspend AutoScalingGroupLaunchTemplateArgsBuilder.() -> Unit) {
        val toBeMapped = AutoScalingGroupLaunchTemplateArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.launchTemplate = mapped
    }

    internal fun build(): AutoScalingGroupMixedInstancesPolicyArgs =
        AutoScalingGroupMixedInstancesPolicyArgs(
            instancesDistribution = instancesDistribution,
            launchTemplate = launchTemplate ?: throw PulumiNullFieldException("launchTemplate"),
        )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy