Aws s3 suddenly failing with "Unable to locate credentials"

The build has been working correctly since it was setup (a long time ago) but as of the end of last week a step to upload build artefacts to an AWS S3 bucket is now failing with the output “Unable to locate credentials”.

The command is:
aws s3 cp [filelocation] [s3location] | sed ‘s/[^0-9]*$//g’`-[name]

The S3 credentials in the environment variables section are present and match what is in AWS. But there is a banner stating: Uh-oh! Looks like you have legacy AWS Environment Variables which are overriding the CircleCI Environment Variables you see here.

I’m not sure if the is the issue and as i am not the original maintainer of the build workflow I do not have easy access to our environment variables, so I am reluctant to press the button to “delete aws env vars” without knowing fully if it will remove any variables listed on that page.

Any help would be appreciated.
Thanks.

If you have lost access to environment variables set in a circleci job just use a shell within one of your steps and echo them to a file and then cat the resulting file. This will allow you to recover any values you no longer have documented.

Once you have all the values you should be able to safely use the clean-up button.