]> src.twobees.de Git - dotfiles.git/blob - stow/oh-my-zsh/.oh-my-zsh/plugins/aws/README.md
...
[dotfiles.git] / stow / oh-my-zsh / .oh-my-zsh / plugins / aws / README.md
1 # aws
2
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.
5
6 To use it, add `aws` to the plugins array in your zshrc file.
7
8 ```zsh
9 plugins=(... aws)
10 ```
11
12 ## Plugin commands
13
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. 
18
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.
25
26 * `agp`: gets the current value of `$AWS_PROFILE`.
27
28 * `aws_change_access_key`: changes the AWS access key of a profile.
29
30 * `aws_profiles`: lists the available profiles in the  `$AWS_CONFIG_FILE` (default: `~/.aws/config`).
31   Used to provide completion for the `asp` function.
32
33 ## Plugin options
34
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.
38
39 ## Theme
40
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:
43
44 * ZSH_THEME_AWS_PREFIX: sets the prefix of the AWS_PROFILE. Defaults to `<aws:`.
45
46 * ZSH_THEME_AWS_SUFFIX: sets the suffix of the AWS_PROFILE. Defaults to `>`.
47
48 ## Configuration
49
50 [Configuration and credential file settings](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html) by AWS
51
52 ### Scenario: IAM roles with a source profile and MFA authentication
53
54 Source profile credentials in `~/.aws/credentials`:
55
56 ```
57 [source-profile-name]
58 aws_access_key_id = ...
59 aws_secret_access_key = ...
60 ```
61
62 Role configuration in `~/.aws/config`:
63
64 ```
65 [profile source-profile-name]
66 mfa_serial = arn:aws:iam::111111111111:mfa/myuser
67 region = us-east-1
68 output = json
69
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
74 region = us-east-1
75 output = json
76 ```