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

Last updated: 2020-03-27

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, the instances are terminated. 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://awsexamplebucket/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.


Did this article help you?

Anything we could improve?


Need more help?