Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Credentials Refreshed but Still Expired

Anyone has any idea what the following error means?

#aws s3 ls

Credentials were refreshed, but the refreshed credentials are still expired.

I running it from the command line on the server, have already updated the keys couple of time but getting this error which i haven't seen before

like image 453
sjm Avatar asked Jun 11 '18 15:06

sjm


People also ask

How do I refresh AWS temporary credentials?

Currently, the only way to refresh a session token is to create a new MongoClient with a new MongoCredential. Additionally, there are some use cases for obtaining session tokens that the driver does not support, e.g. the Elastic Kubernetes Service (EKS).

Do AWS credentials expire?

If your application uses temporary credentials when creating an AWS client, then the credentials expire at the time interval specified during their creation. You must refresh the credentials before they expire. Another reason for expiration is using the incorrect time.

How do you fix the security token included in the request is invalid?

The error "the Security Token included in the Request in Invalid" can occur for multiple reasons: The user's credentials are inactive. Open the IAM console, click on the user, and in the Security Credentials tab, make sure the security credentials of the user are active.

How do I delete AWS credentials?

To remove a setting, delete the corresponding setting in your config and credentials files. Run this command to quickly set and view your credentials, Region, and output format. The following example shows sample values. You can set any credentials or configuration settings using aws configure set .


1 Answers

I spoke with AWS support about this and they provided a resolution that does not involve changing TZs. What they advised was to check the IAM role assigned to your instanc.

Run this from the affected instance.

curl -v http://169.254.169.254/latest/meta-data/iam/security-credentials/IAM-ROLE

Check the expiration date of the

{
  "Code" : "",
  "LastUpdated" : "",
  "Type" : "",
  "AccessKeyId" : "",
  "SecretAccessKey" : "",
  "Token" : "",
  **"Expiration" : ""**

}

In my case, the expiration date showed a value from yesterday. These are temporary credentials that should refresh every so often but in this case, they refreshed but the expiration date did not change. This explains the error AWS Credentials Refreshed but Still Expired

To resolve

Simply unattach and re-attach the role associated with your instance to get new temporary credentials and try the S3 command again.

like image 193
vr00n Avatar answered Oct 08 '22 23:10

vr00n