You can use these following command-options using EC2_PRIVATE_KEY (and even EC2_CERT) environment variables:
- -K <private key>
- -C <certificate>
After that, you can use them inside aliases, e.g.
alias ec2-describe-instances1 ec2-describe-instances -K /path/to/yourkey.pem
There is also a straightforward way to do this:
$ aws configure --profile myaccount1
$ aws configure --profile myaccount2
You can then switch between the accounts by passing the profile on the command.
$ aws dynamodb list-tables --profile myaccount1
$ aws s3 ls --profile myaccount2
Also, you can set your primary account by mentioning default in it