create_login_profile methode return error #8590
Labels
needs-triage
This issue or PR still needs to be triaged.
source-distribution
cli v2 source distritbution related issues
Describe the issue
import boto3
import string
import random
import pprint
aws_session = boto3.session.Session()
iam_client = aws_session.client('iam')
username = input("Enter the username to be created: ")
def random_password(S=10):
password = ''.join(random.choices(string.ascii_letters + string.digits + string.punctuation, k = S))
return str(password) # return the random data
PWD = random_password()
response = iam_client.create_login_profile(
UserName=username,
Password=PWD,
PasswordResetRequired=False
)
pprint(f"Your username is: {username}")
pprint(f"Your password is: {PWD}")
Additional Information/Context
Enter the username to be created: testlogin34
after exe file this error messages appear
Traceback (most recent call last):
File "/home/aladdin/AWS-project/python-handon/IAM_login.py", line 20, in
response = iam_client.create_login_profile(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/botocore/client.py", line 530, in _api_call
return self._make_api_call(operation_name, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/botocore/client.py", line 964, in _make_api_call
raise error_class(parsed_response, operation_name)
botocore.errorfactory.NoSuchEntityException: An error occurred (NoSuchEntity) when calling the CreateLoginProfile operation: The user with name testlogin34 cannot be found
CLI version used
aws-cli/2.12.0 Python/3.11.6
Environment details (OS name and version, etc.)
Linux/6.5.0-25-generic source/x86_64.ubuntu.23 prompt/off
The text was updated successfully, but these errors were encountered: