From 645ab35bdc3eac004ef43b53f0a52507d4a02bb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20M=C4=83gheru=C8=99an-Stanciu?= Date: Wed, 30 Jul 2014 14:59:00 +0200 Subject: [PATCH] aws: added an alias for changing the AWS access key set on a profile --- plugins/aws/aws.plugin.zsh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh index d31052f83..85fe60e8c 100644 --- a/plugins/aws/aws.plugin.zsh +++ b/plugins/aws/aws.plugin.zsh @@ -25,7 +25,22 @@ function aws_profiles { reply=($(grep profile $AWS_HOME/config|sed -e 's/.*profile \([a-zA-Z0-9_-]*\).*/\1/')) } -compctl -K aws_profiles asp +function aws_change_access_key { + if [[ "x$1" == "x" ]] then + echo "usage: $0 " + return 1 + else + echo "Insert the credentials when asked." + asp $1 + aws iam create-access-key + aws configure --profile $1 + echo "You can now safely delete the old access key running 'aws iam delete-access-key --access-key-id ID'" + echo "Your current keys are:" + aws iam list-access-keys + fi +} + +compctl -K aws_profiles asp aws_change_access_key if _homebrew-installed && _awscli-homebrew-installed ; then _aws_zsh_completer_path=$(brew --prefix awscli)/libexec/bin/aws_zsh_completer.sh