Intuitive password management with aws ssm on Mac / Linux alias

SSM is indebted to me both publicly and privately, but I had a hard time with the command each time, so I chose alias. To be precise, I had to use an argument, so I implemented it as a function instead of an alias. It can be used as follows.

$ setssm TEST_KEY test_val #Register
$ getssm TEST_KEY #refer
test_val #output
$ setssm TEST_KEY2 "test space Japanese" #Space and Japanese processing is also possible
$ echo HOGE$(getssm TEST_KEY2)FUGA #Can be expanded on a command and handled as a variable
HOGEtest space Japanese FUGA
$ listssm | grep TEST #Search with grep from the output of the list and output the key and value including TEST
TEST_KEY test_val
TEST_KEY2 test space Japanese

The implementation just adds the following to the end of ~ / .bash_profile and updates with source ~ / .bash_profile.


function setssm() {
  command aws ssm put-parameter --name $1 --type "String" --overwrite --value "$2";
function getssm() {
  command aws ssm get-parameter --name $1 --query 'Parameter.Value' --output text;
function listssm() {
  command aws ssm get-parameters-by-path --path "/" --query "Parameters[].[Name,Value]" --output text

Personally, the best thing to do is to separate the commands for your company and for yourself.setssm_privateWhensetssm_corpPrepare 2 patterns of commands such as--profile引数をそれぞれに付与するWhenパーソナルな情報を会社のssmにアップしたりその逆を避けれます。

Recently, the number of frameworks that can handle authentication information via SSM has increased, and it would be nice to eliminate the risk and worry of uploading authentication information to the repository. Have a good AWS life.


Recommended Posts

Intuitive password management with aws ssm on Mac / Linux alias
I want to AWS Lambda with Python on Mac!
Linux fastest learning with AWS
Password management with python: keyring
Notes on package management with conda
tensor flow with anaconda on mac
Introducing OpenCV on Mac with homebrew
I installed Linux on my Mac
Procedure for building a kube environment on amazon linux2 (aws) ~ (with bonus)
Put MeCab binding for Python with pip on Windows, mac and Linux
X86 assembler on Linux (linkage with C)
Follow active applications on Mac with Python
I want to use Linux on mac
[C] [python] Read with AquesTalk on Linux
Build Python environment with Anaconda on Mac
Install Mecab on Linux (CentOS) with brew
Replacing rmtrash on Mac and replacing rm on Linux
Including docker-nginx port forwarding on AWS Linux 2
Run Linux on ARM architecture with QEMU