Create Named Profile and Display List of PreConfigured Profiles using AWS CLI
In this AWS CLI tutorial, I want to show how named profiles can be created using AWS CLI commands and how to list previously configured named profiles again using AWS CLI tool. Using named profiles enables cloud engineers to switch between different accounts by providing the required credentials for that account easily. AWS CLI tool commands like "aws configure" provides the options to create a new profile and display list of existing profiles for AWS cloud platform users.
Create Named Profile using AWS CLI Configure Command
If you want to create a new named profile using AWS CLI tool, let's assume you want to save your credentials like AWS Access Key Id and your AWS Secret Access Key in your profile and name it as newprofilename .
In that case AWS cloud users can execute following aws configure command using AWS CLI tool.
During fulfillment of the CLI command requests; the cloud engineer has to provide the AWS Access Key Id and AWS Secret Access Key values as inputs. In addition to key id and secret key, as default values the preferred region name and default output format can be passed as input values, too.
Below is a screenshot where I created an AWS profile named datalake for one of my AWS accounts using AWS CLI command "aws configure"
Of course, if you don't pass the profile name value, this will create the default profile credentials or overwrite the default profile configuration.
List Named Profiles using AWS CLI Commands
If the AWS cloud platform users want to see the list of named profiles created, they can run below AWS CLI command in order to list them immediately.
As seen in below screenshot, executing configure command with list-profiles option will return the list of named profiles including default profile created on your machine using AWS CLI tool.
If you created multiple profiles using AWS CLI, you can view configuration details like keys, default options for region and output format, etc in config and credentials files under .aws folder under your Windows user on a Windows computer.
Above screenshot shows the two files where the AWS CLI profiles configurations are stored on my Windows computer.