How to pass credentials in Glue Notebooks - Interactive Session using Magic Commands to override the 1 hour temporary token expiration

0

Hi, If I start the notebook via the console the token/credentials expire after one hour, Gives the following error "Exception encountered while retrieving session: An error occurred (ExpiredTokenException) when calling the GetSession operation: The security token included in the request is expired " .

I am guessing this is happening since its using temporary credentials by default. How does one pass the credentials using the magic commands such that credentials do not expire or workaround?

I can run notebooks locally using the profile in local .aws folder, but can't use TAGS for the sessions to account for costs.

1 Answer
0

From the console Glue notebook, I tried running %iam_role my-glue-role magic to reset the IAM role and that seemed to do the trick.

You are already connected to session axxxxxxx-2xxxx-4xxx-bxxx-0xxxxxxx. Your change will not reflect in the current session, but it will affect future new sessions. 

Current iam_role is arn:aws:iam::xxxxxxxxx:role/my-glue-role
iam_role has been set to my-glue-role.

If you are doing it using an API in your computer, you can increase the maximum session duration expiration for temporary credentials for IAM roles using the DurationSeconds parameter for your use case.

profile pictureAWS
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions