You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to access a S3 using awsKeyTools with AK/SK, but got a error: botocore.exceptions.ClientError: An error occurred (InvalidAccessKeyId) when calling the ListBuckets operation: The AWS Access Key Id you provided does not exist in our records.
it turns out that boto3 without param region_name cant work. i changed awsKeyTools/commands/user_info_command.py as below and fix the problem: class UserInfoCommand(Command): def run(self, line): client = boto3.client('s3',region_name="cn-north-1")# 实际生产环境region_name一定要准确填写 buckets = client.list_buckets()['Buckets'] print("\nbucket:") for bucket in buckets: print(bucket['Name']) iam = boto3.resource('iam',region_name="cn-north-1") global current_user current_user = iam.CurrentUser() print("\nUserInfo:") print("\tuser_id:\t\t", current_user.user_id)...
but i was using a low-privileged AK/SK, that code only works before bucket listing. new error was occurred: botocore.exceptions.ClientError: An error occurred (AccessDenied) when calling the GetUser operation: User: xxxxxxxxxxxxxxxxxxxxxxxxxx is not authorized to perform: iam:GetUser on resource: user dmsfiles because no identity-based policy allows the iam:GetUser action
it is better that the tool can catch some normal error from botocore and show some help.
The text was updated successfully, but these errors were encountered:
I tried to access a S3 using awsKeyTools with AK/SK, but got a error:
botocore.exceptions.ClientError: An error occurred (InvalidAccessKeyId) when calling the ListBuckets operation: The AWS Access Key Id you provided does not exist in our records.
it turns out that boto3 without param region_name cant work. i changed awsKeyTools/commands/user_info_command.py as below and fix the problem:
class UserInfoCommand(Command): def run(self, line): client = boto3.client('s3',region_name="cn-north-1")# 实际生产环境region_name一定要准确填写 buckets = client.list_buckets()['Buckets'] print("\nbucket:") for bucket in buckets: print(bucket['Name']) iam = boto3.resource('iam',region_name="cn-north-1") global current_user current_user = iam.CurrentUser() print("\nUserInfo:") print("\tuser_id:\t\t", current_user.user_id)...
but i was using a low-privileged AK/SK, that code only works before bucket listing. new error was occurred:
botocore.exceptions.ClientError: An error occurred (AccessDenied) when calling the GetUser operation: User: xxxxxxxxxxxxxxxxxxxxxxxxxx is not authorized to perform: iam:GetUser on resource: user dmsfiles because no identity-based policy allows the iam:GetUser action
it is better that the tool can catch some normal error from botocore and show some help.
The text was updated successfully, but these errors were encountered: