How give aws credential to jenkins pipeline

amazon-web-servicesJenkins

I have following configuration in my jenkins pipeline

s3Upload( file:'ok.txt', bucket:'my-buckeck', path:'file.txt')

Problem is s3Upload function is not taking AWS access keys that i have stored in jenkins

i tied with following code

    withAWS(profile:'Test Publisher') {
    s3Upload( file:'ok.txt', bucket:'my-buckeck', path:'file.txt')

}

s3 profile

my s3 profile in jenkins is like that. still am getting profile file could not find error. How can i upload file from jenkins to s3 using s3Upload function ?

Best Answer

To be able to upload to S3, you need to save your credentials in environment variables on your Jenkins:

AWS_DEFAULT_REGION=<region of bucket>

AWS_ACCESS_KEY_ID=<aws id>

AWS_SECRET_ACCESS_KEY=<your s3 access key>

To do that, just go to Jenkins - Manage Jenkins - Configure System - Global properties - Environment variables

Related Topic