[英]AWS WorkMail Create User API throwing `OrganizationNotFoundException` error
所以我使用 boto3 連接 AWS WorkMail。 我使用了我的一個 IAM 用戶並將完整的 WoekMail 權限授予該用戶。 我創建了一個組織,我想使用其中一個API以編程方式為其創建一個用戶。
所以我的代碼看起來像這樣:
import boto3
from config import aws_credentials
client = boto3.client('workmail', **aws_credentials)
response = client.create_user(
OrganizationId="m-69a01**********************848eb",
Name='abhi',
DisplayName='abhi jain',
Password='********'
)
所以我不斷收到這個錯誤:
botocore.errorfactory.OrganizationNotFoundException: An error occurred (OrganizationNotFoundException) when calling the CreateUser operation: Could not find organization with id 'm-69a01**********************848eb'
只是為了確保我仔細檢查了我的組織 ID 並附上了屏幕截圖。 我不確定這是否是與此 API 一起使用的正確組織 ID。
發現我的錯誤,當我的組織存在於us-east-1
時,aws 憑據設置為us-west-2
區域。
因此,由於我無法更改我的組織區域,我將~/.aws/config
中的區域更改為與我的組織相同的區域並使用相同的代碼,它就像一個魅力。
import boto3
from config import aws_credentials
client = boto3.client('workmail', **aws_credentials)
response = client.create_user(
OrganizationId="m-69a01**********************848eb",
Name='abhi',
DisplayName='abhi jain',
Password='********'
)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.