3 This plugin provides completion support for [awscli](https://docs.aws.amazon.com/cli/latest/reference/index.html)
4 and a few utilities to manage AWS profiles and display them in the prompt.
6 To use it, add `aws` to the plugins array in your zshrc file.
14 * `asp [<profile>]`: sets `$AWS_PROFILE` and `$AWS_DEFAULT_PROFILE` (legacy) to `<profile>`.
15 It also sets `$AWS_EB_PROFILE` to `<profile>` for the Elastic Beanstalk CLI.
16 Run `asp` without arguments to clear the profile.
17 * `asp [<profile>] login`: If AWS SSO has been configured in your aws profile, it will run the `aws sso login` command following profile selection.
19 * `acp [<profile>] [<mfa_token>]`: in addition to `asp` functionality, it actually changes
20 the profile by assuming the role specified in the `<profile>` configuration. It supports
21 MFA and sets `$AWS_ACCESS_KEY_ID`, `$AWS_SECRET_ACCESS_KEY` and `$AWS_SESSION_TOKEN`, if
22 obtained. It requires the roles to be configured as per the
23 [official guide](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-role.html).
24 Run `acp` without arguments to clear the profile.
26 * `agp`: gets the current value of `$AWS_PROFILE`.
28 * `aws_change_access_key`: changes the AWS access key of a profile.
30 * `aws_profiles`: lists the available profiles in the `$AWS_CONFIG_FILE` (default: `~/.aws/config`).
31 Used to provide completion for the `asp` function.
35 * Set `SHOW_AWS_PROMPT=false` in your zshrc file if you want to prevent the plugin from modifying your RPROMPT.
36 Some themes might overwrite the value of RPROMPT instead of appending to it, so they'll need to be fixed to
37 see the AWS profile prompt.
41 The plugin creates an `aws_prompt_info` function that you can use in your theme, which displays
42 the current `$AWS_PROFILE`. It uses two variables to control how that is shown:
44 * ZSH_THEME_AWS_PREFIX: sets the prefix of the AWS_PROFILE. Defaults to `<aws:`.
46 * ZSH_THEME_AWS_SUFFIX: sets the suffix of the AWS_PROFILE. Defaults to `>`.
50 [Configuration and credential file settings](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html) by AWS
52 ### Scenario: IAM roles with a source profile and MFA authentication
54 Source profile credentials in `~/.aws/credentials`:
58 aws_access_key_id = ...
59 aws_secret_access_key = ...
62 Role configuration in `~/.aws/config`:
65 [profile source-profile-name]
66 mfa_serial = arn:aws:iam::111111111111:mfa/myuser
70 [profile profile-with-role]
71 role_arn = arn:aws:iam::9999999999999:role/myrole
72 mfa_serial = arn:aws:iam::111111111111:mfa/myuser
73 source_profile = source-profile-name