SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software
Development resources, articles, tutorials, code samples, tools and downloads for AWS Amazon Web Services, Redshift, AWS Lambda Functions, S3 Buckets, VPC, EC2, IAM

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.

aws configure --profile newprofilename

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"

create named profile using AWS CLI tool

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.

aws configure list-profiles

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.

list named profiles 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.

location of AWS profiles files on Windows computer

Above screenshot shows the two files where the AWS CLI profiles configurations are stored on my Windows computer.



AWS


Copyright © 2004 - 2024 Eralper YILMAZ. All rights reserved.