Creates or updates AWS SSO profiles.
awsctl sso setup [flags]| Flag | Description | Example |
|---|---|---|
--name |
SSO session name | --name my-sso-session |
--start-url |
AWS SSO start URL (must begin with https://) |
--start-url https://my-sso.awsapps.com/start |
--region |
AWS region for the SSO session | --region us-east-1 |
-
Interactive Mode (default when no flags):
- Prompts for:
- SSO Start URL
- AWS Region
- Session name (default: "default-sso")
- Uses defaults from
~/.config/awsctl/config.ymlif available - Validates all inputs before creating session
- Prompts for:
-
Non-interactive Mode (when all flags provided):
- Creates session immediately without prompts
- Validates:
- Start URL format (
https://) - Valid AWS region
- Proper session name format
- Start URL format (
- Fully interactive:
awsctl sso setup- Fully non-interactive:
awsctl sso setup --name dev-session --start-url https://dev.awsapps.com/start --region us-east-1--start-url: Must begin withhttps://--region: Must be valid AWS region code--name:- Alphanumeric with dashes/underscores
- Cannot start/end with special chars
- 3-64 characters
Starts SSO authentication using one of the configured SSO profiles.
- Selects from available profiles created via
awsctl sso setup - Useful for switching between AWS accounts or roles quickly.
- If you have multiple SSO profiles configured by
awsctl sso setup, you can easily set the default one by runningawsctl sso init
Manages connections to bastion hosts via SSH, SSM, or tunnels.
-
If SSO is configured, prompts:
- "Look for bastion hosts in AWS?"
- If yes, searches for EC2 instances with the name or tags containing
bastionfor the selected profile. - Allows easier selection from discovered instances.
- Prompts for SSH username and SSH key path.
-
If SSO is not configured or user chooses not to search AWS:
- Allows manual entry of bastion host, SSH username, and SSH key.
- SSH:
- Public or Private IP (uses EC2 Instance Connect if needed).
- SSM:
- No SSH key or public IP required.
- Works with private subnet instances.
1. SSM (AWS Systems Manager) Requirements
- IAM Role Attached to Instance:
- Must have the following AWS managed policies (or equivalent custom policies):
AmazonSSMManagedInstanceCoreAmazonSSMFullAccess(for broad access, optional)
- Must have the following AWS managed policies (or equivalent custom policies):
- VPC Endpoints (for private subnets):
- If the instance is in a private subnet (no internet access), SSM requires the following VPC endpoints:
com.amazonaws.<region>.ssmcom.amazonaws.<region>.ec2messagescom.amazonaws.<region>.ssmmessages
- If the instance is in a private subnet (no internet access), SSM requires the following VPC endpoints:
- SSM Agent:
- Ensure the SSM Agent is installed and running on the EC2 instance.
2. EC2 Instance Connect Requirements
-
IAM Permissions for Caller/User:
ec2-instance-connect:SendSSHPublicKeyec2:DescribeInstancesec2:GetConsoleOutput(optional)
-
Public DNS/IP Access:
- The instance must have a public IPv4 address or public DNS, unless used via a bastion or SSM tunnel.
-
VPC Endpoint (Required if the instance is in a private subnet without internet access):
- Create an Interface VPC Endpoint for
com.amazonaws.<region>.ec2-instance-connect - Required if the instance is in a private subnet without internet access, allowing EC2 Instance Connect API calls to AWS securely.
- Create an Interface VPC Endpoint for
- SOCKS5 Proxy:
- Prompts for:
- SOCKS proxy port (default:
1080)
- SOCKS proxy port (default:
- Establishes a SOCKS proxy to route local traffic securely through the bastion
- After establishing, follows the normal bastion connection flow for selecting or entering host details
- Prompts for:
- Port Forwarding:
- Prompts for:
- Local Port (default:
8080) - Remote Host (IP or DNS of target service)
- Remote Port (service port, e.g.,
5432for PostgreSQL)
- Local Port (default:
- Establishes SSH tunnel to remote resource via the bastion
- Prompts for:
Connects to RDS databases with flexibility.
- Direct Connect: If the RDS instance is publicly accessible.
- Via Bastion: SSH or SSM tunnel through a bastion host.
- PostgreSQL, MySQL, others (depending on configuration).
- Dynamic port assignment to avoid collisions.
- Token (IAM Database Authentication)
- Native Password (Database user password)
- Use the initial password defined when creating the RDS instance or the password configured for that database user.
- Requires IAM database authentication to be enabled on the RDS instance.
- For MySQL:
- Users must be configured with the
AWSAuthenticationPlugin.
- Users must be configured with the
- For PostgreSQL:
- Users must be granted the
rds_iamrole.
- Users must be granted the
- You can either create a new IAM-auth-enabled database user or alter existing users to support IAM-based login.
MySQL:
CREATE USER 'dbuser'@'%' IDENTIFIED WITH AWSAuthenticationPlugin as 'RDS';
GRANT ALL PRIVILEGES ON database_name.* TO 'dbuser'@'%';PostgreSQL:
CREATE USER dbuser WITH LOGIN;
GRANT rds_iam TO dbuser;Simplifies access to Amazon EKS clusters.
- Prompts for:
- AWS Region
- SSO Profile (fetched from
~/.aws/config; must be set up viaawsctl sso setup)
- Lists available EKS clusters for the selected region and profile.
- Prompts you to select a cluster and updates (or creates) your
~/.kube/configwith the cluster’s credentials.
Handles authentication to Amazon ECR for Docker or container image workflows.
- Features:
- Interactive or profile-based login.
- Runs
aws ecr get-login-passwordunder the hood. - Supports both public and private Amazon ECR registries.
awsctl sso setup
awsctl sso init
awsctl bastion
awsctl rds
awsctl eks
awsctl ecr