EMR Notebooks Magics is a Python library providing Jupyter magics specifically for Amazon EMR Notebooks. These magics enhance the interactive experience by allowing direct interaction with EMR cluster resources, such as mounting S3 workspaces and executing other notebooks. The library is currently at version 0.2.4 and is actively maintained by AWS Labs, with updates tied to EMR Notebooks and EMR Studio feature development.
pip install emr-notebooks-magicsVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates the core functionalities of EMR Notebooks Magics: mounting a workspace directory, generating a presigned S3 download URL, and executing another notebook. These commands are run directly in a Jupyter cell within an EMR Notebook environment.
Restart the Jupyter kernel (`Kernel -> Restart Kernel`) after installation. Do not attempt to install it via EMR bootstrap actions as the notebook environment is installed later.
Be aware of this limitation. If Spark executors need access to data, ensure data is directly accessible via S3 paths or other cluster-wide storage, rather than relying solely on a Python kernel's mounted workspace.
Always enable S3 versioning on your S3 Workspace bucket as a precaution if you enable write access. Strongly consider keeping mounts read-only unless write access is absolutely necessary.
Ensure that your EMR cluster's EC2 instance profile (e.g., `EMR_EC2_DefaultRole`) has `AmazonElasticMapReduceforEC2Role` managed policy or equivalent S3 read permissions. For `%execute_notebook`, additional permissions might be needed.
These magics are only compatible with traditional EMR clusters. For EMR Serverless, manage Spark configurations directly via the `SparkContext` object as a workaround for some functionalities.