Package: pyokta-aws-cli-assume-role
pyokta-aws-cli-assume-roleOkta-AWS auth tool for humansIf you login to AWS via Okta SAML federation and assume an IAM role, this tool will help you easily achieve pragmatic access to AWS via theaws cliandSDKs. Also helpful for runningterraform/terragrunt,packer, andcredstashwith iam roles.Replacesokta-aws-cli-assume-roleNOTICE: This project is still in rapid development phase. You cansubscribe to new release notifications via github. Upgrade to the most recent release viapip install --upgrade --no-cache-dir pyokta-aws-cli-assume-role.Table of ContentsSupportWhy a new tool?Getting StartedRequirementsInstallConfigureInteractiveConfig fileUsageHow it worksRoadmapSupportMFA: SMSMFA: Okta mobile appAll major operating systems (Linux, Windows, Mac).Pleasecreate an issuefor bugs or feature requests (if not already mentioned in roadmap or other issues).Why a new tool?Benefits over existing toolNo PATH changes or overriding aws executables - you're still using native awscli.Supports multiple tenants.One consistent config file for all tenants.Env var changes are 100% optional.Cleaner https error output.Easy to install.JVM not required.Existing tool features missing in this toolThese features are planned to be supported in the near future. Seeroadmap.Interactively select from multiple mfa options.Set desired mfa option via cli args, env vars, or config file.Support Okta mobile app mfa (currently only sms is verified to work).Cross-OS compatibilityOkta token caching/refresh.Getting StartedRequirementspython 3.5+pipawscli:pip install --upgrade awscliInstallpip install --upgrade --no-cache-dir pyokta-aws-cli-assume-roleTo check the install and output the current version, run:pyokta-aws --versionConfigureConfiguration can be input via cli args, env vars, or the pyokta-aws config file described above. Configuration takes presidence as follows:cli args > env vars > config file. For all supported args and env vars, runpyokta-aws --helpandpyokta-aws [COMMAND] --help.InteractiveRunpyokta-aws configurefor interactive configuration (WIP).Config fileDefault configuration file location is~/.pyokta_aws/config.Example config file:[my-aws-profile]
region = us-east-1
okta_org = example.okta.com
okta_aws_app_url = https://example.okta.com/home/amazon_aws/123456789
aws_role_to_assume = arn:aws:iam::987654321:role/AWSAdmin
aws_idp = arn:aws:iam::987654321:saml-provider/Okta
username = johnsmith
sts_duration = 14400
mfa_choice = smsregion: Target AWS region. (Will override default region in target aws cli profile)okta_org: Base domain for okta org.okta_aws_app_url: Okta app url (can be found by hovering over aws app chiclet).aws_role_to_assume: Found in AWS console underIAM > Roles > <role_id>. Look forARN.aws_idp: Found in AWS console underIAM > Identity Providers > <provider_id>. Look forARN.username: (optional) Okta username.password: (optional)it is recommended to omit or leave it blankand enter it interactively.sts_duration: (optional) Duration (in seconds) to keep token alive. Max duration found inIAM > Identity Providers > <provider_id>.mfa_choice: (optional) If you have multiple MFA factors registered, you can skip interactive factor selection by setting preferred mfa choice. Current options aresmsandapp(i.e.Okta mobile app).UsageTo authenticate via okta and assume an aws profile, run:pyokta-aws auth --profile <aws_profile>For all supported auth args, runpyokta-aws auth --help.For all supported commands, runpyokta-aws --help.How it worksThe mainpyokta-aws authcommand authenticates with Okta and aquires a temporary set of credentials from AWS STS. These credentials get written to your local aws credentials file. This allows theaws cliand other tools liketerraform/terragrunt,packer, andcredstashto run as expected without needing to override the awscli executable or export environment variables.Before auth happens, your local aws cli config profile is updated via the profile and region set in the pyokta-aws config. Treat your pyokta-aws config file as the single source of truth for aws cli config when authenticating with Okta.Roadmappypi packagecli and settings loaderssupport multi-tenant settingsci (testing):construction_worker:okta authokta 2fa (sms)get saml from okta appaws auth via okta authaws config if not previously setupbasic documentation:pencil:support multiple 2fa methodsinteractive initial config:children_crossing:readthedocs:pencil:many more testswindows support:checkered_flag:ci/cd (deploy to pypi)?aws role list selection in interactive mode:children_crossing:okta 2fa (okta mobile app)push notification 2fause context managers to auto-cancel okta verifications on cancelokta token cache/refresh to speedup multiple logins:children_crossing::dog: