My Amazon EMR cluster fails to launch and I get the error "bootstrap action returned a non-zero return code"

Last updated: 2020-10-07

I created a custom bootstrap action for my Amazon EMR cluster. The cluster fails to launch, and the bootstrap action returns an error similar to the following: "bootstrap action 1 returned a non-zero return code".

Short description

Bootstrap actions run after Amazon EMR provisions the Amazon Elastic Compute Cloud (Amazon EC2) instances in the cluster. When a bootstrap action fails, Amazon EMR terminates the instance. For more information, see Understanding the cluster lifecycle.

If a bootstrap action fails because of an error in the bootstrap script, the cluster can't launch. For more information, see Bootstrap action basics.

Resolution

To determine why a bootstrap action failed, review the stderr logs for your bootstrap action. These logs are located in an Amazon Simple Storage Service (Amazon S3) path similar to the following:

s3://doc-example-bucket/cluster-id/node/instance-id/bootstrap-actions/

If you can't determine why the script failed after reviewing the stderr logs, modify your script to provide additional debug information. For example, set the -ex parameters in the bash script. This allows you to view the bash script flow in the bootstrap action log files.

Note: If the failed bootstrap action isn't a bootstrap action that you created (for example, if you created six bootstrap actions and the error message is "bootstrap action 7 failed with non-zero exit code"), it indicates that Amazon EMR couldn't install applications or start services. This problem is rare. To resolve this issue, try launching the cluster again.


Did this article help?


Do you need billing or technical support?