So I was using boto3 to connect with AWS WorkMail. I used one of my IAM User and gave the full WoekMail Permission to that user. I have an organization created and I wanted to programatically create an user for it using one of their API .
So my code looks something like this:
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='********'
)
So I keep getting this error:
botocore.errorfactory.OrganizationNotFoundException: An error occurred (OrganizationNotFoundException) when calling the CreateUser operation: Could not find organization with id 'm-69a01**********************848eb'
Just to make sure I double-checked my Organisation ID and have attached a screenshot. I am not sure if this is the right Organisation ID to be used with this API.
Found my mistake, the aws credentials was set to the us-west-2
region while my organization was present in us-east-1
.
So as I cannot change my Organization region, I changed my region in my ~/.aws/config
to the same region as my organization and used the same code and it worked like a charm.
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='********'
)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.