SAML2AWS – Secure AWS Authentication Made Simple
SAML2AWS simplifies AWS authentication with a powerful command-line interface for SAML-based Single Sign-On (SSO). Securely authenticate through your identity provider, retrieve temporary AWS credentials, and manage multiple AWS profiles with ease. Streamline your cloud workflow with fast, reliable, and efficient AWS access.
What Is SAML2AWS?
SAML2AWS is an open-source command-line interface (CLI) tool designed to simplify AWS authentication using SAML 2.0 Single Sign-On (SSO). It enables developers, DevOps engineers, and cloud administrators to securely access AWS resources through supported identity providers and temporary AWS credentials.
Simplify Your AWS Access
SAML2AWS connects your organization's SAML-based identity provider with AWS authentication, making it easier to retrieve temporary security credentials directly from the command line.
Instead of manually managing long-lived access keys, users can authenticate through their existing identity provider and access AWS services using authorized IAM roles.
The tool works with AWS CLI and compatible development tools, helping teams manage authentication across multiple AWS accounts and environments.
How Does SAML2AWS Work?
Access AWS resources through a simple four-step authentication process.
Identity Provider Login
Authenticate through your organization's supported SAML identity provider using the configured login method.
SAML Assertion
After successful authentication, the identity provider issues a SAML assertion containing authorized AWS role information.
Temporary AWS Credentials
SAML2AWS exchanges the SAML assertion with AWS Security Token Service (STS) to retrieve temporary credentials.
Access AWS Resources
Use your temporary credentials with AWS CLI and compatible tools to access resources permitted by your IAM role.
Key Features of SAML2AWS
SAML2AWS simplifies secure AWS authentication with essential tools for managing SAML-based login, temporary credentials, and multiple AWS environments. Explore the features that make AWS command-line access easier and more efficient.
Secure SAML Authentication
Authenticate through your organization's supported SAML 2.0 identity provider and access authorized AWS resources using federated authentication and IAM roles.
Temporary AWS Credentials
Retrieve temporary AWS security credentials through AWS Security Token Service (STS). Use time-limited sessions instead of relying on permanent IAM access keys for daily tasks.
Multiple AWS Profiles
Organize credentials and authentication settings with named AWS profiles. Manage access across development, testing, and production environments.
Command-Line Integration
Run authentication commands directly from your terminal. Integrate SAML2AWS with AWS CLI and compatible tools to simplify everyday cloud workflows.
Multiple Identity Providers
Connect with supported SAML identity providers, including Okta, ADFS, and PingFederate. Authentication capabilities depend on provider settings.
Multi-Factor Authentication
Work with supported MFA methods provided by your identity provider. Add an extra authentication check while following organizational security policies.
How to Install SAML2AWS
Install SAML2AWS on Windows, macOS, or Linux. Follow the installation steps for your operating system and verify that the CLI is ready for secure SAML-based AWS authentication.
macOS
Homebrew InstallationInstall SAML2AWS using Homebrew and verify the installation directly from your macOS terminal.
$ brew install saml2aws
$ saml2aws --version
Homebrew must be installed before running these commands.
Windows
Chocolatey InstallationInstall SAML2AWS using Chocolatey and verify the installation from your Windows terminal.
choco install saml2aws
saml2aws --version
Chocolatey must be installed before running these commands.
Linux
Binary InstallationInstall SAML2AWS using a compatible Linux release binary and verify the installation from your terminal.
$ sudo mv saml2aws /usr/local/bin/
$ saml2aws --version
Download, extract, and make the Linux binary executable before installation.
Verify Your SAML2AWS Installation
Run this command to confirm that SAML2AWS is installed and accessible from your terminal.
$ saml2aws --version
How to Log In to AWS Using SAML2AWS
SAML2AWS simplifies AWS login through SAML-based authentication. Follow the steps below to authenticate with your identity provider, select an authorized AWS role, and verify your temporary AWS credentials.
Start SAML2AWS Login
Open your terminal and start authentication using your configured identity provider.
$ saml2aws login
Complete Authentication
Follow the identity provider prompts and complete any required multi-factor verification.
Select Your AWS Role
Choose an authorized AWS IAM role if prompted. SAML2AWS retrieves temporary credentials for the selected role.
Verify AWS Access
Confirm your AWS account and identity using the configured profile.
$ aws sts get-caller-identity --profile development
SAML2AWS Login Workflow
From identity verification to authorized AWS access
Identity Provider
Authenticate using your organization's SAML SSO.
SAML2AWS CLI
Process authentication and select an authorized role.
Temporary AWS Credentials
Retrieve short-lived credentials through AWS STS.
AWS Access Verified
A successful identity check returns your AWS account and role information.
Essential SAML2AWS CLI Commands
Explore commonly used SAML2AWS commands for configuring authentication, managing AWS profiles, retrieving temporary credentials, and working with AWS from your terminal.
Check Installed Version
Display the installed SAML2AWS version and confirm that the command-line tool is available on your system.
$ saml2aws --version
Configure SAML2AWS
Configure your identity provider, username, AWS profile, and authentication settings before starting an AWS login session.
$ saml2aws configure
Log In to AWS
Authenticate using your configured SAML identity provider and retrieve temporary AWS credentials for authorized access.
$ saml2aws login
Refresh AWS Credentials
Force a new authentication process when your existing temporary credentials have expired or need to be refreshed.
$ saml2aws login --force
List Available AWS Roles
Display the AWS roles available through your configured SAML authentication provider and review authorized role options.
$ saml2aws list-roles
Open AWS Console
Launch an AWS Management Console session using the credentials and authentication settings associated with your account.
$ saml2aws console
Log In with a Profile
Authenticate using a specific named profile to manage AWS account access across different environments.
$ saml2aws login --profile dev
View CLI Help
Explore available SAML2AWS commands, supported flags, configuration options, and command-line usage information.
$ saml2aws --help
Simplify AWS Authentication with CLI Commands
Use these essential SAML2AWS commands to configure authentication, manage AWS login sessions, work with named profiles, and access AWS resources through your terminal.
Using SAML2AWS with Multiple AWS Accounts
Manage AWS authentication across development, testing, and production environments using named SAML2AWS profiles. Organize account access and simplify everyday AWS CLI operations.
AWS Profile Management
Organize your AWS environments with named profiles.
Development
Profile: development
Testing
Profile: testing
Production
Profile: production
Manage Multiple AWS Profiles
Use the right profile for your AWS environment.
SAML2AWS allows users to configure named profiles for different AWS accounts and environments. Each profile helps organize authentication settings and temporary AWS credentials.
Once configured, select the required profile during login and use it with AWS CLI commands. Access permissions depend on your organization's IAM role configuration.
Example AWS Profile Commands
Authenticate with a named profile
$ saml2aws login --profile development
Verify your AWS identity
$ aws sts get-caller-identity --profile development
Organized Profiles
Manage multiple AWS environments.
Temporary Credentials
Retrieve time-limited AWS access.
AWS CLI Integration
Work with AWS from your terminal.
SAML2AWS Security Best Practices
SAML2AWS supports secure AWS authentication through SAML-based Single Sign-On and temporary AWS credentials. Following recommended security practices helps protect your authentication workflow, IAM roles, and AWS resources.
Enable Multi-Factor Authentication
Use multi-factor authentication through your supported identity provider whenever available. MFA adds another verification step to the login process and helps protect AWS accounts against unauthorized access. Follow your organization's authentication policies when using SAML2AWS.
Use Temporary AWS Credentials
SAML2AWS retrieves temporary credentials through AWS Security Token Service (STS). These credentials expire after a configured session duration, reducing the need for long-lived IAM access keys. Refresh your session when credentials expire and avoid exposing security tokens.
Follow Least-Privilege Access
Configure AWS IAM roles with only the permissions required for specific responsibilities. Temporary credentials inherit the permissions associated with the selected role. Review role assignments regularly and avoid granting unnecessary access to sensitive AWS resources.
Protect Local Credential Files
Store AWS credential files securely and apply appropriate operating system permissions. Avoid committing credentials to source control or sharing sensitive authentication information through logs and screenshots. Protect cached SAML assertions and remove unnecessary authentication data.
Secure AWS access starts with the right configuration. Combine SAML2AWS authentication with strong identity provider policies, carefully managed IAM permissions, and secure credential handling to protect your AWS environment.
Common SAML2AWS Problems and Troubleshooting
Troubleshoot common SAML2AWS authentication errors, expired AWS credentials, configuration issues, and IAM permission problems with these practical solutions.
SAML2AWS Login Failed
Login may fail because of an incorrect identity provider URL, authentication settings, or account access restrictions.
Solution: Verify your identity provider URL, username, and authentication method. Use verbose mode to review additional diagnostic information.
$ saml2aws login --verbose
Expired AWS Credentials
Temporary AWS credentials expire after the configured session duration and may cause token expiration errors.
Solution: Start a fresh SAML authentication session and retrieve new temporary AWS credentials.
$ saml2aws login --force
AWS Profile Not Found
AWS CLI cannot locate the requested profile because its name is missing or does not match the configuration.
Solution: Check the available AWS profiles and confirm that the correct profile name is being used.
$ aws configure list-profiles
AWS Access Denied
The selected IAM role may not have permission to perform the requested AWS operation.
Solution: Verify your active AWS identity and review the permissions assigned to your IAM role.
$ aws sts get-caller-identity
SAML2AWS Command Not Found
Your terminal cannot locate the SAML2AWS executable because of installation or PATH configuration issues.
Solution: Verify the CLI installation and confirm that its executable directory is included in your system PATH.
$ saml2aws --version
Multi-Factor Authentication Failed
MFA errors may occur because of incorrect verification codes, expired challenges, or unsupported methods.
Solution: Confirm the required MFA method, review your identity provider settings, and complete the verification process. Contact your administrator if necessary.
Unable to Assume an IAM Role
AWS role assumption can fail because of missing SAML attributes or incorrect IAM trust relationships.
Solution: Review the AWS IAM role assignment, SAML provider settings, and trust policy to confirm the role can be assumed by your account.
Configuration Not Working
Incorrect provider settings, authentication URLs, or profile details can prevent SAML2AWS from connecting successfully.
Solution: Review and update your saved SAML2AWS configuration details.
$ saml2aws configure
Most SAML2AWS authentication issues can be resolved by reviewing configuration settings, refreshing temporary credentials, verifying AWS profiles, and checking IAM role permissions.
SAML2AWS FAQs
Find answers to frequently asked questions about SAML2AWS, AWS Single Sign-On, identity providers, temporary credentials, CLI configuration, and authentication workflows.
What is SAML2AWS?
SAML2AWS is a command-line tool that helps users authenticate with AWS through a SAML 2.0 identity provider. It retrieves temporary AWS credentials that can be used with AWS CLI tools and other compatible applications.
How does SAML2AWS authentication work?
SAML2AWS authenticates through your configured identity provider and obtains a SAML assertion. It then uses AWS Security Token Service (STS) to request temporary credentials for an authorized IAM role. These credentials can be used to access permitted AWS resources.
Which identity providers does SAML2AWS support?
SAML2AWS supports several SAML-based identity provider integrations, including Okta, ADFS, and OneLogin. Supported authentication methods and integrations depend on the installed SAML2AWS version.
Is SAML2AWS free to use?
Yes. SAML2AWS is an open-source command-line project available under the MIT license. However, AWS services and identity provider subscriptions may have their own costs.
How do I configure SAML2AWS for the first time?
After installing SAML2AWS, run
saml2aws configure in your terminal.
Enter the required identity provider details,
authentication URL, username, and profile settings.
Save the configuration before starting your
first authentication session.
Can I use SAML2AWS with multiple AWS accounts?
Yes. You can configure named profiles to
organize authentication for different AWS
environments or accounts. For example,
saml2aws login --profile development
authenticates using a configured profile
named development.
Does SAML2AWS support multi-factor authentication?
SAML2AWS supports MFA workflows for compatible identity providers. Available verification methods depend on your provider, organization's authentication policies, and the installed SAML2AWS version.
How long do SAML2AWS credentials remain valid?
SAML2AWS retrieves temporary AWS credentials that expire after a limited session duration. Their validity depends on the requested duration and applicable AWS IAM role and federation settings.
How do I refresh expired AWS credentials?
Run saml2aws login --force to start
a fresh authentication session and request
new temporary AWS credentials. Complete
any required MFA verification steps.
How can I verify that SAML2AWS login succeeded?
Run aws sts get-caller-identity
after authentication. If you're using a
named profile, include
--profile development
with your configured profile name.
The output identifies the AWS account
and principal associated with your credentials.
How do I install SAML2AWS on Windows, macOS, or Linux?
SAML2AWS can be installed on Windows, macOS,
and Linux using supported package managers
or a compatible binary release. After installation,
run saml2aws --version to verify that
the executable is available from your terminal.
Where does SAML2AWS store AWS credentials?
SAML2AWS commonly writes temporary AWS credentials
to the AWS shared credentials file, typically
~/.aws/credentials, under the selected
profile. Storage behavior can vary based on
the configured options. Protect credential files
with appropriate file permissions.
Why am I getting an Access Denied error after login?
An Access Denied error usually indicates that
the selected IAM role does not have permission
to perform the requested AWS action. Verify
your account and role using
aws sts get-caller-identity,
then review the relevant IAM policies with
your AWS administrator.
Can SAML2AWS be used with AWS CLI scripts and automation?
Yes. After SAML2AWS retrieves valid temporary
credentials, AWS CLI scripts can use the
configured profile to perform authorized tasks.
For example, you can specify
--profile development in AWS CLI commands.
Automated workflows must account for credential
expiration and any interactive authentication
or MFA requirements.