Mostly as a developer you need to maintain multiple s3 access credentials. Or even for personal access, there can be multiple s3 buckets you need to access without common access permissions to all.
So let us say we have a aws client instance 1 that belongs to personal use. May be another set of credentials which are private access or used for development for another customer account etc. Lets assume we have
AWS_PERSONAL_KEY, AWS_PERSONAL_SECRET &
Now to seamlessly access these using aws-cli, we need to create multiple profiles one may be default the other used, when be specified.
Lets install aws-cli SDK from here: Installing, updating, and uninstalling the AWS CLI version 2 – AWS Command Line Interface (amazon.com)
Then once we have aws-cli installed. Go to command line and we have to configure the default aws crendentials to be used with command
$ aws configure
this creates your default profile. so whenever you run
$ aws ls personal-bucket
This will use your default credentials and list the items in personal-bucket.
Now to use different profile for developer s3 bucket. We now have to configure aws-cli for second access key/secret as below
$ aws configure –profile dev
now you can use aws-cli to use this profile by adding –profile dev to all commands of aws-cli, like