Setting AWS CLI With SSO
Creating SSO User
AWS provides IAM Identity Center to create SSO User. Following are the steps to create SSO User.
- Enable IAM Identity Center if now enabled in the region.
Only one IAM Identity Center is allowed in any region.
- Create User by following the steps.
- Create a group and add the user into the group.
it is always advisable to attach permissions to the groups instead of individuals users.
- Create a permission set. For now, keep
PowerUserAccess
for all access except user management. - Add a group/user to an account.
Multi-account permissions > AWS Accounts
.- Click button
Assign users or groups
. - Add user/group
- Attach Permission set just created.
- Click button
Installing AWS CLI
This section describes about installing AWS CLI using command line for current user.
Either you can use user folder or can create new folder for the installation. Assuming a new folder for installation aws-installer
.
- Setup
choices.xml
file which tells where to get the aws files.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>choiceAttribute</key>
<string>customLocation</string>
<key>attributeSetting</key>
<string>/Users/username/aws-installer</string>
<key>choiceIdentifier</key>
<string>default</string>
</dict>
</array>
</plist>
- Download the
.pkg
file.
curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg"
- Install the downloaded
.pkg
.
installer -pkg AWSCLIV2.pkg \
-target CurrentUserHomeDirectory \
-applyChoiceChangesXML choices.xml
- Linking the binaries. By default installation doesn’t modify the
PATH
to set aws binary location. We have to do it manually.
sudo ln -s /Users/username/aws-installer/aws-cli/aws /usr/local/bin/aws
sudo ln -s /Users/username/aws-installer/aws-cli/aws_completer /usr/local/bin/aws_completer
- Verify the installation.
~/aws-installer
⟩ aws --version
aws-cli/2.15.20 Python/3.11.6 Darwin/23.3.0 exe/x86_64 prompt/off
AWS CLI SSO Setup
This setup results in the creation of profile that will be used to access aws resources.
- Run the command
aws configure sso
. - It asks for few details such as
name
,region name
,start url
that can be fetched from IAM Identity Center.