'set aws cli profile in bash script

I am trying to set a profile for a bash script, before the script or inside of it, doesnt seem to work either way. Read many answers here that seemed to solve it easily enough. What am I missing?

jenkins@serverA:/opt/scripts/$ aws configure list
      Name                    Value             Type    Location
      ----                    -----             ----    --------
   profile                  user1           manual    --profile
access_key     ****************XYZA shared-credentials-file    
secret_key     ****************xyza shared-credentials-file    
    region                <not set>             None    None
jenkins@serverA:/opt/scripts/$ export AWS_PROFILE=user1
jenkins@serverA:/opt/scripts/$ bash -x script1.sh 

jenkins@serverA:/opt/scripts/$ bash -x script1.sh 
+ set +e
+ export AWS_PROFILE=user1
+ AWS_PROFILE=user1

+ aws s3 cp src dst --recursive
upload failed: ../../../src/LJ001-0002.wav to dest/LJ001-0002.wav An error occurred (InvalidAccessKeyId) when calling the PutObject operation: The AWS Access Key Id you provided does not exist in our records.


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source