AWS CLI tool, by default, will create a profile called default when you first run the configure option. The default profile will also be used when you run any AWS CLI tools.

You can configure multiple profiles or accounts for AWS CLI. AWS calls this named profile and you can then switch to any of the profiles or accounts when running the aws commands.

Steps to create multiple accounts for AWS CLI:

  1. Run aws configure with –profile option and a name for the new profile.

    $ aws configure --profile second_user

  2. Enter AWS Access Key ID for the new profile followed by [ENTER].

    AWS Access Key ID [None]: AKIAJF4JT25ZZYGCTTVA

  3. Enter AWS Secret Access Key for the new profile followed by [ENTER].

    AWS Secret Access Key [None]: N2ylUSpbR5cenv+0/YcuqdvOPtaOVsZrf0UY1TMA

  4. Enter Default region name for the new profile followed by [ENTER].

    Default region name [None]:

  5. Enter Default output format for the new profile followed by [ENTER].

    Default output format [None]:

  6. Check configuration file if it's is properly created.

    $ cat .aws/credentials [default] aws_access_key_id = AKIAIPXU35JJQNVVMDOQ aws_secret_access_key = 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 [second_user] aws_access_key_id = AKIAJF4JT25ZZYGCTTVA aws_secret_access_key = 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