Re-authenticate in the Jupyter Notebook session in Interactive Glue session when I re-authenticate my AWS credentials

0

Our AWS authentication expires after 60 minute of acquiring it. So, after 60 minutes I need to re-establish the info in .aws/credentials profile.

After starting the Jupiter notebook from the command line, I start working on the notebook in the browser.

My question is - If I am working on a notebook in the browser and the aws session expires, I normally re-establish it from the command line. But at that point, I am not able to re-establish the connection to the session from my notebook in the browser.

I keep getting this error Exception encountered while retrieving session: An error occurred (ExpiredTokenException) when calling the GetSession operation: The security token included in the request is expired

Do I always need to do ctrl-c to exit the existing jupyter session and restart that session to be able to continue working on the notebook?

Is there a way to re-establish the session in my notebook, without having to restart the notebook, the way we can do it in AWS Console? In the console, we can be in one tab working on notebook, and if the session expires, then re-authenticate and reload the working session and can continue, right?

So, on Windows - when we re-authenticate on aws, how can we refresh the notebook session without having to kill the existing session and  restart the notebook from commandline to be able to continue.

Thanks

adbdkb
asked a year ago596 views
1 Answer
0

Hello,

From 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

It seems like the assumed role is being timed out and the credentials need to be refreshed. By default, the value is set to 3600 seconds.

You can try checking the session timeout value for the IAM role that you are using to run the notebook and consider increasing the maximum session duration on the IAM console. The steps to view the duration and make changes to it are as follows:

  1. Locate the IAM console home page.
  2. Click on the Roles tab on the left of the screen.
  3. Locate the role you wish to view/modify.
  4. In the summary section, it will tell you the duration of that role before you need to refresh the credentials of that role.
  5. If you wish to modify the duration, under the Delete button on the right side, there is an Edit button. Click on the Edit button and you are able to make changes to the session duration for that role. Click save changes once the desired duration has been picked.

Requesting you to please test this and check if you see the same error again after increasing session duration for the role.  

Reference: [1] https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html

AWS
SUPPORT ENGINEER
answered a year ago
  • Thank you. We don't have permissions to modify that value, so I have to re-establish the credentials every hour. I do that in a separate command window. My question was about, how do I associate the the new session with already running Jupyter notebook after I refresh the credentials? Is that possible?

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