Search code examples
amazon-web-servicesmulti-factor-authenticationleapp

How can I permanently authenticate my local PC with AWS without re-entering MFA code?


I have an AWS account with MFA enabled.

I authenticate my local PC using the Leapp client which prompts for MFA code when connecting.

Unfortunately it periodically re-prompts for MFA code if I leave the PC unattended for a while.

However I have some long running jobs executing which need to maintain a permanent connection to the AWS environment.

How can I permanently authenticate my local environment with AWS (using Leapp, or other) so that I don't have to manually re-enter new MFA codes periodically?


Solution

  • If you have a long running job the job only need to be authenticated at the start of the job. If the job only conatins one command. If you have more than one there is not really anything you can do. Your session MFA token times out due to settings to the MFA. If you have access to the role that force the MFA you can change the MaxSessionDuration on it. By default it is set to 1h.