从 Sagemaker 调用 AWS 位置 API:拒绝访问异常错误
Calling AWS Location API from Sagemaker: Access Denied Exception Error
我一直在尝试 运行 AWS Sagemaker 中的以下代码
location = boto3.client('location', region_name='us-east-1')
Response = location.search_place_index_for_text(IndexName = 'explore.place', Text = 'Boston, MA')
print(Response)
但我收到以下错误
AccessDeniedException: An error occurred (AccessDeniedException) when
calling the SearchPlaceIndexForText operation: User:
arn:aws:sts::713361781863:assumed-role/AmazonSageMaker-ExecutionRole-20220208T112132/SageMaker
is not authorized to perform: geo:SearchPlaceIndexForText on resource:
arn:aws:geo:us-east-1:713361781863:place-index/explore.place
如果我 运行 来自本地 python 的相同代码,我会得到正确的响应。我想是将 Sagemaker 连接到 AWS 位置服务的权限问题 - 我如何授予对 sagemaker/update 我的 IAM 的访问权限?
谢谢!
您可以将 inline policy 添加到 AmazonSageMaker-ExecutionRole-20220208T112132
角色:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": "geo:SearchPlaceIndexForText",
"Resource": "arn:aws:geo:us-east-1:713361781863:place-index/explore.place"
}
]
}
我一直在尝试 运行 AWS Sagemaker 中的以下代码
location = boto3.client('location', region_name='us-east-1')
Response = location.search_place_index_for_text(IndexName = 'explore.place', Text = 'Boston, MA')
print(Response)
但我收到以下错误
AccessDeniedException: An error occurred (AccessDeniedException) when calling the SearchPlaceIndexForText operation: User: arn:aws:sts::713361781863:assumed-role/AmazonSageMaker-ExecutionRole-20220208T112132/SageMaker is not authorized to perform: geo:SearchPlaceIndexForText on resource: arn:aws:geo:us-east-1:713361781863:place-index/explore.place
如果我 运行 来自本地 python 的相同代码,我会得到正确的响应。我想是将 Sagemaker 连接到 AWS 位置服务的权限问题 - 我如何授予对 sagemaker/update 我的 IAM 的访问权限?
谢谢!
您可以将 inline policy 添加到 AmazonSageMaker-ExecutionRole-20220208T112132
角色:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": "geo:SearchPlaceIndexForText",
"Resource": "arn:aws:geo:us-east-1:713361781863:place-index/explore.place"
}
]
}