Skip to content

Commit f1df35d

Browse files
committed
fixing the us-east-2 and eu-west-1 container typos
1 parent 4acdf81 commit f1df35d

File tree

4 files changed

+131
-68
lines changed

4 files changed

+131
-68
lines changed

advanced_functionality/handling_kms_encrypted_data/handling_kms_encrypted_data.ipynb

Lines changed: 63 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,27 @@
3030
"\n",
3131
"## Setup\n",
3232
"\n",
33+
"### Prerequisites\n",
34+
"\n",
35+
"In order to successfully run this notebook, you must first:\n",
36+
"\n",
37+
"1. Have an existing KMS key from AWS IAM console or create one ([learn more](http://docs.aws.amazon.com/kms/latest/developerguide/create-keys.html)).\n",
38+
"2. Allow the IAM role used for SageMaker to encrypt and decrypt data with this key from within applications and when using AWS services integrated with KMS ([learn more](http://docs.aws.amazon.com/console/kms/key-users)).\n",
39+
"\n",
40+
"We use the `key-id` from the KMS key ARN `arn:aws:kms:region:acct-id:key/key-id`.\n",
41+
"\n",
3342
"### General Setup\n",
3443
"Let's start by specifying:\n",
3544
"* AWS region.\n",
3645
"* The IAM role arn used to give learning and hosting access to your data. See the documentation for how to specify these.\n",
37-
"* The S3 bucket that you want to use for training and model data.\n",
38-
"\n",
39-
"### KMS key setup\n",
40-
"1. Use an existing KMS key from AWS IAM console or create one ([learn more](http://docs.aws.amazon.com/kms/latest/developerguide/create-keys.html)).\n",
41-
"2. Allow the IAM role used for SageMaker to encrypt and decrypt data with this key from within applications and when using AWS services integrated with KMS ([learn more](http://docs.aws.amazon.com/console/kms/key-users)).\n",
42-
"\n",
43-
"We use the `key-id` from the KMS key ARN `arn:aws:kms:region:acct-id:key/key-id`."
46+
"* The S3 bucket that you want to use for training and model data."
4447
]
4548
},
4649
{
4750
"cell_type": "code",
4851
"execution_count": null,
4952
"metadata": {
53+
"collapsed": true,
5054
"isConfigCell": true
5155
},
5256
"outputs": [],
@@ -65,9 +69,9 @@
6569
"assumed_role = boto3.client('sts').get_caller_identity()['Arn']\n",
6670
"role = re.sub(r'^(.+)sts::(\\d+):assumed-role/(.+?)/.*$', r'\\1iam::\\2:role/\\3', assumed_role)\n",
6771
"\n",
68-
"kms_key_id = '<bring your own key-id>'\n",
72+
"kms_key_id = '<your_kms_key_arn_here>'\n",
6973
"\n",
70-
"bucket='<s3 bucket>' # put your s3 bucket name here, and create s3 bucket\n",
74+
"bucket='<your_s3_bucket_name_here>' # put your s3 bucket name here, and create s3 bucket\n",
7175
"prefix = 'sagemarker/kms-new'\n",
7276
"# customize to your bucket where you have stored the data\n",
7377
"bucket_path = 'https://s3-{}.amazonaws.com/{}'.format(region,bucket)"
@@ -89,7 +93,9 @@
8993
{
9094
"cell_type": "code",
9195
"execution_count": null,
92-
"metadata": {},
96+
"metadata": {
97+
"collapsed": true
98+
},
9399
"outputs": [],
94100
"source": [
95101
"!conda install -y -c conda-forge scikit-learn"
@@ -98,7 +104,9 @@
98104
{
99105
"cell_type": "code",
100106
"execution_count": null,
101-
"metadata": {},
107+
"metadata": {
108+
"collapsed": true
109+
},
102110
"outputs": [],
103111
"source": [
104112
"from sklearn.datasets import load_boston\n",
@@ -125,7 +133,9 @@
125133
{
126134
"cell_type": "code",
127135
"execution_count": null,
128-
"metadata": {},
136+
"metadata": {
137+
"collapsed": true
138+
},
129139
"outputs": [],
130140
"source": [
131141
"from sklearn.model_selection import train_test_split\n",
@@ -136,7 +146,9 @@
136146
{
137147
"cell_type": "code",
138148
"execution_count": null,
139-
"metadata": {},
149+
"metadata": {
150+
"collapsed": true
151+
},
140152
"outputs": [],
141153
"source": [
142154
"def write_file(X, y, fname):\n",
@@ -154,7 +166,9 @@
154166
{
155167
"cell_type": "code",
156168
"execution_count": null,
157-
"metadata": {},
169+
"metadata": {
170+
"collapsed": true
171+
},
158172
"outputs": [],
159173
"source": [
160174
"train_file = 'train.csv'\n",
@@ -175,7 +189,9 @@
175189
{
176190
"cell_type": "code",
177191
"execution_count": null,
178-
"metadata": {},
192+
"metadata": {
193+
"collapsed": true
194+
},
179195
"outputs": [],
180196
"source": [
181197
"s3 = boto3.client('s3')\n",
@@ -217,20 +233,24 @@
217233
{
218234
"cell_type": "code",
219235
"execution_count": null,
220-
"metadata": {},
236+
"metadata": {
237+
"collapsed": true
238+
},
221239
"outputs": [],
222240
"source": [
223241
"containers = {'us-west-2': '433757028032.dkr.ecr.us-west-2.amazonaws.com/xgboost:latest',\n",
224242
" 'us-east-1': '811284229777.dkr.ecr.us-east-1.amazonaws.com/xgboost:latest',\n",
225-
" 'us-east-2': '825641698319.dkr.ecr.us-east-1.amazonaws.com/xgboost:latest',\n",
226-
" 'eu-west-1': '685385470294.dkr.ecr.us-east-1.amazonaws.com/xgboost:latest'}\n",
243+
" 'us-east-2': '825641698319.dkr.ecr.us-east-2.amazonaws.com/xgboost:latest',\n",
244+
" 'eu-west-1': '685385470294.dkr.ecr.eu-west-1.amazonaws.com/xgboost:latest'}\n",
227245
"container = containers[boto3.Session().region_name]"
228246
]
229247
},
230248
{
231249
"cell_type": "code",
232250
"execution_count": null,
233-
"metadata": {},
251+
"metadata": {
252+
"collapsed": true
253+
},
234254
"outputs": [],
235255
"source": [
236256
"%%time\n",
@@ -323,7 +343,9 @@
323343
{
324344
"cell_type": "code",
325345
"execution_count": null,
326-
"metadata": {},
346+
"metadata": {
347+
"collapsed": true
348+
},
327349
"outputs": [],
328350
"source": [
329351
"%%time\n",
@@ -362,7 +384,9 @@
362384
{
363385
"cell_type": "code",
364386
"execution_count": null,
365-
"metadata": {},
387+
"metadata": {
388+
"collapsed": true
389+
},
366390
"outputs": [],
367391
"source": [
368392
"from time import gmtime, strftime\n",
@@ -392,7 +416,9 @@
392416
{
393417
"cell_type": "code",
394418
"execution_count": null,
395-
"metadata": {},
419+
"metadata": {
420+
"collapsed": true
421+
},
396422
"outputs": [],
397423
"source": [
398424
"%%time\n",
@@ -430,7 +456,9 @@
430456
{
431457
"cell_type": "code",
432458
"execution_count": null,
433-
"metadata": {},
459+
"metadata": {
460+
"collapsed": true
461+
},
434462
"outputs": [],
435463
"source": [
436464
"runtime_client = boto3.client('sagemaker-runtime')"
@@ -439,7 +467,9 @@
439467
{
440468
"cell_type": "code",
441469
"execution_count": null,
442-
"metadata": {},
470+
"metadata": {
471+
"collapsed": true
472+
},
443473
"outputs": [],
444474
"source": [
445475
"import sys\n",
@@ -478,7 +508,9 @@
478508
{
479509
"cell_type": "code",
480510
"execution_count": null,
481-
"metadata": {},
511+
"metadata": {
512+
"collapsed": true
513+
},
482514
"outputs": [],
483515
"source": [
484516
"%%time\n",
@@ -510,23 +542,18 @@
510542
{
511543
"cell_type": "code",
512544
"execution_count": null,
513-
"metadata": {},
545+
"metadata": {
546+
"collapsed": true
547+
},
514548
"outputs": [],
515549
"source": [
516-
"client.delete_endpoint(EndpointName=endpoint_name)"
550+
"#client.delete_endpoint(EndpointName=endpoint_name)"
517551
]
518-
},
519-
{
520-
"cell_type": "code",
521-
"execution_count": null,
522-
"metadata": {},
523-
"outputs": [],
524-
"source": []
525552
}
526553
],
527554
"metadata": {
528555
"kernelspec": {
529-
"display_name": "Environment (conda_python3)",
556+
"display_name": "conda_python3",
530557
"language": "python",
531558
"name": "conda_python3"
532559
},
@@ -540,7 +567,7 @@
540567
"name": "python",
541568
"nbconvert_exporter": "python",
542569
"pygments_lexer": "ipython3",
543-
"version": "3.6.3"
570+
"version": "3.6.2"
544571
},
545572
"notice": "Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with the License. A copy of the License is located at http://aws.amazon.com/apache2.0/ or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License."
546573
},

0 commit comments

Comments
 (0)