Skip to content

Commit

Permalink
Merge pull request #12 from lamhaison/develop
Browse files Browse the repository at this point in the history
Upgrade document and add the fnction aws_events_enable_rule
  • Loading branch information
lamhaison authored Mar 23, 2023
2 parents f62d1c5 + 39094e0 commit 4ccf6f6
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 7 deletions.
36 changes: 29 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ echo "random_string" > ~/.password_assume_role_encrypted
## Settings when open terminal (I am using iterm)
```
mkdir -p /opt/lamhaison-tools && cd /opt/lamhaison-tools
# Install helpful-commandlines
git clone git@github.com:lamhaison/helpful-commandlines.git
echo "source /opt/lamhaison-tools/helpful-commandlines/main.sh" >> ~/.bashrc
# Install aws-cli-utils commandlines
git clone https://github.com/lamhaison/helpful-commandlines.git
echo "source /opt/lamhaison-tools/aws-cli-utils/main.sh" >> ~/.bashrc
```
Expand Down Expand Up @@ -101,19 +107,35 @@ aws_secret_access_key=yyyyxxxxyyyy
## How to use
### AssumeRole
```
Hotkey: Ctrl + @ and press enter and choose the assume role that you want to use.
Enter functionname: aws_assume_role_set_name_with_hint
Hotkey (US keyboard layout) : Ctrl + @ (number 2) and press enter and choose the assume role that you want to use.
Typing function_name: aws_assume_role_set_name_with_hint
```
### List all functions
```
aws_help
Hotkey (US keyboard layout): Ctrl + h and you can search the funtion and enter to chose which commandline you want to run or edit before running.
Typing function_name: aws_help (You only search the name function, can not select or edit funtion directly on console).
```
You can search list function and after that you can run which `funtion_name` to get the detail of bashshell code.

* You can search by a keyword
![image](./images/aws_help_search_menu.png)

* You can search by multi keywords with space seperately. Thank for Peco feature. It is pretty helplful.
![image](./images/aws_help_search_menu_keyword_seperated.png)




### List history and select the commandline that you want to re-run
```
Hotkey (US keyboard layout): Ctrl + r and you can search the history commandlines and enter to chose which commandline you want to run or edit before running.
```


### Other
```
admin@MacBook-Pro-cua-Admin ~ % aws_assume_role_set_name PROFILE_NAME-dev
source ~/.bashrc
aws_assume_role_set_name PROFILE_NAME-dev
You set the assume role name PROFILE_NAME-dev
Running assume-role PROFILE_NAME-dev
MFA code: 165933
Expand All @@ -133,8 +155,8 @@ admin@MacBook-Pro-cua-Admin aws_cli_results % aws_ec2_list
+---------------------+---------------------------------+---------------+----------------+-----------+
| InstanceId | Name | PrivateIp | PublicIp | State |
+---------------------+---------------------------------+---------------+----------------+-----------+
| i-0512340c9dc5fb531| demo-dev-jenkins-master | x.x.x.x | 1.123.123.123 | running |
| i-0712343f1a9565397| demo-dev-mongodb-master | y.y.y.y | 1.123.123.123 | running |
| i-0512340c9dc5fb123| demo-dev-jenkins-master | x.x.x.x | 1.123.123.123 | running |
| i-0712343f1a9565456| demo-dev-mongodb-master | y.y.y.y | 1.123.123.123 | running |
+---------------------+---------------------------------+---------------+----------------+-----------+
```

Binary file added images/aws_help_search_menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions services/aws_events.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,17 @@ aws_events_disable_rule() {
aws events describe-rule --name $1

}

aws_events_enable_rule() {

set -e
set -x
rule_name=$1

aws_account_info
echo "Disable rule ${rule_name}"
aws events describe-rule --name $1
aws events enable-rule --name $1
aws events describe-rule --name $1

}

0 comments on commit 4ccf6f6

Please sign in to comment.