title: Using different aws credentials in Bitbucket pipeline
body: <p>I've a bitbucket pipeline that must have multiple aws credentials for different duties.</p>
  <p>In the first lines, I have custom ECR image. To pull it, I created an AWS user for only ECR read only permissions. access-key and secret-key parameters are the keys of that user.</p>
  <p>And in this ECR image, I embedded another AWS user's credentials to do the rest of the work (image push etc). But somehow, the credentials that I used for pulling base image running in steps too. Because of this situation, image push is being denied.</p>
  <p>I tried to use <strong>export AWS_PROFILE=deployment</strong> but it doesn't help.</p>
  <p>Is the credentials for base image pull being applied pipeline-wide?</p>
  <p>And how can I overcome with this situation?</p>
  <p>Thank you.</p>
  <pre><code>image: 
  name: &lt;ECR Image&gt;
    aws:  
      access-key: $AWS_ACCESS_KEY_ID 
      secret-key: $AWS_SECRET_ACCESS_KEY
  
  pipelines:   
    - step: 
        name: &quot;Image Build &amp; Push&quot; 
        services: 
          -docker 
          script: 
           - export AWS_PROFILE=deployment
           - export ENVIRONMENT=beta 
           - echo &quot;Environment is ${ENVIRONMENT}&quot; 
           - export DOCKER_IMAGE_BUILDER=&quot;${BITBUCKET_REPO_SLUG}:builder&quot; 
           - make clean 
           - make build BUILD_VER=${BITBUCKET_TAG}.${BITBUCKET_BUILD_NUMBER} \  APP_NAME=${BITBUCKET_REPO_SLUG} \ 
      DOCKER_IMAGE_BUILDER=${DOCKER_IMAGE_BUILDER} 
           - make test
           - docker tag ....
           - docker push .....
  </code></pre>