Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# aws-cli-utils
This is the project to collect helpful aws cli commandline with complex options to support your working
This is the project to collect helpful aws cli commandlines with complex options to support your working.
## Why I want to write this project.
- Sometimes, aws cli is list, get, describes. It is pretty hard to remember.
- Sometimes, you want to add more options on purpose and you want to have a place to collect and reuse it in the future. That is the reason I defined that structure to help me collect helpful commandlines and share on the github.
- You have a lot of assume role profile, you can search it by peco and assume it one time by caching feature instead of filling in MFA every time. You can re-use assume-role in the other tab of Iterm.


## Setup dependencies
Expand Down Expand Up @@ -80,13 +81,16 @@ mfa_serial = arn:aws:iam::ACCOUNT_NAME_MFA:mfa/ACCOUNT_NAME
## How to use
### AssumeRole
```
Ctrl + @ and press enter and choose the assume role that you want to use.
Hotkey: Ctrl + @ and press enter and choose the assume role that you want to use.
Enter functionname: aws_assume_role_set_name_with_hint

```
### List all functions
```
aws_help
You can search list function and after that you can run which funtion_name to get the detail of bashshell code.
```
You can search list function and after that you can run which `funtion_name` to get the detail of bashshell code.

### Other
```
admin@MacBook-Pro-cua-Admin ~ % aws_assume_role_set_name PROFILE_NAME-dev
Expand Down
9 changes: 5 additions & 4 deletions common/peco.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ peco_create_menu() {
local input_function=$1
local peco_options=$2
local peco_command="peco ${peco_options}"
local input_value=$(echo "$(eval $input_function)" | eval ${peco_command})
# local input_value=$(echo "$(eval $input_function)" | eval ${peco_command})
local input_value=$(eval ${input_function} | eval ${peco_command})
echo ${input_value:?'Can not get the input from peco menu'}
}

Expand Down Expand Up @@ -194,12 +195,12 @@ peco_aws_ec2_list() {
}

peco_aws_ssm_list_parameters() {
commandline=" \
commandline=" \
aws ssm get-parameters-by-path \
--path "/" \
--recursive \
--query 'Parameters[*].Name' \
| jq -r '.[]'
"
peco_commandline_input ${commandline} 'true'
}
peco_commandline_input ${commandline} 'true'
}
19 changes: 19 additions & 0 deletions services/other.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,22 @@ aws_datapipeline_check_using() {
aws_autoscaling_lauching_configuration_list() {
aws autoscaling describe-launch-configurations --query "*[].LaunchConfigurationName"
}

aws_resource_list() {

aws_run_commandline "\
aws resourcegroupstaggingapi get-resources
"
}

#
# TODO aws_resource_list_by_tag_name to list all resource that have tag Name is
# @param TODO The first parameter is the tag_name value
# @return List resources that match the tag name which you pass to the function.
#
aws_resource_list_by_tag_name() {
aws_run_commandline "\
aws resourcegroupstaggingapi get-resources \
--tag-filters 'Key=Name,Values=${1:?lhs_aws_resource_tag_name is unset or empty}'
"
}