Skip to content

Commit

Permalink
Update readme to talk about shared credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
kyleknap committed Mar 25, 2016
1 parent ac0c4f4 commit c454605
Showing 1 changed file with 39 additions and 10 deletions.
49 changes: 39 additions & 10 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ Before using aws-cli, you need to tell it about your AWS credentials. You
can do this in several ways:

* Environment variables
* Shared credentials file
* Config file
* IAM Role

Expand All @@ -111,6 +112,24 @@ To use environment variables, do the following::
$ export AWS_ACCESS_KEY_ID=<access_key>
$ export AWS_SECRET_ACCESS_KEY=<secret_key>

To use the shared credentials file, create an INI formatted file like this::

[default]
aws_access_key_id=foo
aws_secret_access_key=bar

[testing]
aws_access_key_id=foo
aws_secret_access_key=bar

and place it in ``~/.aws/credentials`` (or in
``%UserProfile%\.aws/credentials`` on Windows). If you wish to place the
shared credentials file in a different location than the one specified above,
you need to tell aws-cli where to find it. Do this by setting
the appropriate environment variable::

$ export AWS_SHARED_CREDENTIALS_FILE=/path/to/shared_credentials_file

To use a config file, create a configuration file like this::

[default]
Expand All @@ -124,21 +143,22 @@ To use a config file, create a configuration file like this::
aws_secret_access_key=<testing secret key>
region=us-west-2

and place it in ``~/.aws/config`` (or in ``%UserProfile%\.aws\config`` on Windows).

As you can see, you can have multiple ``profiles`` defined in this
configuration file and specify which profile to use by using the ``--profile``
option. If no profile is specified the ``default`` profile is used. Except
for the default profile, you **must** prefix each config section of a profile
group with ``profile``. For example, if you have a profile named "testing" the
section header would be ``[profile testing]``.

If you wish to place the config file in a different location than the one
and place it in ``~/.aws/config`` (or in ``%UserProfile%\.aws\config`` on Windows). If you wish to place the config file in a different location than the one
specified above, you need to tell aws-cli where to find it. Do this by setting
the appropriate environment variable::

$ export AWS_CONFIG_FILE=/path/to/config_file

As you can see, you can have multiple ``profiles`` defined in both the shared
credentials file and the configuration file. You can then specify which
profile to use by using the ``--profile`` option. If no profile is specified
the ``default`` profile is used.

In the config file, except for the default profile, you
**must** prefix each config section of a profile group with ``profile``.
For example, if you have a profile named "testing" the section header would
be ``[profile testing]``.

The final option for credentials is highly recommended if you are
using aws-cli on an EC2 instance. IAM Roles are
a great way to have credentials installed automatically on your
Expand Down Expand Up @@ -201,6 +221,15 @@ The ``profile`` variable can not be specified in the configuration file
since it would have to be associated with a profile and would defeat the
purpose.

^^^^^^^^^^^^^^^^^^^
Further Information
^^^^^^^^^^^^^^^^^^^

For more information about configuration options, please refer the
`AWS CLI Configuration Variables topic <http://docs.aws.amazon.com/cli/latest/topic/config-vars.html#cli-aws-help-config-vars>`_. You can access this topic
from the CLI as well by running ``aws help config-vars``.


----------------------------------------
Accessing Services With Global Endpoints
----------------------------------------
Expand Down

0 comments on commit c454605

Please sign in to comment.