aws-vault like tool for Okta authentication
aws-oktaallows you to authenticate with AWS using your Okta credentials.
⚠️ As per #278, development and maintenance of
aws-oktais halted. If you're not already using it, now would be a bad time to start. ⚠️
You can install with
$ brew install aws-okta
Shout-out to the fine maintainers of the core formula.
See docs/windows.md for information on getting this working with Windows.
$ aws-okta add
This will prompt you for your Okta organization, custom domain, region, username, and password. These credentials will then be stored in your keyring for future use.
$ aws-okta exec --
Exec will assume the role specified by the given aws config profile and execute a command with the proper environment variables set. This command is a drop-in replacement for
aws-vault execand accepts all of the same command line flags:
$ aws-okta help exec exec will run the command specified with aws credentials set in the environment
Usage: aws-okta exec --
Flags: -a, --assume-role-ttl duration Expiration time for assumed role (default 1h0m0s) -h, --help help for exec -t, --session-ttl duration Expiration time for okta role session (default 1h0m0s)
Global Flags: -b, --backend string Secret backend to use [kwallet secret-service file] (default "file") -d, --debug Enable debug logging
aws-oktacan also be used to authenticate
kubectlto your AWS EKS cluster. Assuming you have installed
kubectl, setup your kubeconfig and installed
aws-iam-authenticator, you can now access your EKS cluster with
kubectl. Note that on a new cluster, your Okta CLI user needs to be using the same assumed role as the one who created the cluster. Otherwise, your cluster needs to have been configured to allow your assumed role.
$ aws-okta exec -- kubectl version --short
Likewise, most Kubernetes projects should work, like Helm and Ark.
$ aws-okta exec -- helm version --short
aws-oktaassumes that your base role is one that has been configured for Okta's SAML integration by your Okta admin. Okta provides a guide for setting up that integration here. During that configuration, your admin should be able to grab the AWS App Embed URL from the General tab of the AWS application in your Okta org. You will need to set that value in your
~/.aws/configfile, for example:
[okta] aws_saml_url = home/amazon_aws/0ac4qfegf372HSvKF6a3/965
Next, you need to set up your base Okta role. This will be one your admin created while setting up the integration. It should be specified like any other aws profile:
[profile okta-dev] role_arn = arn:aws:iam:::role/ region =
Your setup may require additional roles to be configured if your admin has set up a more complicated role scheme like cross account roles. For more details on the authentication process, see the internals section.
aws_saml_urlcan be set in the "okta" ini section, or on a per profile basis. This is useful if, for example, your organization has several Okta Apps (i.e. one for dev/qa and one for prod, or one for internal use and one for integrations with third party providers). For example:
[okta] # This is the "default" Okta App aws_saml_url = home/amazon_aws/cuZGoka9dAIFcyG0UllG/214
This profile uses the default Okta app
role_arn = arn:aws:iam:::role/
This is a distinct Okta App
aws_saml_url = home/amazon_aws/woezQTbGWUaLSrYDvINU/214 role_arn = arn:aws:iam:::role/
This profile uses the "integrations-auth" Okta app combined with secondary role assumption
source_profile = integrations-auth role_arn = arn:aws:iam:::role/
This stores the Okta session in a separate item in the Keyring.
This is useful if the Okta session is used or modified by other applications
and needs to be isolated from other sessions. It is also useful for
development versions or multiple versions of aws-okta running.
okta_session_cookie_key = okta-session-cookie-test role_arn = arn:aws:iam:::role/
The configuration above means that you can use multiple Okta Apps at the same time and switch between them easily.
ini aws-okta add --account=account-a aws-okta add --account=account-b
define keyring key for each profile: ```ini [profile account-a]
awssamlurl = home/amazonaws/woezQTbGWUaLSrYDvINU/214 rolearn = arn:aws:iam:::role/ oktaaccountname = account-a
[profile account-b] awssamlurl = home/amazonaws/woezQTbGaDAA4rYDvINU/123 rolearn = arn:aws:iam:::role/ oktaaccountname = account-b ```
The default TTLs for both the initial SAML assumed role and secondary AWS assumed roles are 1 hour. This means that AWS credentials will expire every hour.
In addition to specifying session and AWS assume role TTLs with command-line flags, they can be set using environment variables.
export AWS_SESSION_TTL=1h export AWS_ASSUME_ROLE_TTL=1h
The AWS assume role TTL can also be set per-profile in the aws config:
# Example with an initial and secondary role that are configured with a max session duration of 12 hours [profile ttldemo] aws_saml_url = home/amazon_aws/cuZGoka9dAIFcyG0UllG/214 role_arn = arn:aws:iam:::role/ session_ttl = 12h
[profile ttldemo-role] source_profile = ttldemo role_arn = arn:aws:iam:::role/ assume_role_ttl = 12h
If you have a single MFA factor configured, that factor will be automatically selected. By default, if you have multiple available MFA factors, then you will be prompted to select which one to use. However, if you have multiple factors and want to specify which factor to use, you can do one of the following:
aws-oktaprovides shell completion support for BASH and ZSH via the
We use 99design's keyring package that they use in
aws-vault. Because of this, you can choose between different pluggable secret storage backends just like in
aws-vault. You can either set your backend from the command line as a flag, or set the
For Linux / Ubuntu add the following to your bash config / zshrc etc:
This flag enables a new secure session cache that stores all sessions in the same keyring item. For macOS users, this means drastically fewer authorization prompts when upgrading or running local builds.
No provision is made to migrate sessions between session caches.
Implemented in https://github.com/segmentio/aws-okta/issues/146.
If you're developing in Linux, you'll need to get
libusb. For Ubuntu, install the libusb-1.0-0-dev or use the
Dockerfileprovided in the repo.
Pushing a new tag will cause Circle to automatically create and push a linux release. After this is done, you should run (from a mac):
$ export CIRCLE_TAG=`git describe --tags` $ make release-mac
aws-oktaincludes some usage analytics code which Segment uses internally for tracking usage of internal tools. This analytics code is turned off by default, and can only be enabled via a linker flag at build time, which we do not set for public github releases.
We use the following multiple step authentication: