📜  aws cli ec2 列表实例 - Shell-Bash 代码示例

📅  最后修改于: 2022-03-11 14:50:42.549000             🧑  作者: Mango

代码示例1
# Get list of all EC2 (all info)
awsProfile="awsProfileName" # Use your aws profile name
aws --profile "$awsProfile" ec2 describe-instances

# Get list of all EC2 (custom filter)
awsProfile="awsProfileName" # Use your aws profile name
awsQuery="Reservations[].Instances[].{InstanceId:InstanceId,Placement:Placement,PrivateIpAddress:PrivateIpAddress,PublicIpAddress:PublicIpAddress,Tags:Tags}"
aws --profile "$awsProfile" ec2 describe-instances --query "$awsQuery"