How to load AWS credentials in Jenkins job DSL?
I found a solution to solve this problem:
wrappers { credentialsBinding { amazonWebServicesCredentialsBinding { accessKeyVariable("AWS_ACCESS_KEY_ID") secretKeyVariable("AWS_SECRET_ACCESS_KEY") credentialsId("your-credentials-id") } }}
This will lead to the desired outcome.
I'm not able to re-use Miguel's solution (even with installed aws-credentials plugin), so here is another approach with DSL configure block
configure { project -> def bindings = project / 'buildWrappers' / 'org.jenkinsci.plugins.credentialsbinding.impl.SecretBuildWrapper' / 'bindings' bindings << 'com.cloudbees.jenkins.plugins.awscredentials.AmazonWebServicesCredentialsBinding' { accessKeyVariable("AWS_ACCESS_KEY_ID") secretKeyVariable("AWS_SECRET_ACCESS_KEY") credentialsId("credentials-id") } }