aws / aws/amazon-sagemaker-examples

Harcoded image URI prevents running the examples in regions different than `us-west-2`

Open
#3,511 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
11k
Forks
7k
Avg merge
8h 29m
Merged PRs (30d)
8

Description

**Link to the notebook**
[https://github.com/aws/amazon-sagemaker-examples/blob/main/reinforcement_learning/bandits_recsys_movielens_testbed/bandits_movielens_testbed.ipynb](https://github.com/aws/amazon-sagemaker-examples/blob/main/reinforcement_learning/bandits_recsys_movielens_testbed/bandits_movielens_testbed.ipynb)

**Describe the bug**
The notebook uses an [hardcoded image URI](https://github.com/aws/amazon-sagemaker-examples/blob/45a9c967e917c20b243c82f2771fff4d7e9d3f7a/reinforcement_learning/bandits_recsys_movielens_testbed/bandits_movielens_testbed.ipynb?short_path=9d6777c#L299) . THis is unnecessary, and prevents running the notebook in regions different than `us-west-2`.
The notebook contains a [check to validate the region](https://github.com/aws/amazon-sagemaker-examples/blob/main/reinforcement_learning/bandits_recsys_movielens_testbed/bandits_movielens_testbed.ipynb?short_path=9d6777c#L109), but this should not be necessary.

**To reproduce**
Execute the notebook as is in a SageMaker Notebook instance in a region different than `us-west-2` ignoring the exception raised by the region check.

**Suggested fix**
replace

```python
vw_image_uri = "462105765813.dkr.ecr.us-west-2.amazonaws.com/sagemaker-rl-vw-container:adf"
```

with

```python
vw_image_uri = sagemaker.image_uris.retrieve(framework='vw', region=aws_region)
```

Contributor guide

Open the contributing guide

Research direction

Open reinforcement_learning/bandits_recsys_movielens_testbed/bandits_movielens_testbed.ipynb and inspect the region setup and the hardcoded image URI around the referenced cells. Run the notebook in a region other than us-west-2, then verify that image retrieval uses the current AWS region and the example runs without the region-specific failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, jupyter-notebook, python
Domain
cloud, machine-learning
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.