By default, AWS CLI tool will create a profile called default when you first run the configure option. The same 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.
Related: How to configure AWS CLI tool
Related: How to switch profiles on AWS CLI
Steps to create multiple accounts for AWS CLI:
- Run aws configure with --profile option and a name for the new profile.
$ aws configure --profile second_user
- Enter AWS Access Key ID for the new profile followed by [ENTER].
AWS Access Key ID [None]: AKIAJF4JT25ZZYGCTTVA
- Enter AWS Secret Access Key for the new profile followed by [ENTER].
AWS Secret Access Key [None]: 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
- Enter Default region name for the new profile followed by [ENTER].
Default region name [None]:
- Enter Default output format for the new profile followed by [ENTER].
Default output format [None]:
- 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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
Author: Mohd
Shakir Zakaria
Mohd Shakir Zakaria is an experienced cloud architect with a strong development and open-source advocacy background. He boasts multiple certifications in AWS, Red Hat, VMware, ITIL, and Linux, underscoring his expertise in cloud architecture and system administration.
Mohd Shakir Zakaria is an experienced cloud architect with a strong development and open-source advocacy background. He boasts multiple certifications in AWS, Red Hat, VMware, ITIL, and Linux, underscoring his expertise in cloud architecture and system administration.
Discuss the article:
Comment anonymously. Login not required.