Why does my Amazon EMR cluster fail to launch and return the error "bootstrap action returned a non-zero return code"?

Lesedauer: 2 Minute

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, then the cluster can't launch. For more information, see Bootstrap action basics.


To determine why a bootstrap action failed, review the stderr logs for your bootstrap action. These logs are located in the Amazon Simple Storage Service (Amazon S3) path or LogUri that you configured earlier when you created the Amazon EMR cluster.

Example: s3://example-log-location/example-cluster-id/node/example-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.

set -x -e

Note: If the failed bootstrap action isn't a bootstrap action that you created—for example, if you created six bootstrap actions and you see the error message is "bootstrap action 7 failed with non-zero exit code")—that error message indicates that Amazon EMR couldn't install applications or start services.

To troubleshoot this issue, check the Amazon EMR provisioning logs. Amazon EMR uses Puppet to install and configure applications on a cluster. The logs might provide information on errors caused during the provisioning of the cluster.

You can access these logs on the cluster or S3 if you configured the logs to be pushed to S3. The logs are stored in /var/log/provision-node/apps-phase/0/example-UUID}/puppet.log on the disk and s3://example-log-location/example-cluster-id/node/example-instance-id/provision-node/apps-phase/0/{UUID}/puppet.log.gz.

Related information

Use custom bootstrap actions

AWS OFFICIALAktualisiert vor 6 Monaten
Keine Kommentare