alejandrogarcia@MacBook-Air-de-Alejandro Downloads % aws --profile myprofileforaws ec2 describe-instances \
--query "Reservations[*].Instances[*].{PublicIP:PublicIpAddress,Name:Tags[?Key=='Name']|[0].Value,Status:State.Name}" --output table
-------------------------------------
| DescribeInstances |
+----------+------------+-----------+
| Name | PublicIP | Status |
+----------+------------+-----------+
| minikube| None | stopped |
| ansible | None | stopped |
+----------+------------+-----------+
aws ec2 describe-instances \ --query "Reservations[*].Instances[*].{PublicIP:PublicIpAddress,Name:Tags[?Key=='Name']|[0].Value,Status:State.Name}" \ --filters Name=instance-state-name,
alejandrogarcia@MacBook-Air-de-Alejandro Downloads % aws --profile myprofileforaws ec2 describe-instances \
--query "Reservations[*].Instances[*].{PublicIP:PublicIpAddress,Name:Tags[?Key=='Name']|[0].Value,Status:State.Name,Instance:InstanceId}" --output table
------------------------------------------------------------
| DescribeInstances |
+----------------------+-----------+-----------+-----------+
| Instance | Name | PublicIP | Status |
+----------------------+-----------+-----------+-----------+
| i-08088aaa07c35fceb | minikube | None | stopped |
| i-0c21f4ff53460944d | ansible | None | stopped |
+----------------------+-----------+-----------+-----------+
alejandrogarcia@MacBook-Air-de-Alejandro Downloads % aws --profile myprofileforaws ec2 describe-instances \
--query "Reservations[*].Instances[*].{PublicIP:PublicIpAddress,Name:Tags[?Key=='Name']|[0].Value,Status:State.Name,Instance:InstanceId,DNS:PublicDnsName}" --output table
--------------------------------------------------------------------------------------------------------------
| DescribeInstances |
+--------------------------------------------+----------------------+-----------+----------------+-----------+
| DNS | Instance | Name | PublicIP | Status |
+--------------------------------------------+----------------------+-----------+----------------+-----------+
| ec2-34-203-246-26.compute-1.amazonaws.com | i-08088aaa07c35fceb | minikube | 34.203.246.26 | running |
| | i-0c21f4ff53460944d | ansible | None | stopped |
+--------------------------------------------+----------------------+-----------+----------------+-----------+
alejandrogarcia@MacBook-Air-de-Alejandro Downloads % aws --profile myprofileforaws ec2 start-instances --instance-ids i-08088aaa07c35fceb
{
"StartingInstances": [
{
"CurrentState": {
"Code": 0,
"Name": "pending"
},
"InstanceId": "i-08088aaa07c35fceb",
"PreviousState": {
"Code": 80,
"Name": "stopped"
}
}
]
}
alejandrogarcia@MacBook-Air-de-Alejandro Downloads % aws --profile myprofileforaws ec2 describe-instances --instance-ids i-08088aaa07c35fceb |grep PublicDnsName
"PublicDnsName": "ec2-34-203-246-26.compute-1.amazonaws.com",
"PublicDnsName": "ec2-34-203-246-26.compute-1.amazonaws.com",
"PublicDnsName": "ec2-34-203-246-26.compute-1.amazonaws.com",
No hay comentarios:
Publicar un comentario