Basic AWS CLI extension for fetching data related to EC2 instances using tag keys.
From GitHub
python -m pip install git+https://github.com/pyToshka/aws-cli-ec2-plugin.git
Local installation
git clone https://github.com/pyToshka/aws-cli-ec2-plugin.git
cd aws-cli-ec2-plugin
pip install .
For enabling the plugin:
aws configure set plugins.ec2info awsec2info
Options:
--tag TEXT Tag name [required]
--output [json|plain|table] Output format for received information
--attribute [name|type|state|private_ip|public_ip] Get single attribute
--region TEXT AWS region name. Default us-east-1
aws ec2info --tag Name --region us-west-2
output
------
name: test
type: t3.large
state: stopped
private_ip: 127.0.0.1
public_ip: None
------
aws ec2info --tag Name --output json --region us-west-2
output
{
"name": "test",
"private_ip": "127.0.0.1",
"public_ip": null,
"state": "stopped",
"type": "t3.large"
}
]
aws ec2info --tag Name --output table --region us-west-2
output
name | type | state | private_ip | public_ip
--------- | --------- | ------- | ------------- | --------------
test | t3.large | stopped | 127.0.0. |
Enjoy