Skip to content

Instantly share code, notes, and snippets.

@chrisforrette
Forked from ewdurbin/README.md
Created January 16, 2018 23:59
Show Gist options
  • Select an option

  • Save chrisforrette/503f0c49ec4321e7350a9fa39efa1571 to your computer and use it in GitHub Desktop.

Select an option

Save chrisforrette/503f0c49ec4321e7350a9fa39efa1571 to your computer and use it in GitHub Desktop.

Revisions

  1. @ewdurbin ewdurbin revised this gist Jan 16, 2018. 2 changed files with 2 additions and 0 deletions.
    1 change: 1 addition & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -15,6 +15,7 @@ Configure the current shell with AWS configuration for a given `aws-cli` profile
    Sets the following Environment Variables

    * `AWS_PROFILE=<profile_name>` used by `aws-cli`
    * `AWS_DEFAULT_REGION=<profiles_configured_region>`
    * `AWS_ACCESS_KEY_ID=<profiles_access_key_id>`
    * `AWS_SECRET_ACCESS_KEY=<profiles_secret_access_key>`

    1 change: 1 addition & 0 deletions bash_profile.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,6 @@
    aws-profile () {
    export AWS_PROFILE=${1}
    export AWS_DEFAULT_REGION=$(aws configure get region)
    export AWS_ACCESS_KEY_ID=$(aws configure get aws_access_key_id)
    export AWS_SECRET_ACCESS_KEY=$(aws configure get aws_secret_access_key)
    }
  2. @ewdurbin ewdurbin revised this gist Sep 12, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # `aws-cli` bash helper functions

    The official AWS command line tools, have support for configuration profiles. See [Configuring the AWS Command Line Interface](http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-multiple-profiles).
    The official AWS command line tools, have support for configuration profiles. See [Configuring the AWS Command Line Interface - Named Profiles](http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-multiple-profiles).

    Managing multiple profiles with the AWS CLI itself is *relatively* straight forward, switching between them with `--profile` flag on the command line or the `AWS_PROFILE` environment variable.

  3. @ewdurbin ewdurbin revised this gist Sep 12, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # `aws-cli` bash helper functions

    The official AWS command line tools, have support for configuration profiles.
    The official AWS command line tools, have support for configuration profiles. See [Configuring the AWS Command Line Interface](http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-multiple-profiles).

    Managing multiple profiles with the AWS CLI itself is *relatively* straight forward, switching between them with `--profile` flag on the command line or the `AWS_PROFILE` environment variable.

  4. @ewdurbin ewdurbin revised this gist Aug 18, 2015. 1 changed file with 27 additions and 0 deletions.
    27 changes: 27 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    # `aws-cli` bash helper functions

    The official AWS command line tools, have support for configuration profiles.

    Managing multiple profiles with the AWS CLI itself is *relatively* straight forward, switching between them with `--profile` flag on the command line or the `AWS_PROFILE` environment variable.

    These helpers extend that functionality for convenience with other tools in the ecosystem.

    ## `aws-profile`

    Configure the current shell with AWS configuration for a given `aws-cli` profile.

    `aws-profile <profile_name>`

    Sets the following Environment Variables

    * `AWS_PROFILE=<profile_name>` used by `aws-cli`
    * `AWS_ACCESS_KEY_ID=<profiles_access_key_id>`
    * `AWS_SECRET_ACCESS_KEY=<profiles_secret_access_key>`

    ## `with-aws-profile`

    Run a single command in a subshell configured for a specific `aws-cli` profile.

    `with-aws-profile <profile_name> my --arbitrary command`

    Any command line tool which can understand the environment varibles set by `aws-profile` should just work.
  5. @ewdurbin ewdurbin created this gist Aug 18, 2015.
    13 changes: 13 additions & 0 deletions bash_profile.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    aws-profile () {
    export AWS_PROFILE=${1}
    export AWS_ACCESS_KEY_ID=$(aws configure get aws_access_key_id)
    export AWS_SECRET_ACCESS_KEY=$(aws configure get aws_secret_access_key)
    }

    with-aws-profile () {
    (
    aws-profile ${1}
    shift
    ${@}
    )
    }