user15322469
user15322469

Reputation: 909

how can i renew aws iam role credentials?

I created s3 in IAM user and then created a IAM role called bill. At this time, as temporary security credentials, accessKeyId, secretAccessKey, and sessiontoken were issued for 1 hour, and I was able to access s3 with the role of bill.

However, after an hour, the token expired and I could no longer access s3. At this time, how can I update the role's credentials?

How do I renew my credentials, do I have to get credentials every hour and put them in the .env?

(post.js)

    AWS.config.update({
      accessKeyId: process.env.S3_ACCESS_KEY_ID,
      secretAccessKey: process.env.S3_SECRET_ACCESS_KEY,
      sessionToken: process.env.S3_SESSION_TOKEN,
      region: "ap-northeast-2",
    });

(.env)

            S3_ACCESS_KEY_ID="my ACCESS_KEY_ID"
            S3_SECRET_ACCESS_KEY="my SECRET_ACCESS_KEY"
            S3_SESSION_TOKEN="my SESSION_TOKEN"

Upvotes: 1

Views: 598

Answers (1)

StefanN
StefanN

Reputation: 548

You must make sure that you get a new set of credentials before the old ones expire. In some SDKs, you can use a provider that manages the process of refreshing credentials for you; check the documentation for the SDK you're using.

Best Stefan

Upvotes: 0

Related Questions