I am automating the AWS IAM user creation from Jenkins. We have multiple Accounts with programmatic access. I am trying to create user account for one account from CLI. It's working fine from CLI, but not from jenkins Pipeline.
Output through CLI
aws iam create-user --user-name --profile test tets
{
"User": {
"Path": "/",
"UserName": "tets",
"UserId": "AIDAXTRPYNIV6HK7XE43R",
"Arn": "arn:aws:iam::523012434475:user/tets",
"CreateDate": "2019-09-18T06:49:41Z"
}
node
{
stage ('creating IAM user'){
sh 'aws iam create-user --user-name --profile test $Username'
}
The config profile (test) could not be found is the error i am getting from Jenkins Pipeline.
AWS CLI is configured on jenkins server. From ssh i am able to execute all the commands.
sudo su – jenkinsaws configureReference - docs.aws.amazon.com/systems-manager/latest/userguide/… - st_rt_dl_8sudo su -jenkinsand then typingaws configureand entering the AK and SAK and if it's Windows then the first SO link I posted in my first comment should help. - st_rt_dl_8