AwsCLI
Материал из noname.com.ua
Перейти к навигацииПерейти к поиску
AWS CLI
Сниппеты работы с AWS CLI - шпаргалка
Вывод в тексте
aws ec2 describe-instances --query 'Reservations[*].Instances[*].[Placement.AvailabilityZone, State.Name, InstanceId]'
ap-southeast-1b running i-0cddd1f1b8d20e34b ap-southeast-1b running i-0e3450c0c7052f960 ...
Пример с таблицей
aws ec2 describe-instances --query 'Reservations[].Instances[].{Name:Tags[?Key==`Name`]|[0].Value,PublicIP:PublicIpAddress}' --output table
----------------------------------------------------------------------------------------------- | DescribeInstances | +---------------------------------------------------------------------------+-----------------+ | Name | PublicIP | +---------------------------------------------------------------------------+-----------------+ | some-host | 52.0.0.0 | +---------------------------------------------------------------------------+-----------------+
Еще пример с выводом таблицы
aws ec2 describe-instances --query 'Reservations[].Instances[].{Name:Tags[?Key==`Name`]|[0].Value,PublicIP:PublicIpAddress, AvailabilityZone:Placement.AvailabilityZone, State:State.Name}' --output table
--------------------------------------------------------------------------------------------------------------------------------- | DescribeInstances | +------------------+---------------------------------------------------------------------------+-----------------+--------------+ | AvailabilityZone | Name | PublicIP | State | +------------------+---------------------------------------------------------------------------+-----------------+--------------+ | ap-southeast-1a | opentsdb03_production_v4 | None | running | +------------------+---------------------------------------------------------------------------+-----------------+--------------+
aws ec2 describe-instances --query 'Reservations[*].Instances[*].BlockDeviceMappings[*].Ebs.VolumeId[][]' aws ec2 describe-instances --query 'Reservations[*].Instances[*].BlockDeviceMappings[*].Ebs.VolumeId[][]' --filters "Name=tag:stack,Values=production"