com.pulumi.aws.emr.kotlin.InstanceFleet.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-aws-kotlin Show documentation
Show all versions of pulumi-aws-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.aws.emr.kotlin
import com.pulumi.aws.emr.kotlin.outputs.InstanceFleetInstanceTypeConfig
import com.pulumi.aws.emr.kotlin.outputs.InstanceFleetLaunchSpecifications
import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import com.pulumi.aws.emr.kotlin.outputs.InstanceFleetInstanceTypeConfig.Companion.toKotlin as instanceFleetInstanceTypeConfigToKotlin
import com.pulumi.aws.emr.kotlin.outputs.InstanceFleetLaunchSpecifications.Companion.toKotlin as instanceFleetLaunchSpecificationsToKotlin
/**
* Builder for [InstanceFleet].
*/
@PulumiTagMarker
public class InstanceFleetResourceBuilder internal constructor() {
public var name: String? = null
public var args: InstanceFleetArgs = InstanceFleetArgs()
public var opts: CustomResourceOptions = CustomResourceOptions()
/**
* @param name The _unique_ name of the resulting resource.
*/
public fun name(`value`: String) {
this.name = value
}
/**
* @param block The arguments to use to populate this resource's properties.
*/
public suspend fun args(block: suspend InstanceFleetArgsBuilder.() -> Unit) {
val builder = InstanceFleetArgsBuilder()
block(builder)
this.args = builder.build()
}
/**
* @param block A bag of options that control this resource's behavior.
*/
public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
}
internal fun build(): InstanceFleet {
val builtJavaResource = com.pulumi.aws.emr.InstanceFleet(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return InstanceFleet(builtJavaResource)
}
}
/**
* Provides an Elastic MapReduce Cluster Instance Fleet configuration.
* See [Amazon Elastic MapReduce Documentation](https://aws.amazon.com/documentation/emr/) for more information.
* > **NOTE:** At this time, Instance Fleets cannot be destroyed through the API nor
* web interface. Instance Fleets are destroyed when the EMR Cluster is destroyed.
* the provider will resize any Instance Fleet to zero when destroying the resource.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* const task = new aws.emr.InstanceFleet("task", {
* clusterId: cluster.id,
* instanceTypeConfigs: [
* {
* bidPriceAsPercentageOfOnDemandPrice: 100,
* ebsConfigs: [{
* size: 100,
* type: "gp2",
* volumesPerInstance: 1,
* }],
* instanceType: "m4.xlarge",
* weightedCapacity: 1,
* },
* {
* bidPriceAsPercentageOfOnDemandPrice: 100,
* ebsConfigs: [{
* size: 100,
* type: "gp2",
* volumesPerInstance: 1,
* }],
* instanceType: "m4.2xlarge",
* weightedCapacity: 2,
* },
* ],
* launchSpecifications: {
* spotSpecifications: [{
* allocationStrategy: "capacity-optimized",
* blockDurationMinutes: 0,
* timeoutAction: "TERMINATE_CLUSTER",
* timeoutDurationMinutes: 10,
* }],
* },
* name: "task fleet",
* targetOnDemandCapacity: 1,
* targetSpotCapacity: 1,
* });
* ```
* ```python
* import pulumi
* import pulumi_aws as aws
* task = aws.emr.InstanceFleet("task",
* cluster_id=cluster["id"],
* instance_type_configs=[
* {
* "bid_price_as_percentage_of_on_demand_price": 100,
* "ebs_configs": [{
* "size": 100,
* "type": "gp2",
* "volumes_per_instance": 1,
* }],
* "instance_type": "m4.xlarge",
* "weighted_capacity": 1,
* },
* {
* "bid_price_as_percentage_of_on_demand_price": 100,
* "ebs_configs": [{
* "size": 100,
* "type": "gp2",
* "volumes_per_instance": 1,
* }],
* "instance_type": "m4.2xlarge",
* "weighted_capacity": 2,
* },
* ],
* launch_specifications={
* "spot_specifications": [{
* "allocation_strategy": "capacity-optimized",
* "block_duration_minutes": 0,
* "timeout_action": "TERMINATE_CLUSTER",
* "timeout_duration_minutes": 10,
* }],
* },
* name="task fleet",
* target_on_demand_capacity=1,
* target_spot_capacity=1)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Aws = Pulumi.Aws;
* return await Deployment.RunAsync(() =>
* {
* var task = new Aws.Emr.InstanceFleet("task", new()
* {
* ClusterId = cluster.Id,
* InstanceTypeConfigs = new[]
* {
* new Aws.Emr.Inputs.InstanceFleetInstanceTypeConfigArgs
* {
* BidPriceAsPercentageOfOnDemandPrice = 100,
* EbsConfigs = new[]
* {
* new Aws.Emr.Inputs.InstanceFleetInstanceTypeConfigEbsConfigArgs
* {
* Size = 100,
* Type = "gp2",
* VolumesPerInstance = 1,
* },
* },
* InstanceType = "m4.xlarge",
* WeightedCapacity = 1,
* },
* new Aws.Emr.Inputs.InstanceFleetInstanceTypeConfigArgs
* {
* BidPriceAsPercentageOfOnDemandPrice = 100,
* EbsConfigs = new[]
* {
* new Aws.Emr.Inputs.InstanceFleetInstanceTypeConfigEbsConfigArgs
* {
* Size = 100,
* Type = "gp2",
* VolumesPerInstance = 1,
* },
* },
* InstanceType = "m4.2xlarge",
* WeightedCapacity = 2,
* },
* },
* LaunchSpecifications = new Aws.Emr.Inputs.InstanceFleetLaunchSpecificationsArgs
* {
* SpotSpecifications = new[]
* {
* new Aws.Emr.Inputs.InstanceFleetLaunchSpecificationsSpotSpecificationArgs
* {
* AllocationStrategy = "capacity-optimized",
* BlockDurationMinutes = 0,
* TimeoutAction = "TERMINATE_CLUSTER",
* TimeoutDurationMinutes = 10,
* },
* },
* },
* Name = "task fleet",
* TargetOnDemandCapacity = 1,
* TargetSpotCapacity = 1,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/emr"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := emr.NewInstanceFleet(ctx, "task", &emr.InstanceFleetArgs{
* ClusterId: pulumi.Any(cluster.Id),
* InstanceTypeConfigs: emr.InstanceFleetInstanceTypeConfigArray{
* &emr.InstanceFleetInstanceTypeConfigArgs{
* BidPriceAsPercentageOfOnDemandPrice: pulumi.Float64(100),
* EbsConfigs: emr.InstanceFleetInstanceTypeConfigEbsConfigArray{
* &emr.InstanceFleetInstanceTypeConfigEbsConfigArgs{
* Size: pulumi.Int(100),
* Type: pulumi.String("gp2"),
* VolumesPerInstance: pulumi.Int(1),
* },
* },
* InstanceType: pulumi.String("m4.xlarge"),
* WeightedCapacity: pulumi.Int(1),
* },
* &emr.InstanceFleetInstanceTypeConfigArgs{
* BidPriceAsPercentageOfOnDemandPrice: pulumi.Float64(100),
* EbsConfigs: emr.InstanceFleetInstanceTypeConfigEbsConfigArray{
* &emr.InstanceFleetInstanceTypeConfigEbsConfigArgs{
* Size: pulumi.Int(100),
* Type: pulumi.String("gp2"),
* VolumesPerInstance: pulumi.Int(1),
* },
* },
* InstanceType: pulumi.String("m4.2xlarge"),
* WeightedCapacity: pulumi.Int(2),
* },
* },
* LaunchSpecifications: &emr.InstanceFleetLaunchSpecificationsArgs{
* SpotSpecifications: emr.InstanceFleetLaunchSpecificationsSpotSpecificationArray{
* &emr.InstanceFleetLaunchSpecificationsSpotSpecificationArgs{
* AllocationStrategy: pulumi.String("capacity-optimized"),
* BlockDurationMinutes: pulumi.Int(0),
* TimeoutAction: pulumi.String("TERMINATE_CLUSTER"),
* TimeoutDurationMinutes: pulumi.Int(10),
* },
* },
* },
* Name: pulumi.String("task fleet"),
* TargetOnDemandCapacity: pulumi.Int(1),
* TargetSpotCapacity: pulumi.Int(1),
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.aws.emr.InstanceFleet;
* import com.pulumi.aws.emr.InstanceFleetArgs;
* import com.pulumi.aws.emr.inputs.InstanceFleetInstanceTypeConfigArgs;
* import com.pulumi.aws.emr.inputs.InstanceFleetLaunchSpecificationsArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var task = new InstanceFleet("task", InstanceFleetArgs.builder()
* .clusterId(cluster.id())
* .instanceTypeConfigs(
* InstanceFleetInstanceTypeConfigArgs.builder()
* .bidPriceAsPercentageOfOnDemandPrice(100)
* .ebsConfigs(InstanceFleetInstanceTypeConfigEbsConfigArgs.builder()
* .size(100)
* .type("gp2")
* .volumesPerInstance(1)
* .build())
* .instanceType("m4.xlarge")
* .weightedCapacity(1)
* .build(),
* InstanceFleetInstanceTypeConfigArgs.builder()
* .bidPriceAsPercentageOfOnDemandPrice(100)
* .ebsConfigs(InstanceFleetInstanceTypeConfigEbsConfigArgs.builder()
* .size(100)
* .type("gp2")
* .volumesPerInstance(1)
* .build())
* .instanceType("m4.2xlarge")
* .weightedCapacity(2)
* .build())
* .launchSpecifications(InstanceFleetLaunchSpecificationsArgs.builder()
* .spotSpecifications(InstanceFleetLaunchSpecificationsSpotSpecificationArgs.builder()
* .allocationStrategy("capacity-optimized")
* .blockDurationMinutes(0)
* .timeoutAction("TERMINATE_CLUSTER")
* .timeoutDurationMinutes(10)
* .build())
* .build())
* .name("task fleet")
* .targetOnDemandCapacity(1)
* .targetSpotCapacity(1)
* .build());
* }
* }
* ```
* ```yaml
* resources:
* task:
* type: aws:emr:InstanceFleet
* properties:
* clusterId: ${cluster.id}
* instanceTypeConfigs:
* - bidPriceAsPercentageOfOnDemandPrice: 100
* ebsConfigs:
* - size: 100
* type: gp2
* volumesPerInstance: 1
* instanceType: m4.xlarge
* weightedCapacity: 1
* - bidPriceAsPercentageOfOnDemandPrice: 100
* ebsConfigs:
* - size: 100
* type: gp2
* volumesPerInstance: 1
* instanceType: m4.2xlarge
* weightedCapacity: 2
* launchSpecifications:
* spotSpecifications:
* - allocationStrategy: capacity-optimized
* blockDurationMinutes: 0
* timeoutAction: TERMINATE_CLUSTER
* timeoutDurationMinutes: 10
* name: task fleet
* targetOnDemandCapacity: 1
* targetSpotCapacity: 1
* ```
*
* ## Import
* Using `pulumi import`, import EMR Instance Fleet using the EMR Cluster identifier and Instance Fleet identifier separated by a forward slash (`/`). For example:
* ```sh
* $ pulumi import aws:emr/instanceFleet:InstanceFleet example j-123456ABCDEF/if-15EK4O09RZLNR
* ```
*/
public class InstanceFleet internal constructor(
override val javaResource: com.pulumi.aws.emr.InstanceFleet,
) : KotlinCustomResource(javaResource, InstanceFleetMapper) {
/**
* ID of the EMR Cluster to attach to. Changing this forces a new resource to be created.
*/
public val clusterId: Output
get() = javaResource.clusterId().applyValue({ args0 -> args0 })
/**
* Configuration block for instance fleet
*/
public val instanceTypeConfigs: Output>?
get() = javaResource.instanceTypeConfigs().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
instanceFleetInstanceTypeConfigToKotlin(args0)
})
})
}).orElse(null)
})
/**
* Configuration block for launch specification
*/
public val launchSpecifications: Output?
get() = javaResource.launchSpecifications().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> instanceFleetLaunchSpecificationsToKotlin(args0) })
}).orElse(null)
})
/**
* Friendly name given to the instance fleet.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* The number of On-Demand units that have been provisioned for the instance
* fleet to fulfill TargetOnDemandCapacity. This provisioned capacity might be less than or greater than TargetOnDemandCapacity.
*/
public val provisionedOnDemandCapacity: Output
get() = javaResource.provisionedOnDemandCapacity().applyValue({ args0 -> args0 })
/**
* The number of Spot units that have been provisioned for this instance fleet
* to fulfill TargetSpotCapacity. This provisioned capacity might be less than or greater than TargetSpotCapacity.
*/
public val provisionedSpotCapacity: Output
get() = javaResource.provisionedSpotCapacity().applyValue({ args0 -> args0 })
/**
* The target capacity of On-Demand units for the instance fleet, which determines how many On-Demand instances to provision.
*/
public val targetOnDemandCapacity: Output?
get() = javaResource.targetOnDemandCapacity().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The target capacity of Spot units for the instance fleet, which determines how many Spot instances to provision.
*/
public val targetSpotCapacity: Output?
get() = javaResource.targetSpotCapacity().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
}
public object InstanceFleetMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.aws.emr.InstanceFleet::class == javaResource::class
override fun map(javaResource: Resource): InstanceFleet = InstanceFleet(
javaResource as
com.pulumi.aws.emr.InstanceFleet,
)
}
/**
* @see [InstanceFleet].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [InstanceFleet].
*/
public suspend fun instanceFleet(
name: String,
block: suspend InstanceFleetResourceBuilder.() -> Unit,
): InstanceFleet {
val builder = InstanceFleetResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [InstanceFleet].
* @param name The _unique_ name of the resulting resource.
*/
public fun instanceFleet(name: String): InstanceFleet {
val builder = InstanceFleetResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy