Last active
December 10, 2015 00:28
-
-
Save i97506051502/4351111 to your computer and use it in GitHub Desktop.
複数の AWS Key Pair を持つ者たちに捧ぐ(X.509 関連の環境変数変更ツール)。
chkey.sh にパスを通して以下のように実行します。
$ source chkey.sh key1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# = 1 ]; | |
then | |
Key_Name="$1" | |
if [ ${Key_Name} == 'key1' ]; then | |
export EC2_CERT=/path/to/your/key1/cert/key1.pem | |
export EC2_PRIVATE_KEY=/path/to/your/key1/pk/key1.pem | |
echo 'Changed keys of AWS to '${Key_Name} | |
elif [ ${Key_Name} == 'key2' ]; then | |
export EC2_CERT=/path/to/your/key1/cert/key2.pem | |
export EC2_PRIVATE_KEY=/path/to/your/key1/pk/key2.pem | |
echo 'Changed keys of AWS to '${Key_Name} | |
fi | |
else | |
echo 'Usage: source chkey Key_Name' | |
echo '# To check Key_Name, run command below.' | |
echo 'cat chkey.sh' | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment