Search code examples
amazon-web-servicesaws-lambdaboto3amazon-emrautoscaling

AWS Create EMR using boto3 Autoscaling not working properly


I am auto scaling emr using boto3 and then autoscaling it using EMR_AutoScaling_DefaultRole. Autoscaling not working properly:

Initially it gives a warning as

The policy is pending attachment.

and at last failing giving error as

The Auto Scaling policy for instance group ig-XXXXXXXXXXXX in Amazon EMR cluster j-XXXXXXXXXXXX (test_emr...) could not attach and failed at 2018-12-19 10:03 UTC.

What can I do to assign the Autoscaling role?


Solution

  • In addition to answer by @Harsh Bafna. You also need to set Trust Relationship policy for EMR_AutoScaling_DefaultRole role.

    {
      "Version": "2012-10-17",
      "Statement": [
        {
          "Effect": "Allow",
          "Principal": {
            "Service": [
              "application-autoscaling.amazonaws.com",
              "elasticmapreduce.amazonaws.com"
            ]
          },
          "Action": "sts:AssumeRole"
        }
      ]
    }