Skip to content

Instantly share code, notes, and snippets.

@philippschmalen
Last active February 21, 2021 09:02
Show Gist options
  • Save philippschmalen/dfe1e96db2d36b5f5ab151bebcfee8f5 to your computer and use it in GitHub Desktop.
Save philippschmalen/dfe1e96db2d36b5f5ab151bebcfee8f5 to your computer and use it in GitHub Desktop.
AWS Sagemaker session info
import boto3
from sagemaker import Session
from sagemaker import get_execution_role
def session_info():
"""Prints and return Sagemaker session info"""
# Session parameters for info
sagemaker_session = Session()
region = boto3.session.Session().region_name
role = get_execution_role()
print("SESSION INFO\n"+'-'*42)
print("Session:{}\nRegion:{}\nRole:{}\n".format(sagemaker_session, region, role))
return sagemaker_session, region, role
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment