Skip to content

Fixed: role for change in ezcrc #120

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,9 @@
"prefix = 'sagemaker/data_distribution_types'\n",
"\n",
"# Define IAM role\n",
"import boto3\n",
"import re\n",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure that boto3 and re aren't used anywhere else in the notebooks where we're removing this import?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Went back and added it in cases where it was. Sorry, was making these changes fast and thought about that after the fact.

" \n",
"assumed_role = boto3.client('sts').get_caller_identity()['Arn']\n",
"role = re.sub(r'^(.+)sts::(\\d+):assumed-role/(.+?)/.*$', r'\\1iam::\\2:role/\\3', assumed_role)"
"from sagemaker import get_execution_role\n",
"\n",
"role = get_execution_role()\n"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@
"\n",
"region = boto3.Session().region_name\n",
"\n",
"assumed_role = boto3.client('sts').get_caller_identity()['Arn']\n",
"role = re.sub(r'^(.+)sts::(\\d+):assumed-role/(.+?)/.*$', r'\\1iam::\\2:role/\\3', assumed_role)\n",
"from sagemaker import get_execution_role\n",
"\n",
"role = get_execution_role()\n",
"\n",
"kms_key_id = '<your-kms-key-id>'\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,9 @@
"prefix = 'sagemaker/kmeans_byom'\n",
" \n",
"# Define IAM role\n",
"import boto3\n",
"import re\n",
" \n",
"assumed_role = boto3.client('sts').get_caller_identity()['Arn']\n",
"role = re.sub(r'^(.+)sts::(\\d+):assumed-role/(.+?)/.*$', r'\\1iam::\\2:role/\\3', assumed_role)"
"from sagemaker import get_execution_role\n",
"\n",
"role = get_execution_role()\n"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
"import pandas as pd\n",
"import numpy as np\n",
"import time\n",
"\n",
"assumed_role = boto3.client('sts').get_caller_identity()['Arn']\n",
"role = re.sub(r'^(.+)sts::(\\d+):assumed-role/(.+?)/.*$', r'\\1iam::\\2:role/\\3', assumed_role)\n",
"from sagemaker import get_execution_role\n",
"\n",
"role = get_execution_role()\n",
"\n",
"bucket = '<S3 bucket>'\n",
"prefix = 'sagemaker/parquet'"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,9 @@
"prefix = 'sagemaker/r_byo'\n",
" \n",
"# Define IAM role\n",
"import boto3\n",
"import re\n",
" \n",
"assumed_role = boto3.client('sts').get_caller_identity()['Arn']\n",
"role = re.sub(r'^(.+)sts::(\\d+):assumed-role/(.+?)/.*$', r'\\1iam::\\2:role/\\3', assumed_role)"
"from sagemaker import get_execution_role\n",
"\n",
"role = get_execution_role()\n"
]
},
{
Expand All @@ -75,6 +73,7 @@
"outputs": [],
"source": [
"import time\n",
"import boto3\n",
"import json\n",
"import os\n",
"import pandas as pd\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,11 +325,9 @@
"prefix = 'scikit-byo-iris'\n",
"\n",
"# Define IAM role\n",
"import boto3\n",
"import re\n",
" \n",
"assumed_role = boto3.client('sts').get_caller_identity()['Arn']\n",
"role = re.sub(r'^(.+)sts::(\\d+):assumed-role/(.+?)/.*$', r'\\1iam::\\2:role/\\3', assumed_role)\n",
"from sagemaker import get_execution_role\n",
"\n",
"role = get_execution_role()\n",
"\n",
"import os\n",
"import numpy as np\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@
"\n",
"region = boto3.Session().region_name\n",
"\n",
"assumed_role = boto3.client('sts').get_caller_identity()['Arn']\n",
"role = re.sub(r'^(.+)sts::(\\d+):assumed-role/(.+?)/.*$', r'\\1iam::\\2:role/\\3', assumed_role)\n",
"from sagemaker import get_execution_role\n",
"\n",
"role = get_execution_role()\n",
"\n",
"bucket='<s3 bucket>' # put your s3 bucket name here, and create s3 bucket\n",
"prefix = 'sagemaker/xgboost-byo'\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,9 @@
"prefix = 'sagemaker/fm-mnist'\n",
" \n",
"# Define IAM role\n",
"import boto3\n",
"import re\n",
"\n",
"assumed_role = boto3.client('sts').get_caller_identity()['Arn']\n",
"role = re.sub(r'^(.+)sts::(\\d+):assumed-role/(.+?)/.*$', r'\\1iam::\\2:role/\\3', assumed_role)"
"from sagemaker import get_execution_role\n",
"\n",
"role = get_execution_role()\n"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,9 @@
"source": [
"%%time\n",
"import boto3\n",
"import re\n",
"\n",
"assumed_role = boto3.client('sts').get_caller_identity()['Arn']\n",
"role = re.sub(r'^(.+)sts::(\\d+):assumed-role/(.+?)/.*$', r'\\1iam::\\2:role/\\3', assumed_role)\n",
"from sagemaker import get_execution_role\n",
"\n",
"role = get_execution_role()\n",
"\n",
"bucket='<<bucket-name>>' # customize to your bucket\n",
"containers = {'us-west-2': '433757028032.dkr.ecr.us-west-2.amazonaws.com/image-classification:latest',\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,9 @@
"source": [
"%%time\n",
"import boto3\n",
"import re\n",
"\n",
"assumed_role = boto3.client('sts').get_caller_identity()['Arn']\n",
"role = re.sub(r'^(.+)sts::(\\d+):assumed-role/(.+?)/.*$', r'\\1iam::\\2:role/\\3', assumed_role)\n",
"from sagemaker import get_execution_role\n",
"\n",
"role = get_execution_role()\n"
"\n",
"bucket='<<bucket-name>>' # customize to your bucket\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@
"bucket = '<your_s3_bucket_name_here>'\n",
"prefix = 'sagemaker/lda_introduction'\n",
"\n",
"assumed_role = boto3.client('sts').get_caller_identity()['Arn']\n",
"role = re.sub(r'^(.+)sts::(\\d+):assumed-role/(.+?)/.*$', r'\\1iam::\\2:role/\\3', assumed_role)\n",
"\n",
"from sagemaker import get_execution_role\n",
"\n",
"role = get_execution_role()\n",
"\n",
"print('Training input/output will be stored in {}/{}'.format(bucket, prefix))\n",
"print('\\nIAM Role: {}'.format(role))"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,9 @@
"prefix = 'sagemaker/linear-mnist'\n",
" \n",
"# Define IAM role\n",
"import boto3\n",
"import re\n",
"\n",
"assumed_role = boto3.client('sts').get_caller_identity()['Arn']\n",
"role = re.sub(r'^(.+)sts::(\\d+):assumed-role/(.+?)/.*$', r'\\1iam::\\2:role/\\3', assumed_role)"
"from sagemaker import get_execution_role\n",
"\n",
"role = get_execution_role()\n"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,9 @@
"prefix = 'sagemaker/ntm_synthetic'\n",
" \n",
"# Define IAM role\n",
"import boto3\n",
"import re\n",
"\n",
"assumed_role = boto3.client('sts').get_caller_identity()['Arn']\n",
"role = re.sub(r'^(.+)sts::(\\d+):assumed-role/(.+?)/.*$', r'\\1iam::\\2:role/\\3', assumed_role)"
"from sagemaker import get_execution_role\n",
"\n",
"role = get_execution_role()\n"
]
},
{
Expand All @@ -88,6 +86,7 @@
"import numpy as np\n",
"from generate_example_data import generate_griffiths_data, plot_topic_data\n",
"import io\n",
"import boto3\n",
"import os\n",
"import time\n",
"import json\n",
Expand Down
8 changes: 3 additions & 5 deletions introduction_to_amazon_algorithms/pca_mnist/pca_mnist.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,9 @@
"prefix = 'sagemaker/pca-mnist'\n",
" \n",
"# Define IAM role\n",
"import boto3\n",
"import re\n",
" \n",
"assumed_role = boto3.client('sts').get_caller_identity()['Arn']\n",
"role = re.sub(r'^(.+)sts::(\\d+):assumed-role/(.+?)/.*$', r'\\1iam::\\2:role/\\3', assumed_role)"
"from sagemaker import get_execution_role\n",
"\n",
"role = get_execution_role()\n"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: spacing

]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,9 @@
"outputs": [],
"source": [
"import boto3\n",
"import re\n",
"\n",
"# Fetch IAM role\n",
"assumed_role = boto3.client('sts').get_caller_identity()['Arn']\n",
"role = re.sub(r'^(.+)sts::(\\d+):assumed-role/(.+?)/.*$', r'\\1iam::\\2:role/\\3', assumed_role)"
"from sagemaker import get_execution_role\n",
"\n",
"role = get_execution_role()\n"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@
"\n",
"region = boto3.Session().region_name\n",
"\n",
"assumed_role = boto3.client('sts').get_caller_identity()['Arn']\n",
"role = re.sub(r'^(.+)sts::(\\d+):assumed-role/(.+?)/.*$', r'\\1iam::\\2:role/\\3', assumed_role)\n",
"from sagemaker import get_execution_role\n",
"\n",
"role = get_execution_role()\n",
"\n",
"bucket='<bucket-name>' # put your s3 bucket name here, and create s3 bucket\n",
"prefix = 'sagemarker/xgboost-regression'\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,9 @@
"\n",
"region = boto3.Session().region_name\n",
"\n",
"assumed_role = boto3.client('sts').get_caller_identity()['Arn']\n",
"role = re.sub(r'^(.+)sts::(\\d+):assumed-role/(.+?)/.*$', r'\\1iam::\\2:role/\\3', assumed_role)\n",
"from sagemaker import get_execution_role\n",
"\n",
"role = get_execution_role()\n",
"\n",
"bucket='<bucket-name>' # put your s3 bucket name here, and create s3 bucket\n",
"prefix = 'sagemarker/xgboost-multiclass-classification'\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@
"import time\n",
"import re\n",
"\n",
"assumed_role = boto3.client('sts').get_caller_identity()['Arn']\n",
"role = re.sub(r'^(.+)sts::(\\d+):assumed-role/(.+?)/.*$', r'\\1iam::\\2:role/\\3', assumed_role)\n",
"from sagemaker import get_execution_role\n",
"\n",
"role = get_execution_role()\n",
"\n",
"# Now let's define the S3 bucket we'll used for the remainder of this example.\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,9 @@
"prefix = 'sagemaker/linear_time_series_forecast'\n",
" \n",
"# Define IAM role\n",
"import boto3\n",
"import re\n",
" \n",
"assumed_role = boto3.client('sts').get_caller_identity()['Arn']\n",
"role = re.sub(r'^(.+)sts::(\\d+):assumed-role/(.+?)/.*$', r'\\1iam::\\2:role/\\3', assumed_role)"
"from sagemaker import get_execution_role\n",
"\n",
"role = get_execution_role()\n"
]
},
{
Expand All @@ -90,6 +88,7 @@
"import pandas as pd\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import boto3\n",
"import io\n",
"import os\n",
"import time\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,9 @@
"prefix = 'sagemaker/xgboost_churn'\n",
"\n",
"# Define IAM role\n",
"import boto3\n",
"import re\n",
"\n",
"assumed_role = boto3.client('sts').get_caller_identity()['Arn']\n",
"role = re.sub(r'^(.+)sts::(\\d+):assumed-role/(.+?)/.*$', r'\\1iam::\\2:role/\\3', assumed_role)"
"from sagemaker import get_execution_role\n",
"\n",
"role = get_execution_role()\n"
]
},
{
Expand All @@ -82,6 +80,7 @@
"import pandas as pd\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import boto3",
"import io\n",
"import os\n",
"import sys\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,9 @@
"prefix = 'sagemaker/xgboost-dm'\n",
" \n",
"# Define IAM role\n",
"import boto3\n",
"import re\n",
"\n",
"assumed_role = boto3.client('sts').get_caller_identity()['Arn']\n",
"role = re.sub(r'^(.+)sts::(\\d+):assumed-role/(.+?)/.*$', r'\\1iam::\\2:role/\\3', assumed_role)"
"from sagemaker import get_execution_role\n",
"\n",
"role = get_execution_role()\n"
]
},
{
Expand All @@ -81,6 +79,7 @@
"metadata": {},
"outputs": [],
"source": [
"import boto3\n",
"import numpy as np # For matrix operations and numerical processing\n",
"import pandas as pd # For munging tabular data\n",
"import matplotlib.pyplot as plt # For charts and visualizations\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@
"bucket = '<your_s3_bucket_name_here>'\n",
"prefix = 'sagemaker/lda_science'\n",
"\n",
"assumed_role = boto3.client('sts').get_caller_identity()['Arn']\n",
"role = re.sub(r'^(.+)sts::(\\d+):assumed-role/(.+?)/.*$', r'\\1iam::\\2:role/\\3', assumed_role)\n",
"\n",
"from sagemaker import get_execution_role\n",
"\n",
"role = get_execution_role()\n",
"\n",
"print('Training input/output will be stored in {}/{}'.format(bucket, prefix))\n",
"print('\\nIAM Role: {}'.format(role))"
Expand Down
5 changes: 3 additions & 2 deletions under_development/mxnet_mnist_byom/mxnet_mnist.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,9 @@
"outputs": [],
"source": [
"import boto3, re\n",
"assumed_role = boto3.client('sts').get_caller_identity()['Arn']\n",
"role = re.sub(r'^(.+)sts::(\\d+):assumed-role/(.+?)/.*$', r'\\1iam::\\2:role/\\3', assumed_role)"
"from sagemaker import get_execution_role\n",
"\n",
"role = get_execution_role()\n"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@
},
"outputs": [],
"source": [
"import boto3, re\n",
"assumed_role = boto3.client('sts').get_caller_identity()['Arn']\n",
"role = re.sub(r'^(.+)sts::(\\d+):assumed-role/(.+?)/.*$', r'\\1iam::\\2:role/\\3', assumed_role)"
"from sagemaker import get_execution_role\n",
"\n",
"role = get_execution_role()\n"
]
},
{
Expand Down