Skip to content

Commit

Permalink
Fixed the roles from all the notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
mvsusp committed Nov 29, 2017
1 parent 495bea9 commit 59da58a
Show file tree
Hide file tree
Showing 25 changed files with 67 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@
"# 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()"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@
"import pandas as pd\n",
"import numpy as np\n",
"import re\n",
"from sagemaker import get_execution_role\n",
"\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",
"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 @@ -56,14 +56,17 @@
"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()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import numpy as np\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",
"from sagemaker import get_execution_role\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",
"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 @@ -56,9 +56,9 @@
"# 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()"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,13 +327,13 @@
"# 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",
"\n",
"import os\n",
"import numpy as np\n",
"import pandas as pd"
"import pandas as pd\n",
"from sagemaker import get_execution_role\n",
"\n",
"role = get_execution_role()"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@
"import boto3\n",
"import re\n",
"import json\n",
"from sagemaker import get_execution_role\n",
"\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",
"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 @@ -66,9 +66,9 @@
"# Define IAM role\n",
"import boto3\n",
"import re\n",
"from sagemaker import get_execution_role\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)"
"role = get_execution_role()"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,15 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"%%time\n",
"import boto3\n",
"import re\n",
"from sagemaker import get_execution_role\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",
"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 @@ -45,17 +45,15 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"%%time\n",
"import boto3\n",
"import re\n",
"from sagemaker import get_execution_role\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",
"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 @@ -119,13 +119,12 @@
},
"outputs": [],
"source": [
"from sagemaker import get_execution_role\n",
"\n",
"role = get_execution_role()\n",
"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",
"\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 @@ -64,9 +64,9 @@
"# Define IAM role\n",
"import boto3\n",
"import re\n",
"from sagemaker import get_execution_role\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)"
"role = get_execution_role()"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@
"# Define IAM role\n",
"import boto3\n",
"import re\n",
"from sagemaker import get_execution_role\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)"
"role = get_execution_role()"
]
},
{
Expand Down
6 changes: 3 additions & 3 deletions introduction_to_amazon_algorithms/pca_mnist/pca_mnist.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@
"# 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()"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,9 @@
"source": [
"import boto3\n",
"import re\n",
"from sagemaker import get_execution_role\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)"
"role = get_execution_role()"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,11 @@
"import os\n",
"import boto3\n",
"import re\n",
"from sagemaker import get_execution_role\n",
"\n",
"role = get_execution_role()\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",
"\n",
"bucket='<bucket-name>' # put your s3 bucket name here, and create s3 bucket\n",
"prefix = 'sagemarker/xgboost-regression'\n",
"# customize to your bucket where you have stored the data\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,12 @@
"import copy\n",
"import time\n",
"from time import gmtime, strftime\n",
"from sagemaker import get_execution_role\n",
"\n",
"role = get_execution_role()\n",
"\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",
"\n",
"bucket='<bucket-name>' # put your s3 bucket name here, and create s3 bucket\n",
"prefix = 'sagemarker/xgboost-multiclass-classification'\n",
"# customize to your bucket where you have stored the data\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@
"import os\n",
"import boto3\n",
"import re\n",
"from sagemaker import get_execution_role\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",
"role = get_execution_role()\n",
"\n",
"bucket = '<your_s3_bucket_name_here>'# enter your s3 bucket where you will copy data and model artifacts\n",
"prefix = 'sagemaker/breast_cancer_prediction' # place to upload training files within the bucket"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@
"import boto3\n",
"import time\n",
"import re\n",
"from sagemaker import get_execution_role\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",
"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 @@ -61,9 +61,9 @@
"# 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()"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@
"# Define IAM role\n",
"import boto3\n",
"import re\n",
"from sagemaker import get_execution_role\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)"
"role = get_execution_role()"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@
"# Define IAM role\n",
"import boto3\n",
"import re\n",
"from sagemaker import get_execution_role\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)"
"role = get_execution_role()"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,13 @@
},
"outputs": [],
"source": [
"from sagemaker import get_execution_role\n",
"\n",
"role = get_execution_role()\n",
"\n",
"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",
"\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()"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,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()"
]
},
{
Expand Down

0 comments on commit 59da58a

Please sign in to comment.