Search code examples
amazon-emraws-step-functions

Add Bootstrap Actions while creating EMR cluster from AWS Step Functions


I'm creating EMR cluster from Step Functions using below code,

 "spinning_emr_cluster": {
      "Type": "Task",
      "Resource": "arn:aws:states:::elasticmapreduce:createCluster.sync",
      "Parameters": {
        "Name": "CombineFiles",
        "VisibleToAllUsers": true,
        "ReleaseLabel": "emr-5.29.0",
        "Applications": [
          {
            "Name": "Spark"
          }
        ],
        "ServiceRole": "EMR_DefaultRole",
        "JobFlowRole": "EMR_EC2_DefaultRole",
        "LogUri": "s3://awsmssqltos3/emr_logs/",
        "Instances": {
          "KeepJobFlowAliveWhenNoSteps": true,
          "InstanceFleets": [
            {
              "Name": "Master",
              "InstanceFleetType": "MASTER",
              "TargetOnDemandCapacity": 1,
              "InstanceTypeConfigs": [
                {
                  "InstanceType": "m1.large"
                }
              ]
            },
            {
              "Name": "Slave",
              "InstanceFleetType": "CORE",
              "TargetOnDemandCapacity": 1,
              "InstanceTypeConfigs": [
                {
                  "InstanceType": "m1.large"
                }
              ]
            }
          ]
        }
      },
      "ResultPath": "$.CreateClusterResult",
      "Next": "lambda"

I want to add bootstrap actions while creating the cluster from AWS Step Functions. I have tried searching online but could not find any syntax for that.


Solution

  •         "BootstrapActions": [
          {
            "Name": "CustomBootStrapAction",
            "ScriptBootstrapAction": {
              "Path": "",
              "Args": []
            }
          }
        ]
    

    Please Add above code inside Parameters Block.