Home > Mobile >  PyCharm/ IntelliJ IDEA run configuration assume AWS role with MFA
PyCharm/ IntelliJ IDEA run configuration assume AWS role with MFA

Time:12-03

In PyCharm i want to create run/ debug configuration for project that must have access to AWS resources. But first AWS user must assume the role that gives permissions, and assuming the role needs MFA.

Now i first run CLI assume-role command, than copy-paste temporary role credentials to environment variables in the run/ debug configuration. But duration of the assumed role is too short, and this process need to be repeated time-by-time, and it isn't very useful.

So- what is the best way to configure PyCharm/ IntelliJ IDEA in this case?

CodePudding user response:

So best solution i found is:

  • Run in terminal AWS CLI assume-role command (assume-role descroption). After execution of this command environment variables with temporary role credentials are created: AWS_ROLE_NAME, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_SESSION_TOKEN.
  • Get values of these variables (for example by using export command).
  • Set these variables as user environment variables in PyCharm/ IDEA run/debug configuration. Application will run with desirable role permissions.
  • Related