π AWS SSO Configuration Guide
π Secure Your AWS Credentials with AWS Identity Center (SSO)
This guide walks you through setting up AWS Single Sign-On (SSO) to securely manage your AWS credentials without storing them in plain text which is not encrypted.
π Prerequisites
- β AWS CLI v2 installed (version 2.x or higher)
- β Access to AWS Identity Center (formerly AWS SSO)
- β Your organizationβs SSO portal URL
π οΈ Step-by-Step Setup Instructions
Step 1: Initialize SSO Configuration
aws configure ssoStep 2: Choose a Profile Name
When prompted for SSO session name, enter a descriptive name for your profile:
SSO session name (Recommended): disasters
π‘ Tip: Can use meaningful names like prod-admin-disasters, dev-poweruser-disasters, etc. But if you are only using a single profile then it is suggested to use disasters as this is what this tutorial assumes.
Step 3: Enter Your SSO Start URL
Find your SSO URL in the AWS Identity Center portal and enter it:
SSO start URL [None]: https://d-9067c5bbc5.awsapps.com/start/#
π Where to find: Navigate to your AWS SSO portal from link within NASA SMCE email β Look for the URL in your browser
Step 4: Specify SSO Region
Enter the region where your Identity Center is configured. Although the bucket is located in us-west-2 this is NOT what you should enter. Please enter us-east-1.
SSO region [None]: us-east-1
Step 5: SSO Registration Scopes
Leave this section blank. Press Enter to accept the default:
SSO registration scopes [sso:account:access]:
β¨ The default scope is sufficient for most use cases
Step 6: Browser Authentication
π A browser window will open automatically:
- Log in with your corporate credentials
- Click βAllowβ to grant access to
AWS CLI (botocore) - Return to your terminal
Step 7: Select AWS Account
Enter your AWS account ID (12 digits):
AWS account ID: 867530900000
π‘ Tip: Find this in your AWS SSO portal under the accounts tab
Step 8: Choose IAM Role
Select from available roles:
You may see up to 3 roles available to you, select the one that you will most commonly use.
> Project-Power-User
ReadOnlyAccess
β¨ Use arrow keys to select, then press Enter
Step 9: Set Default Region
If region is auto-filled to us-east-1, then leave as it is. Otherwise please input us-east-1:
CLI default region [us-east-1]: us-east-1
Step 10: Set Output Format
Choose your preferred output format:
CLI default output format [None]: json
Options: json, yaml, text, table
π‘ Tip: It is recommended to use json as the preferred output format
β Verification
To access data from the AWS S3 bucket, you will need to utilize the --profile disasters-sso flag which tells the AWS command to pull config information from ~/.aws/config.
Test your configuration:
aws s3 ls --profile disasters-ssoExpected output:
PRE browseui/
PRE california_wildfires_202501/
PRE disasters/
...
π Daily Usage
Login to SSO Session
aws sso login --profile disasters-ssoUse AWS Commands
# List S3 buckets
aws s3 ls --profile disasters-sso
# Get caller identity
aws sts get-caller-identity --profile disasters-ssoThis is especially helpful when running many AWS commands in a session.
Logout When Done
aws sso logoutπ Configuration Files
Your SSO configuration is stored in ~/.aws/config:
[profile disasters-sso]
sso_session = disasters
sso_account_id = 867530900000
sso_role_name = Project-Power-User
region = us-east-1
output = json
[sso-session disasters]
sso_start_url = https://d-9067c5bbc5.awsapps.com/start/#
sso_region = us-east-1
sso_registration_scopes = sso:account:accessβ οΈ Important Notes
π About Temporary Credentials
- AWS SSO provides temporary credentials that expire after 1-12 hours
- Credentials are automatically refreshed when you run commands
- No permanent credentials are stored on your machine
π Why AWS-Vault Didnβt Work
AWS-Vault expects permanent credentials to generate temporary ones. Since AWS SSO already provides temporary credentials: - Adding SSO temporary credentials to aws-vault causes authentication errors - SSO handles credential refresh automatically, making aws-vault redundant - Use AWS SSO for temporary credential profiles, aws-vault for permanent ones
π¨ Troubleshooting
βThe security token included in the request is invalidβ
Cause: Trying to use expired temporary credentials Solution: Run aws sso login --profile your-profile to refresh
Browser doesnβt open automatically
Solution: Add --use-device-code flag:
aws sso login --profile disasters-sso --use-device-codeMultiple AWS accounts/roles
Create separate profiles for each account/role combination:
[profile prod-admin]
sso_session = mycompany
sso_account_id = 111111111111
sso_role_name = Administrator
[profile dev-readonly]
sso_session = mycompany
sso_account_id = 222222222222
sso_role_name = ReadOnlyAccessπ― Best Practices
- Never store credentials in plain text β
- Use SSO for all AWS access β
- Logout when finished working π
- Use descriptive profile names π
- Set up MFA on your SSO account π
π Next Steps
- Remove plain text credentials from
~/.aws/credentials - Update scripts to use
--profileflag - Set default profile:
export AWS_PROFILE=disasters-sso - Consider using aws-sso-util for enhanced SSO features
π Resources
π Remember: Security is everyoneβs responsibility. Keep your credentials safe!