I have an issue when I try to retrieve a file from s3. I am able to connect to the s3 bucket as expected but when I try to retrieve the file I get the below error.
The credentials are being picked up from my ./aws/credentials and I can download the same file from my local using the AWS CLI.
Any ideas what might be wrong here?
Error:
awsError
code = ExpiredToken
message = The provided token has expired.
statusCode = 400
Result, err := client.GetObject(&s3.GetObjectInput{
Bucket: &bucket,
Key: &Key,
ResponseContentType: aws.String("application/json"),
})
if err != nil {
logger.Errorf("Unable to retrieve file the file", err.Error())
return nil, http.StatusInternalServerError
}