When we configure AWS credentials on local system using AWS configure, AWS Cli commands will work but the same AWS Cli commands will not work on jenkins because local system user is different from the jenkins user and it will show the following output when we try to check AWS access key and secret key using the command “AWS Configure List” in Jenkins
But if we run the same command in local system / windows 10 CMD the output will be
If we are not getting Access key and secret key in Jenkins then we will not able to run any AWS CLI commands in Jenkins jobs/pipelines
To Troubleshoot this issue or to get the same output in Jenkins follow the below steps.
- Type Services on windows search and click on services
- Go to Jenkins service and check whether ‘log on as’ showing local system
3. Right Click on Jenkins and click on properties
4. Go to log on tab you will see it is check on Local System Account
5. Checkmark on “This Account” and click on Browse
6. Type name and check names it will add the full name click on ok
7. Type the passwords of the user and click on Apply
8. Now go to jenkins and login with credentials
9. Go to the jenkins job and click on “Build now”
10. After successful completion of the build go to the “console output of the build”
11. Now you can see that AWS Access key and Secret key in the output
Now you can run AWS CLI Commands in Jenkins.