AWS CLI commands InvalidClientTokenId error

0

I was able to run a few AWS CLI commands via Jenkins pipeline. All of a sudden it stopped working with the below error. "an error occurred (invalidclienttokenid) when calling the ... operation: The security token included in the request is invalid."

I was able to run the CLI commands on the Jenkins server. It works fine. I tried removing ~/.aws and ran configure again. It still doesn't work.

1개 답변
1
수락된 답변

Are the access key and secret access key you are using activated?
If it is not activated, I believe an error will occur.
You must make sure you are using the correct access key and secret access key.
In some cases, it may be easier to reissue and set up access keys.

profile picture
전문가
답변함 9달 전
profile picture
전문가
검토됨 한 달 전
  • As I mentioned, I was able to run the CLI commands on the Jenkins server. Why would it work if it wasn't activated?

  • As I mentioned, I was able to run the CLI commands on the Jenkins server. Why would it work if it wasn't activated?

    Is it possible that someone has accidentally disabled it?

    Is it possible to share all the commands you are running? Am I correct in my understanding that it was originally running on the pipeline? Also, have you set up the credentials correctly for the OS user running the jenkins pipeline? Also, will it work if I embed the access key and secret access key in the pipeline configuration without setting them in "~/.aws"? https://plugins.jenkins.io/aws-credentials/

    pipeline {
      agent any
      stages {
        stage("s3 ls") {
          steps {
            withCredentials(
              [[
                $class: 'AmazonWebServicesCredentialsBinding',
                credentialsId: 'sandbox',
                accessKeyVariable: 'AWS_ACCESS_KEY_ID',
                secretKeyVariable: 'AWS_SECRET_ACCESS_KEY'
              ]]
            ) {
              sh '''
              aws s3 ls
              '''
            }
          }
        }
      }
    }
    
  • @Riku_Kobayashi They are iam related list commands. Yes, it was running and stopped working. I will try and let you know. Thanks.

  • I tried adding AWS credentials via Manage Credentials. It throws, AWS was not able to validate the provided access credentials.

  • Another point to check is to see if the server's time synchronization is out of sync. https://stackoverflow.com/questions/27685288/aws-was-not-able-to-validate-the-provided-access-credentials https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/set-time.html

    It is also possible that a server restart may correct the problem.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠