NOTICE
This project are originally based on Python2 because the Alfred Python package are Python2 only. Since the Alfred author stopped maintaining that package, I created my own Alfred Python package afwf and fully adapted Python3. This project has been completely re-worked in Python 3.
This project has been broken down to four more maintainable projects:
- aws_resource_search: The cross platform CLI version of aws resource search. No Alfred needed.
- afwf_aws_resource_search: Alfred version of aws_resource_search.
- aws_console_url_search: The cross platform CLI version to search aws console only. No Alfred needed.
- afwf_aws_console: Alfred version of
aws_console_url_search
.
Table of Content
Usage:
- Type
aws ${main_service}
oraws ${main_service}-${sub_service}
. Example:aws ec
oraws ec2-inst
. - hit
Tab
to auto complete the search string. - hit
Enter
to open the AWS Console.
Note:
- It support full text fuzzy search. For example,
st
can matchinstances
,sg
can matchSecurity Group
. - If an AWS service has sub services, there's is a 📂 icon.
Usage:
- Type
aws ${main_service}-{sub_service}
or find the sub service then hitTab
to search AWS resources (if available). - Type any search string to filter the resource. Example:
aws iam-roles dev
Note:
- It support full text fuzzy search on
Name
andid
(if available). For example:7d4f
can match an EC2 instancei-abcd...7d4f
. - If an AWS sub services support resources search, there's is a 🔍 icon.
You can hit "cmd + L" to view resource details (if available). This is an IAM Role example:
Copy ARN:
Type aws ${main_service}-{sub_service} ${query}
to locate the resource. And Press down Alt
then hit Enter
to copy ARN to clipboard (if available).
Copy ID:
- Type
aws ${main_service}-{sub_service} ${query}
to locate the resource. And Press downCmd
then hitEnter
to copy ID to clipboard (if available).
Suppose you have many named profile defined in ~/.aws/credentials
and ~/.aws/config
. Now you can easily set one of the named profile as DEFAULT profile. Basically this workflow will update the ~/.aws/credentials
and ~/.aws/config
accordingly.
For example, ~/.aws/config
:
# content of ~/.aws/config [default] region = output = [profile aws_dev] region = us-east-1 output = json [profile aws_stage] region = us-east-2 output = json [profile aws_prod] region = us-west-1 output = json
and ~/.aws/credentials
:
# content of ~/.aws/credentials [default] region = output = [aws_dev] aws_access_key_id = AAA aws_secret_access_key = AAA [aws_stage] aws_access_key_id = BBB aws_secret_access_key = BBB [aws_prod] aws_access_key_id = CCC aws_secret_access_key = CCC
Type aws-cli-set-profile dev
to filter the named profile, hit Enter
to set it as default.
It will pop a notification to tell you which profile is set.
Then the ~/.aws/config
becomes:
[default] region = us-east-1 output = json
The ~/.aws/credentials
becomes:
[default] aws_access_key_id = AAA aws_secret_access_key = AAA
Some organization force MFA auth before using AWS API key or log in console.
In order to use aws sdk, you need to run aws sts get-session-token --serial-number arn-of-the-mfa-device --token-code code-from-token
commands and manually update your ~/.aws/credentials
file and use your new temporary named profile. (Official tutorial can be found here https://aws.amazon.com/premiumsupport/knowledge-center/authenticate-mfa-cli/)
This workflow allows you to type:
aws-mfa-auth ${my_base_profile} ${six_digits_mfa_token_from_phone}
Then a new aws profile ${my_base_profile}_mfa
(with _mfa
suffix) will be instantly ready to use.
1. Dependencies Check:
- Make sure you are using
Alfred 4
. Because it builds on top the new feature "Conditional Utility".
2. Installation this Alfred workflow:
Go to https://github.com/MacHu-GWU/afwf_aws_tools-project/releases, download the latest AWS Tools.alfredworkflow
file, double click to install. Make sure you bought the Alfred Powerpack that enable the Alfred workflow feature.
3. Configure the AWS Profile for this workflow
To get start, you have to give AWS Tools a named AWS profile to use to run boto3 API.
- Set a named profile as default for this workflow (not CLI / SDK):
aws-tool-set-profile ${profile_name}
- Set a region as default that overwrite the region from
~/.aws/config
file:aws-tool-set-region ${region_name}
- Display current profile and region:
aws-tool-info
This software is maintained by me as individual, an Architect working in AWS. HOWEVER, THIS SOFTWARE IS NOT AN AWS MAINTAINED SOFTWARE, AND IT IS A INDIVIDUAL OPEN SOURCE PROJECT. PLEASE USE IT ON YOUR OWN RISK.
Open issue here https://github.com/MacHu-GWU/afwf_aws_tools-project/issues
TODO
You can add your custom AWS Resource Searcher, customize the filtering logic, implement your own follow up actions that copy to clipboard, open file, run shell script, etc ...