
Product
Redesigned Repositories Page: A Faster Way to Prioritize Security Risk
Our redesigned Repositories page adds alert severity, filtering, and tabs for faster triage and clearer insights across all your projects.
sagemaker-studio-sparkmagic-lib
Advanced tools
Python Command line tool to manage configuration of sparkmagic kernels on studio
This is a CLI tool for generating configuration of SparkMagic, Kerberos required to connect to EMR cluster. In particular, it generates following two files
SparkMagic Config: This config file contains information needed to connect SparkMagic kernel's running on studio to Livy application running on EMR. CLI obtains EMR cluster details like Ip address etc.. by describing EMR cluster
Krb5.conf: If EMR cluster uses kerberos security configuration, this library also generates krb5.conf needed for user authentication on studio
This CLI tool comes pre-installed on Studio SparkMagic Image. It can be used from any notebook created from that image.
In a notebook cell, execute following commands
%local
!sm-sparkmagic connect --cluster-id "j-xxxxxxxxx"
sample output:
Successfully read emr cluster(j-xxxxxxxx) details
SparkMagic config file is written to location /etc/sparkmagic/config.json
Completed setting up configuration files for SparkMagic to connect to EMR cluster j-xxxxxxxx
Please complete following steps to complete the connection
1. Restart kernel to complete your setup. This is required so SparkMagic can pickup generated configuration
It's very similar to non-kerberos cluster, except you can pass
!sm-sparkmagic connect --cluster-id "j-xxxxxxxx" --user-name "ec2-user"
sample output:
Please follow below steps to complete the setup:
1. Please open image terminal and run 'kinit ec2-user'(user_name: ec2-user) to get kerberos ticket
2. Restart kernel to complete your setup. This is required so SparkMagic can pickup generated configuration
To setup configuration for EMR cluster in another account, run following command
%local
!sm-sparkmagic connect --cluster-id "j-xxxxx" --role-arn "arn:aws:iam::222222222222:role/role-on-emr-cluster-account"
Install the CLI using pip.
pip install sagemaker-studio-sparkmagic-lib
Following extra permissions are required on the role to be able to describe cluster
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"elasticmapreduce:DescribeCluster",
"elasticmapreduce:DescribeSecurityConfiguration",
"elasticmapreduce:ListInstances"
],
"Resource": "arn:aws:elasticmapreduce:*:*:cluster/*"
}
]
}
make install
import sagemaker_studio_sparkmagic_lib.sparkmagic as sm
sm.connect_to_emr_cluster(cluster_id= "j-xxx", user_name="ec2-user", krb_file_override_path="/tmp/krb5.conf",
spark_magic_override_path="/tmp/config.json", restart_kernel=False)
python setup.py sdist
See CONTRIBUTING for more information.
This library is licensed under the MIT-0 License. See the LICENSE file.
FAQs
Python Command line tool to manage configuration of sparkmagic kernels on studio
We found that sagemaker-studio-sparkmagic-lib demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Our redesigned Repositories page adds alert severity, filtering, and tabs for faster triage and clearer insights across all your projects.
Security News
Slopsquatting is a new supply chain threat where AI-assisted code generators recommend hallucinated packages that attackers register and weaponize.
Security News
Multiple deserialization flaws in PyTorch Lightning could allow remote code execution when loading untrusted model files, affecting versions up to 2.4.0.