title: How to load AWS credentials in Jenkins job DSL?
body: <p>I have the following DSL structure:</p>
  
  <pre><code>freeStyleJob {
    wrappers {
      credentialsBinding {
        [
           $class:"AmazonWebServicesCredentialsBinding",
           accessKeyVariable: "AWS_ACCESS_KEY_ID",
           credentialsId: "your-credential-id",
           secretKeyVariable: "AWS_SECRET_ACCESS_KEY"
        ]
       }
     }
     steps {
        // ACCESS AWS ENVIRONMENT VARIABLES HERE!
     }
  }
  </code></pre>
  
  <p>However, this does not work. What is the correct syntax to do so? For Jenkins pipelines, you can do:</p>
  
  <pre><code>withCredentials([[
  $class: "AmazonWebServicesCredentialsBinding",
  accessKeyVariable: "AWS_ACCESS_KEY_ID",
  credentialsId: "your-credential-id",
  secretKeyVariable: "AWS_SECRET_ACCESS_KEY"]]) {
    // ACCESS AWS ENVIRONMENT VARIABLES HERE!
  }
  </code></pre>
  
  <p>but this syntax does not work in normal DSL job groovy.</p>
  
  <p><strong>tl;dr</strong> how can I export AWS credentials defined by the AmazonWebServicesCredentialsBinding plugin into environment variables in Groovy job DSL? (NOT PIPELINE PLUGIN SYNTAX!)</p>