I am trying to run python script which has code to access s3 using boto3 sdk. I have created default profile in my windows machine.
- aws cli commands are working fine in window cmd to access s3 bucket.
- python script is also working fine in when launched manually in window cmd
I am trying to automate it through jenkins. It is failing and complaining about Invalid token.
For testing purpose i ran following command in jenkins job.
aws sts get-caller-identity --debug
ClientError: An error occurred (InvalidClientTokenId) when calling the GetCallerIdentity operation: The security token included in the request is invalid 2019-06-17 18:09:06,513 - MainThread - awscli.clidriver - DEBUG - Exiting with rc 255
An error occurred (InvalidClientTokenId) when calling the GetCallerIdentity operation: The security token included in the request is invalid Build step 'Execute Windows batch command' marked build as failure
I tried following
injecting AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN and AWS_ACCESS_KEY_ID, but no success.
Added S3 profile plugin in jenkins and tried both option IAM role and by providing access token and secret.
Its not working.
I observed that jenkins is running on System User but i have created profile in window user.Is this the problem ?