@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
399 lines • 17.4 kB
JavaScript
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.Cluster = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides an Elastic MapReduce Cluster, a web service that makes it easy to process large amounts of data efficiently. See [Amazon Elastic MapReduce Documentation](https://aws.amazon.com/documentation/elastic-mapreduce/) for more information.
*
* To configure [Instance Groups](https://docs.aws.amazon.com/emr/latest/ManagementGuide/emr-instance-group-configuration.html#emr-plan-instance-groups) for [task nodes](https://docs.aws.amazon.com/emr/latest/ManagementGuide/emr-master-core-task-nodes.html#emr-plan-task), see the `aws.emr.InstanceGroup` resource.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const cluster = new aws.emr.Cluster("cluster", {
* name: "emr-test-arn",
* releaseLabel: "emr-4.6.0",
* applications: ["Spark"],
* additionalInfo: `{
* "instanceAwsClientConfiguration": {
* "proxyPort": 8099,
* "proxyHost": "myproxy.example.com"
* }
* }
* `,
* terminationProtection: false,
* keepJobFlowAliveWhenNoSteps: true,
* ec2Attributes: {
* subnetId: main.id,
* emrManagedMasterSecurityGroup: sg.id,
* emrManagedSlaveSecurityGroup: sg.id,
* instanceProfile: emrProfile.arn,
* },
* masterInstanceGroup: {
* instanceType: "m4.large",
* },
* coreInstanceGroup: {
* instanceType: "c4.large",
* instanceCount: 1,
* ebsConfigs: [{
* size: 40,
* type: "gp2",
* volumesPerInstance: 1,
* }],
* bidPrice: "0.30",
* autoscalingPolicy: `{
* "Constraints": {
* "MinCapacity": 1,
* "MaxCapacity": 2
* },
* "Rules": [
* {
* "Name": "ScaleOutMemoryPercentage",
* "Description": "Scale out if YARNMemoryAvailablePercentage is less than 15",
* "Action": {
* "SimpleScalingPolicyConfiguration": {
* "AdjustmentType": "CHANGE_IN_CAPACITY",
* "ScalingAdjustment": 1,
* "CoolDown": 300
* }
* },
* "Trigger": {
* "CloudWatchAlarmDefinition": {
* "ComparisonOperator": "LESS_THAN",
* "EvaluationPeriods": 1,
* "MetricName": "YARNMemoryAvailablePercentage",
* "Namespace": "AWS/ElasticMapReduce",
* "Period": 300,
* "Statistic": "AVERAGE",
* "Threshold": 15.0,
* "Unit": "PERCENT"
* }
* }
* }
* ]
* }
* `,
* },
* ebsRootVolumeSize: 100,
* tags: {
* role: "rolename",
* env: "env",
* },
* bootstrapActions: [{
* path: "s3://elasticmapreduce/bootstrap-actions/run-if",
* name: "runif",
* args: [
* "instance.isMaster=true",
* "echo running on master node",
* ],
* }],
* configurationsJson: ` [
* {
* "Classification": "hadoop-env",
* "Configurations": [
* {
* "Classification": "export",
* "Properties": {
* "JAVA_HOME": "/usr/lib/jvm/java-1.8.0"
* }
* }
* ],
* "Properties": {}
* },
* {
* "Classification": "spark-env",
* "Configurations": [
* {
* "Classification": "export",
* "Properties": {
* "JAVA_HOME": "/usr/lib/jvm/java-1.8.0"
* }
* }
* ],
* "Properties": {}
* }
* ]
* `,
* serviceRole: iamEmrServiceRole.arn,
* });
* ```
*
* The `aws.emr.Cluster` resource typically requires two IAM roles, one for the EMR Cluster to use as a service role, and another is assigned to every EC2 instance in a cluster and each application process that runs on a cluster assumes this role for permissions to interact with other AWS services. An additional role, the Auto Scaling role, is required if your cluster uses automatic scaling in Amazon EMR.
*
* The default AWS managed EMR service role is called `EMR_DefaultRole` with Amazon managed policy `AmazonEMRServicePolicy_v2` attached. The name of default instance profile role is `EMR_EC2_DefaultRole` with default managed policy `AmazonElasticMapReduceforEC2Role` attached, but it is on the path to deprecation and will not be replaced with another default managed policy. You'll need to create and specify an instance profile to replace the deprecated role and default policy. See the [Configure IAM service roles for Amazon EMR](https://docs.aws.amazon.com/emr/latest/ManagementGuide/emr-iam-roles.html) guide for more information on these IAM roles. There is also a fully-bootable example Pulumi configuration at the bottom of this page.
*
* ### Instance Fleet
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.emr.Cluster("example", {
* masterInstanceFleet: {
* instanceTypeConfigs: [{
* instanceType: "m4.xlarge",
* }],
* targetOnDemandCapacity: 1,
* },
* coreInstanceFleet: {
* instanceTypeConfigs: [
* {
* bidPriceAsPercentageOfOnDemandPrice: 80,
* ebsConfigs: [{
* size: 100,
* type: "gp2",
* volumesPerInstance: 1,
* }],
* instanceType: "m3.xlarge",
* weightedCapacity: 1,
* },
* {
* 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: "SWITCH_TO_ON_DEMAND",
* timeoutDurationMinutes: 10,
* }],
* },
* name: "core fleet",
* targetOnDemandCapacity: 2,
* targetSpotCapacity: 2,
* },
* });
* const task = new aws.emr.InstanceFleet("task", {
* clusterId: example.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,
* });
* ```
*
* ### Enable Debug Logging
*
* [Debug logging in EMR](https://docs.aws.amazon.com/emr/latest/ManagementGuide/emr-plan-debugging.html) is implemented as a step. It is highly recommended that you utilize the resource options configuration with `ignoreChanges` if other steps are being managed outside of this provider.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.emr.Cluster("example", {steps: [{
* actionOnFailure: "TERMINATE_CLUSTER",
* name: "Setup Hadoop Debugging",
* hadoopJarStep: {
* jar: "command-runner.jar",
* args: ["state-pusher-script"],
* },
* }]});
* ```
*
* ### Multiple Node Master Instance Group
*
* Available in EMR version 5.23.0 and later, an EMR Cluster can be launched with three master nodes for high availability. Additional information about this functionality and its requirements can be found in the [EMR Management Guide](https://docs.aws.amazon.com/emr/latest/ManagementGuide/emr-plan-ha.html).
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* // This configuration is for illustrative purposes and highlights
* // only relevant configurations for working with this functionality.
* // Map public IP on launch must be enabled for public (Internet accessible) subnets
* const example = new aws.ec2.Subnet("example", {mapPublicIpOnLaunch: true});
* const exampleCluster = new aws.emr.Cluster("example", {
* releaseLabel: "emr-5.24.1",
* terminationProtection: true,
* ec2Attributes: {
* subnetId: example.id,
* },
* masterInstanceGroup: {
* instanceCount: 3,
* },
* coreInstanceGroup: {},
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import EMR clusters using the `id`. For example:
*
* ```sh
* $ pulumi import aws:emr/cluster:Cluster cluster j-123456ABCDEF
* ```
* Since the API does not return the actual values for Kerberos configurations, environments with those options set will need to use the `lifecycle` configuration block `ignore_changes` argument available to all Pulumi resources to prevent perpetual differences. For example:
*/
class Cluster extends pulumi.CustomResource {
/**
* Get an existing Cluster resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name, id, state, opts) {
return new Cluster(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of Cluster. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Cluster.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["additionalInfo"] = state?.additionalInfo;
resourceInputs["applications"] = state?.applications;
resourceInputs["arn"] = state?.arn;
resourceInputs["autoTerminationPolicy"] = state?.autoTerminationPolicy;
resourceInputs["autoscalingRole"] = state?.autoscalingRole;
resourceInputs["bootstrapActions"] = state?.bootstrapActions;
resourceInputs["clusterState"] = state?.clusterState;
resourceInputs["configurations"] = state?.configurations;
resourceInputs["configurationsJson"] = state?.configurationsJson;
resourceInputs["coreInstanceFleet"] = state?.coreInstanceFleet;
resourceInputs["coreInstanceGroup"] = state?.coreInstanceGroup;
resourceInputs["customAmiId"] = state?.customAmiId;
resourceInputs["ebsRootVolumeSize"] = state?.ebsRootVolumeSize;
resourceInputs["ec2Attributes"] = state?.ec2Attributes;
resourceInputs["keepJobFlowAliveWhenNoSteps"] = state?.keepJobFlowAliveWhenNoSteps;
resourceInputs["kerberosAttributes"] = state?.kerberosAttributes;
resourceInputs["listStepsStates"] = state?.listStepsStates;
resourceInputs["logEncryptionKmsKeyId"] = state?.logEncryptionKmsKeyId;
resourceInputs["logUri"] = state?.logUri;
resourceInputs["masterInstanceFleet"] = state?.masterInstanceFleet;
resourceInputs["masterInstanceGroup"] = state?.masterInstanceGroup;
resourceInputs["masterPublicDns"] = state?.masterPublicDns;
resourceInputs["name"] = state?.name;
resourceInputs["osReleaseLabel"] = state?.osReleaseLabel;
resourceInputs["placementGroupConfigs"] = state?.placementGroupConfigs;
resourceInputs["region"] = state?.region;
resourceInputs["releaseLabel"] = state?.releaseLabel;
resourceInputs["scaleDownBehavior"] = state?.scaleDownBehavior;
resourceInputs["securityConfiguration"] = state?.securityConfiguration;
resourceInputs["serviceRole"] = state?.serviceRole;
resourceInputs["stepConcurrencyLevel"] = state?.stepConcurrencyLevel;
resourceInputs["steps"] = state?.steps;
resourceInputs["tags"] = state?.tags;
resourceInputs["tagsAll"] = state?.tagsAll;
resourceInputs["terminationProtection"] = state?.terminationProtection;
resourceInputs["unhealthyNodeReplacement"] = state?.unhealthyNodeReplacement;
resourceInputs["visibleToAllUsers"] = state?.visibleToAllUsers;
}
else {
const args = argsOrState;
if (args?.releaseLabel === undefined && !opts.urn) {
throw new Error("Missing required property 'releaseLabel'");
}
if (args?.serviceRole === undefined && !opts.urn) {
throw new Error("Missing required property 'serviceRole'");
}
resourceInputs["additionalInfo"] = args?.additionalInfo;
resourceInputs["applications"] = args?.applications;
resourceInputs["autoTerminationPolicy"] = args?.autoTerminationPolicy;
resourceInputs["autoscalingRole"] = args?.autoscalingRole;
resourceInputs["bootstrapActions"] = args?.bootstrapActions;
resourceInputs["configurations"] = args?.configurations;
resourceInputs["configurationsJson"] = args?.configurationsJson;
resourceInputs["coreInstanceFleet"] = args?.coreInstanceFleet;
resourceInputs["coreInstanceGroup"] = args?.coreInstanceGroup;
resourceInputs["customAmiId"] = args?.customAmiId;
resourceInputs["ebsRootVolumeSize"] = args?.ebsRootVolumeSize;
resourceInputs["ec2Attributes"] = args?.ec2Attributes;
resourceInputs["keepJobFlowAliveWhenNoSteps"] = args?.keepJobFlowAliveWhenNoSteps;
resourceInputs["kerberosAttributes"] = args?.kerberosAttributes;
resourceInputs["listStepsStates"] = args?.listStepsStates;
resourceInputs["logEncryptionKmsKeyId"] = args?.logEncryptionKmsKeyId;
resourceInputs["logUri"] = args?.logUri;
resourceInputs["masterInstanceFleet"] = args?.masterInstanceFleet;
resourceInputs["masterInstanceGroup"] = args?.masterInstanceGroup;
resourceInputs["name"] = args?.name;
resourceInputs["osReleaseLabel"] = args?.osReleaseLabel;
resourceInputs["placementGroupConfigs"] = args?.placementGroupConfigs;
resourceInputs["region"] = args?.region;
resourceInputs["releaseLabel"] = args?.releaseLabel;
resourceInputs["scaleDownBehavior"] = args?.scaleDownBehavior;
resourceInputs["securityConfiguration"] = args?.securityConfiguration;
resourceInputs["serviceRole"] = args?.serviceRole;
resourceInputs["stepConcurrencyLevel"] = args?.stepConcurrencyLevel;
resourceInputs["steps"] = args?.steps;
resourceInputs["tags"] = args?.tags;
resourceInputs["terminationProtection"] = args?.terminationProtection;
resourceInputs["unhealthyNodeReplacement"] = args?.unhealthyNodeReplacement;
resourceInputs["visibleToAllUsers"] = args?.visibleToAllUsers;
resourceInputs["arn"] = undefined /*out*/;
resourceInputs["clusterState"] = undefined /*out*/;
resourceInputs["masterPublicDns"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Cluster.__pulumiType, name, resourceInputs, opts);
}
}
exports.Cluster = Cluster;
/** @internal */
Cluster.__pulumiType = 'aws:emr/cluster:Cluster';
//# sourceMappingURL=cluster.js.map
;