Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix aws region error "ValueError: Must setup local AWS configuration with a region supported by SageMaker"

I am running sagemaker for the first time from my laptop. When I try to start the session I get this error ValueError: Must setup local AWS configuration with a region supported by SageMaker

Local config is set to eu-west-1 which is supported by Sagemaker.

I changed the region to us-west-2 and back and nothing changed. Of course I restarted the notebook kernel after each change just in case.

import boto3

import re

import os

import numpy as np

import pandas as pd

import sagemaker as sage

boto_session = boto3.Session(profile_name="bennu")

session = sage.Session(boto_session=boto_session) #this is where the error appears

I expect the session to start and to move on to the next step. The full notebook is here https://github.com/PacktPublishing/Hands-On-Machine-Learning-Using-Amazon-SageMaker-v-/blob/master/section_1/train_and_deploy_your_first_model_on_sagemaker.ipynb

like image 244
user2957674 Avatar asked Apr 26 '19 14:04

user2957674


1 Answers

You need to set the Region in the config file as asked by AWS documentation. You can find the location here:

~/.aws/config on Linux, macOS, or Unix

C:\Users\USERNAME\.aws\config on Windows

This file should contain lines in the following format:

[default]
region = your_aws_region

Example, in my case, it needs to be region = ap-southeast-2

like image 55
Avi Avatar answered Sep 16 '22 12:09

Avi