Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
575 views
in Technique[技术] by (71.8m points)

amazon web services - Admin access to AWS console, but no access via CLI

I use a few different acounts and keep all the credentials in ~/.aws/credentials. CLI works fine on all other accounts, so it's not a configuration issue. The only taht works is aws sts get-caller-identity.

The strange thing is that I belong to the Administrator group (as does everyone for now) and none of us have CLI access, despite having access keys and full Admin permissions.

I though it's because of MFA, but I use another account with MFA just fine through CLI. There's also this policy on the account (but it doesn't look restrictive?):

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Action": [
        "iam:ListAccountAliases",
        "iam:ListUsers",
        "iam:GetAccountSummary",
        "iam:GetAccountPasswordPolicy"
      ],
      "Resource": "*",
      "Effect": "Allow",
      "Sid": "AllowAllUsersToListAccounts"
    },
    {
      "Action": [
        "iam:ChangePassword",
        "iam:CreateLoginProfile",
        "iam:DeleteLoginProfile",
        "iam:GetLoginProfile",
        "iam:ListAccessKeys",
        "iam:UpdateLoginProfile",
        "iam:ListSigningCertificates",
        "iam:ListSSHPublicKeys",
        "iam:GetSSHPublicKey",
        "iam:UploadSSHPublicKey",
        "iam:DeleteSSHPublicKey"
      ],
      "Resource": [
        "arn:aws:iam::____________:user/${aws:username}"
      ],
      "Effect": "Allow",
      "Sid": "AllowIndividualUserToSeeAndManageTheirOwnAccountInformation"
    },
    {
      "Action": [
        "iam:ListVirtualMFADevices",
        "iam:ListMFADevices"
      ],
      "Resource": [
        "arn:aws:iam::____________:mfa/*",
        "arn:aws:iam::____________:user/${aws:username}"
      ],
      "Effect": "Allow",
      "Sid": "AllowIndividualUserToListTheirOwnMFA"
    },
    {
      "Action": [
        "iam:CreateVirtualMFADevice",
        "iam:RequestSmsMfaRegistration",
        "iam:FinalizeSmsMfaRegistration",
        "iam:EnableMFADevice",
        "iam:ResyncMFADevice"
      ],
      "Resource": [
        "arn:aws:iam::____________:mfa/${aws:username}",
        "arn:aws:iam::____________:user/${aws:username}"
      ],
      "Effect": "Allow",
      "Sid": "AllowIndividualUserToManageTheirOwnMFA"
    }
  ]
}

What could it be?

question from:https://stackoverflow.com/questions/65899296/admin-access-to-aws-console-but-no-access-via-cli

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

There is no concept of "no CLI access". The AWS CLI is a Python program that uses the AWS SDK for Python (boto3) to make API calls. Each API call is assessed individually when received by AWS.

The error message you provided is saying that the user is not allowed to list Amazon S3 buckets, which would be accurate because the policy you provided does not grant any permissions for Amazon S3.

The other error mentions an explicit deny -- so either it is not using the policy you have listed, or a Service control policy is in force, which is limiting the API calls that are permitted.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...