簡體   English   中英

從 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:調用 SearchPlaceIndexForText 操作時發生錯誤 (AccessDeniedException):用戶:arn:aws:sts::713361781863:assumed-role/AmazonSageMaker-ExecutionRole-20220208T112132/SageMaker 無權執行:geo:SearchPlaceIndexForText 資源:arn: aws:geo:us-east-1:713361781863:place-index/explore.place

如果我從本地 python 運行相同的代碼,我會得到正確的響應。 我想是將 Sagemaker 連接到 AWS 位置服務的權限問題——我如何授予對 sagemaker 的訪問權限/更新我的 IAM?

謝謝!

您可以將內聯策略添加到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"
        }
    ]
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM