When I try to create a new Amazon EMR cluster, I get one of the following error messages:

  • "EMR_DefaultRole is invalid"
  • "EMR_EC2_DefaultRole is invalid"

These errors occur when the Amazon Elastic Compute Cloud (Amazon EC2) instance profile associated with the default roles isn't configured correctly. Delete the roles and the instance profile. Then, recreate the roles.

Before you begin, note the following:

  • Be sure that you don't have any EC2 instances running with the role or instance profile that you're about to delete. Deleting a role or instance profile that is associated with a running instance will break any applications that are running on the instance.
  • The following steps reset EMR_DefaultRole and EMR_EC2_DefaultRole to their original configurations. If you customized the AWS Identity and Access Management (IAM) policies attached to these roles, those changes will be lost.

Delete the roles and instance profile using the AWS Management Console

1.    Use the IAM console to delete the roles. When you use the console to delete a role, IAM also automatically deletes the instance profile and policies associated with the role.

2.    Open the Amazon EMR console.

3.    Create a cluster, but leave the default roles specified. You can do this either using Quick options or using Advanced options. Amazon EMR automatically creates the roles when it launches the cluster. These roles are then available to any clusters that you launch later.

Delete the roles and instance profile using the AWS Command Line Interface (AWS CLI)

1.    Remove EMR_EC2_DefaultRole from the instance profile:

aws iam remove-role-from-instance-profile --instance-profile-name EMR_EC2_DefaultRole --role-name EMR_EC2_DefaultRole

2.    Delete the instance profile:

aws iam delete-instance-profile --instance-profile-name EMR_EC2_DefaultRole

3.    Delete the IAM policy associated with EMR_EC2_DefaultRole:

aws iam detach-role-policy --role-name EMR_EC2_DefaultRole --policy-arn arn:aws:iam::aws:policy/service-role/AmazonElasticMapReduceforEC2Role

4.    Delete EMR_EC2_DefaultRole:

aws iam delete-role --role-name EMR_EC2_DefaultRole

5.    Delete the IAM policy associated with EMR_DefaultRole:

aws iam detach-role-policy --role-name EMR_DefaultRole --policy-arn arn:aws:iam::aws:policy/service-role/AmazonElasticMapReduceRole

6.    Delete EMR_DefaultRole:

aws iam delete-role --role-name EMR_DefaultRole

7.    Run create-default-roles to recreate the default roles:

aws emr create-default-roles

8.    Launch a new Amazon EMR cluster.

Did this page help you? Yes | No

Back to the AWS Support Knowledge Center

Need help? Visit the AWS Support Center

Published: 2016-09-30

Updated: 2019-02-12