diff --git a/examples/dotfiles/.aws/config b/examples/dotfiles/.aws/config new file mode 100644 index 0000000..0d8ca2c --- /dev/null +++ b/examples/dotfiles/.aws/config @@ -0,0 +1,33 @@ +# https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html + +[default] +region = us-west-1 +output = json + +[profile private] +output = yaml-stream +role_arn=arn:aws:iam::777788889999:role/user1role +source_profile=default +role_session_name=session_user1 +region=us-east-1 +cli_auto_prompt = on-partial + +[profile random-name] +sso_session = my-sso +sso_account_id = 111122223333 +sso_role_name = readOnly +region = us-west-2 +output = text + +[profile work] +sso_session = my-sso +sso_account_id = 444455556666 +sso_role_name = readOnly +region = us-east-1 +output = json +cli_auto_prompt = on + +[sso-session my-sso] +sso_region = us-east-1 +sso_start_url = https://my-sso-portal.awsapps.com/start +sso_registration_scopes = sso:account:access diff --git a/examples/dotfiles/.aws/credentials b/examples/dotfiles/.aws/credentials new file mode 100644 index 0000000..7c5520d --- /dev/null +++ b/examples/dotfiles/.aws/credentials @@ -0,0 +1,13 @@ +# https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html + +[default] +aws_access_key_id=AKIAIOSFODNN7EXAMPLE +aws_secret_access_key=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY +aws_session_token = IQoJb3JpZ2luX2IQoJb3JpZ2luX2IQoJb3JpZ2luX2IQoJb3JpZ2luX2IQoJb3JpZVERYLONGSTRINGEXAMPLE + +# Use the same name of the profile +# Do not use the word profile in the section +[private] +aws_access_key_id=AKIAI44QH8DHBEXAMPLE +aws_secret_access_key=je7MtGbClwBF/2Zp9Utk/h3yCo8nvbEXAMPLEKEY +aws_session_token = fcZib3JpZ2luX2IQoJb3JpZ2luX2IQoJb3JpZ2luX2IQoJb3JpZ2luX2IQoJb3JpZVERYLONGSTRINGEXAMPLE diff --git a/knowledge base/cloud computing/aws/cli.md b/knowledge base/cloud computing/aws/cli.md index 9f16511..825609f 100644 --- a/knowledge base/cloud computing/aws/cli.md +++ b/knowledge base/cloud computing/aws/cli.md @@ -4,6 +4,7 @@ 1. [TL;DR](#tldr) 1. [Profiles](#profiles) +1. [Configuration](#configuration) 1. [Further readings](#further-readings) 1. [Sources](#sources) @@ -74,6 +75,15 @@ Default output format [None]: json $ export AWS_PROFILE="work" ``` +## Configuration + +| File | Description | +| -------------------- | ------------- | +| `~/.aws/config` | Configuration | +| `~/.aws/credentials` | Credentials | + +See [CLI config files] for examples. + ## Further readings - [AWS] @@ -93,6 +103,9 @@ $ export AWS_PROFILE="work" [ecr tldr]: ecr.md#tldr [s3 tldr]: s3.md#tldr + +[cli config files]: ../../../examples/dotfiles/.aws + [quickstart]: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html [configure profiles]: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html