{"id":1767,"date":"2015-11-09T00:00:15","date_gmt":"2015-11-08T15:00:15","guid":{"rendered":"http:\/\/www.magtranetwork.com\/?p=1767"},"modified":"2017-04-21T12:02:44","modified_gmt":"2017-04-21T03:02:44","slug":"aws_cli_query_example","status":"publish","type":"post","link":"https:\/\/www.magtranetwork.com\/aws\/aws_cli_query_example.html","title":{"rendered":"AWS CLI\u306b\u304a\u3051\u308b–query\u306e\u4f7f\u3044\u65b9\u30fb\u66f8\u304d\u65b9\u30fb\u8a18\u8ff0\u4f8b"},"content":{"rendered":"

AWS\u30b5\u30fc\u30d3\u30b9\u306e\u30ea\u30bd\u30fc\u30b9\u3092\u30b3\u30de\u30f3\u30c9\u3084\u30d7\u30ed\u30b0\u30e9\u30e0\u304b\u3089\u4f7f\u7528\u3059\u308b\u305f\u3081\u306b\u7528\u610f\u3055\u308c\u3066\u3044\u308b\u3082\u306e\u304cAWS CLI\u3084\u5404\u30d7\u30ed\u30b0\u30e9\u30e0\u8a00\u8a9e\u306eAWS SDK\u306b\u306a\u308a\u307e\u3059\u3002
\n\u7279\u306bAWS CLI\u306fMac OSX\u3084Linux\u306a\u3069\u306e\u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\u304b\u3089\u5b9f\u884c\u3059\u308b\u3082\u306e\u306e\u305f\u3081\u3001Unix\u30d9\u30fc\u30b9\u306e\u958b\u767a\u3092\u884c\u306a\u3063\u3066\u3044\u308b\u5834\u5408\u306b\u306fAWS\u306e\u64cd\u4f5c\u3092\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3059\u308b\u306e\u306b\u5f37\u529b\u306a\u30c4\u30fc\u30eb\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n

\u305f\u3060\u3001AWS CLI\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306f\u82f1\u8a9e\u3067\u3042\u308a\u4e2d\u3067\u3082–query\u3068\u3044\u3046AWS CLI\u306e\u5b9f\u884c\u7d50\u679c\u306e\u8868\u793a\u5f62\u5f0f\u3092\u6307\u5b9a\u3057\u305f\u308a\u3001\u6761\u4ef6\u3092\u4e0e\u3048\u3066\u691c\u7d22\u7d50\u679c\u3092\u7d5e\u308a\u8fbc\u3093\u3060\u308a\u3059\u308b\u6a5f\u80fd\u306fAWS CLI\u3092\u521d\u3081\u3066\u4f7f\u7528\u3057\u305f\u969b\u306b\u306f\u89e3\u308a\u3065\u3089\u3044\u90e8\u5206\u3082\u3042\u308a\u307e\u3059\u3002
\n\u305d\u3053\u3067\u4eca\u56de\u306fAWS CLI\u306e–query\u3092\u8868\u793a\u5f62\u5f0f\u3092\u6307\u5b9a\u3059\u308b\u6a5f\u80fd\u306b\u3064\u3044\u3066\u66f8\u304d\u65b9\u30fb\u8a18\u8ff0\u4f8b\u3092\u5099\u5fd8\u9332\u3068\u3057\u3066\u8a18\u8f09\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n

\u306a\u304a\u3001\u5f8c\u8ff0\u3057\u307e\u3059\u304cAWS CLI\u306b\u306f–filters\u3068\u3044\u3046\u6a5f\u80fd\u3067\u691c\u7d22\u6761\u4ef6\u3092\u6307\u5b9a\u3057\u3066\u7d50\u679c\u3092\u7d5e\u308a\u8fbc\u3080\u6a5f\u80fd\u304c\u3042\u308a\u307e\u3059\u304c\u3001–query\u306b\u3082\u540c\u69d8\u306e\u3053\u3068\u304c\u3067\u304d\u308b\u6a5f\u80fd\u304c\u3042\u308a\u307e\u3059\u3002
\n\u3053\u306e\u70b9\u306b\u3064\u3044\u3066\u306f\u4eca\u56de\u306f\u8a18\u8f09\u305b\u305a\u3001\u5225\u306e\u6a5f\u4f1a\u306b\u8aac\u660e\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n

AWS CLI\u306b\u304a\u3051\u308b–query\u306e\u4f7f\u3044\u65b9\u30fb\u66f8\u304d\u65b9\u30fb\u8a18\u8ff0\u4f8b<\/h2>\n

AWS CLI\u306e–query\u306b\u6307\u5b9a\u3059\u308b\u30af\u30a8\u30ea\u30d1\u30e9\u30e1\u30bf\u306e\u66f8\u304d\u65b9\u30fb\u8a18\u8ff0\u65b9\u6cd5\u306e\u4f8b\u3092\u8a18\u8f09\u3057\u307e\u3059\u3002
\n\u307e\u305a–query\u3067\u691c\u7d22\u7d50\u679c\u306e\u8868\u793a\u5f62\u5f0f\u3092\u6307\u5b9a\u3057\u3066\u5fc5\u8981\u306a\u8981\u7d20\u3092\u8868\u793a\u3059\u308b\u305f\u3081\u306b\u91cd\u8981\u306b\u306a\u308b\u306e\u304c\u3001\u691c\u7d22\u7d50\u679c\u306e\u8fd4\u5374\u5024\u306e\u69cb\u9020\u306b\u306a\u308a\u307e\u3059\u3002
\n\u691c\u7d22\u7d50\u679c\u306e\u8fd4\u5374\u5024\u306e\u69cb\u9020\u306f\u5404AWS CLI\u30b3\u30de\u30f3\u30c9\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9\u306e\u300cOutput\u300d\u3068\u3044\u3046\u9805\u76ee\u90e8\u5206\u306b\u8a18\u8f09\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n

AWS CLI\u30b3\u30de\u30f3\u30c9\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9
\nhttps:\/\/docs.aws.amazon.com\/cli\/latest\/<\/a><\/p>\n

\u300cdescribe-images\u300d\u306eAWS CLI\u30b3\u30de\u30f3\u30c9\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9
\n
https:\/\/docs.aws.amazon.com\/cli\/latest\/reference\/ec2\/describe-images.html<\/a><\/p>\n

\u4eca\u56de\u306fAWS CLI\u306e\u3046\u3061\u6bd4\u8f03\u7684\u8981\u7d20\u306e\u9805\u76ee\u304c\u5c11\u306a\u304f\u69cb\u9020\u304c\u308f\u304b\u308a\u3084\u3059\u3044describe-images\u3067\u5404\u30a2\u30ab\u30a6\u30f3\u30c8\u3067\u5171\u901a\u3067\u4f7f\u7528\u51fa\u6765\u308bAmazon Linux\u306eAMI\u3092\u691c\u7d22\u5bfe\u8c61\u306b\u3057\u3066–query\u306e\u8a18\u8ff0\u4f8b\u3092\u8a18\u8f09\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n

AWS CLI\u306e\u691c\u7d22\u7d50\u679c\u304c1\u4ef6\u306e\u5834\u5408\u306e\u4f8b<\/h3>\n

\u307e\u305a\u306fAMI\u30921\u4ef6\u306e\u307f\u6307\u5b9a\u3057\u3066–query\u306e\u4f8b\u3092\u793a\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002
\n\u4ee5\u4e0b\u306e\u8aac\u660e\u3067\u4f7f\u7528\u3059\u308bAMI: ami-383c1956(Amazon Linux AMI 2015.09.1 x86_64 HVM GP2)<\/p>\n

–query\u3092\u4f7f\u7528\u305b\u305a\u691c\u7d22\u7d50\u679c\u3092\u305d\u306e\u307e\u307e\u8868\u793a\u3059\u308b\u4f8b<\/h4>\n

AWS CLI\u30b3\u30de\u30f3\u30c9\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9\u306e\u300cOutput\u300d\u306e\u69cb\u9020\u8aac\u660e\u3067\u308f\u304b\u308a\u306b\u304f\u3044\u5834\u5408\u306f\u691c\u7d22\u7d50\u679c\u304c1\u4ef6\u306b\u306a\u308b\u3088\u3046\u306b\u3057\u3066\u3001\u3053\u306e\u3088\u3046\u306b\u5b9f\u969b\u306b\u691c\u7d22\u3057\u3066\u5177\u4f53\u7684\u306a\u69cb\u9020\u3092\u628a\u63e1\u3059\u308b\u3053\u3068\u3082\u53ef\u80fd\u3067\u3059\u3002<\/p>\n

\r\n[magtranetwork@localhost ~]$ aws ec2 describe-images --image-id ami-383c1956 --output json\r\n{\r\n    "Images": [\r\n        {\r\n            "VirtualizationType": "hvm", \r\n            "Name": "amzn-ami-hvm-2015.09.1.x86_64-gp2", \r\n            "Hypervisor": "xen", \r\n            "ImageOwnerAlias": "amazon", \r\n            "SriovNetSupport": "simple", \r\n            "ImageId": "ami-383c1956", \r\n            "State": "available", \r\n            "BlockDeviceMappings": [\r\n                {\r\n                    "DeviceName": "\/dev\/xvda", \r\n                    "Ebs": {\r\n                        "DeleteOnTermination": true, \r\n                        "SnapshotId": "snap-09677294", \r\n                        "VolumeSize": 8, \r\n                        "VolumeType": "gp2", \r\n                        "Encrypted": false\r\n                    }\r\n                }\r\n            ], \r\n            "Architecture": "x86_64", \r\n            "ImageLocation": "amazon\/amzn-ami-hvm-2015.09.1.x86_64-gp2", \r\n            "RootDeviceType": "ebs", \r\n            "OwnerId": "137112412989", \r\n            "RootDeviceName": "\/dev\/xvda", \r\n            "CreationDate": "2015-10-29T18:13:04.000Z", \r\n            "Public": true, \r\n            "ImageType": "machine", \r\n            "Description": "Amazon Linux AMI 2015.09.1 x86_64 HVM GP2"\r\n        }\r\n    ]\r\n}\r\n<\/pre>\n

JSON\u914d\u5217\u300cImages\u300d\u306e\u5185\u5bb9\u3092\u8868\u793a\u3059\u308b\u4f8b\u3002<\/h4>\n

\u4e0a\u8a18\u306eJSON\u69cb\u9020\u306e\u3088\u3046\u306bImages\u306f\u914d\u5217\u5185\u306b\u8981\u7d20\u3092\u6301\u3064\u5f62\u306a\u306e\u3067Images\u306e\u5185\u5bb9\u3092\u8868\u793a\u3059\u308b\u306b\u306fImages[]\u3068[]\u3092\u3064\u3051\u3066\u914d\u5217\u578b\u3067\u793a\u3059\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n

\r\n[magtranetwork@localhost ~]$ aws ec2 describe-images --image-id ami-383c1956 --output json --query 'Images[]'\r\n[\r\n    {\r\n        "VirtualizationType": "hvm", \r\n        "Name": "amzn-ami-hvm-2015.09.1.x86_64-gp2", \r\n        "Hypervisor": "xen", \r\n        "ImageOwnerAlias": "amazon", \r\n        "SriovNetSupport": "simple", \r\n        "ImageId": "ami-383c1956", \r\n        "State": "available", \r\n        "BlockDeviceMappings": [\r\n            {\r\n                "DeviceName": "\/dev\/xvda", \r\n                "Ebs": {\r\n                    "DeleteOnTermination": true, \r\n                    "SnapshotId": "snap-09677294", \r\n                    "VolumeSize": 8, \r\n                    "VolumeType": "gp2", \r\n                    "Encrypted": false\r\n                }\r\n            }\r\n        ], \r\n        "Architecture": "x86_64", \r\n        "ImageLocation": "amazon\/amzn-ami-hvm-2015.09.1.x86_64-gp2", \r\n        "RootDeviceType": "ebs", \r\n        "OwnerId": "137112412989", \r\n        "RootDeviceName": "\/dev\/xvda", \r\n        "CreationDate": "2015-10-29T18:13:04.000Z", \r\n        "Public": true, \r\n        "ImageType": "machine", \r\n        "Description": "Amazon Linux AMI 2015.09.1 x86_64 HVM GP2"\r\n    }\r\n]\r\n<\/pre>\n

JSON\u914d\u5217\u300cImages\u300d\u306e\u5185\u5bb9\u306e\u5358\u4e00\u8981\u7d20(Name\u306e\u307f)\u3092\u8868\u793a\u3059\u308b\u4f8b<\/h4>\n

\u4e0a\u8a18\u306eJSON\u69cb\u9020\u306e\u3088\u3046\u306bImages\u306e\u5185\u5bb9\u306fBlockDeviceMappings\u4ee5\u5916\u914d\u5217\u69cb\u9020\u3067\u306f\u306a\u3044\u306e\u3067\u9805\u76ee\u540d\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u3067\u8868\u793a\u3067\u304d\u307e\u3059\u3002
\nImages\u914d\u5217\u5185\u306eName\u9805\u76ee\u3092\u8868\u793a\u3059\u308b\u306b\u306fImages[].Name\u3068\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n

\r\n[magtranetwork@localhost ~]$ aws ec2 describe-images --image-id ami-383c1956 --output json --query 'Images[].Name'\r\n[\r\n    "amzn-ami-hvm-2015.09.1.x86_64-gp2"\r\n]\r\n<\/pre>\n

JSON\u914d\u5217\u300cImages\u300d\u306e\u5185\u5bb9\u306e\u5358\u4e00\u8981\u7d20(Name\u306e\u307f)\u3092\u30ad\u30fc\u540d\u300cAMI Name\u300d\u3092\u3064\u3051\u3066\u8868\u793a\u3059\u308b\u4f8b<\/h4>\n

\u4e0a\u8a18\u306eJSON\u3067\u51fa\u529b\u3055\u308c\u308bName\u9805\u76ee\u306b\u30ad\u30fc\u540d\u3092\u4e0e\u3048\u308b\u306b\u306fImages[].{“AMI Name”: Name}\u306e\u3088\u3046\u306b\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n

\r\n[magtranetwork@localhost ~]$ aws ec2 describe-images --image-id ami-383c1956 --output json --query 'Images[].{"AMI Name": Name}'\r\n[\r\n    {\r\n        "AMI Name": "amzn-ami-hvm-2015.09.1.x86_64-gp2"\r\n    }\r\n]\r\n<\/pre>\n

JSON\u914d\u5217\u300cImages\u300d\u306b\u30ad\u30fc\u540d\u300cAMI\u300d\u3092\u3064\u3051\u3066\u5185\u5bb9\u306e\u5358\u4e00\u8981\u7d20(Name\u306e\u307f)\u3092\u30ad\u30fc\u540d\u300cAMI Name\u300d\u3092\u3064\u3051\u3066\u8868\u793a\u3059\u308b\u4f8b<\/h4>\n

Images\u914d\u5217\u306b\u30ad\u30fc\u540d\u3092\u4e0e\u3048\u308b\u306b\u306f{“AMI”: Images[].{“AMI Name”: Name}}\u306e\u3088\u3046\u306b\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n

\r\n[magtranetwork@localhost ~]$ aws ec2 describe-images --image-id ami-383c1956 --output json --query '{"AMI": Images[].{"AMI Name": Name}}'\r\n{\r\n    "AMI": [\r\n        {\r\n            "AMI Name": "amzn-ami-hvm-2015.09.1.x86_64-gp2"\r\n        }\r\n    ]\r\n}\r\n<\/pre>\n

JSON\u914d\u5217\u300cImages\u300d\u306e\u5148\u982d\u8981\u7d20(0\u756a\u76ee)\u306b\u30ad\u30fc\u540d\u300cAMI\u300d\u3092\u3064\u3051\u3066\u5185\u5bb9\u306e\u5358\u4e00\u8981\u7d20(Name\u306e\u307f)\u3092\u30ad\u30fc\u540d\u300cAMI Name\u300d\u3092\u3064\u3051\u3066\u8868\u793a\u3059\u308b\u4f8b<\/h4>\n

\u4eca\u56de\u306e\u4f8b\u306e\u5834\u5408Images\u914d\u5217\u306e\u8981\u7d20\u306f1\u500b\u3067\u3001Images\u306e\u914d\u5217\u8981\u7d20\u30921\u3064\u306e\u307f\u53d6\u308a\u51fa\u3057\u3066\u914d\u5217\u69cb\u9020\u3067\u306f\u306a\u3044\u8868\u8a18\u306b\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002
\n\u305d\u306e\u305f\u3081\u306b\u306fImages[0]\u306e\u3088\u3046\u306b\u914d\u5217\u306e\u8981\u7d20\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n

\r\n[magtranetwork@localhost ~]$ aws ec2 describe-images --image-id ami-383c1956 --output json --query '{"AMI": Images[0].{"AMI Name": Name}}'\r\n{\r\n    "AMI": {\r\n        "AMI Name": "amzn-ami-hvm-2015.09.1.x86_64-gp2"\r\n    }\r\n}\r\n<\/pre>\n

JSON\u914d\u5217\u300cImages\u300d\u306e\u5148\u982d\u8981\u7d20(0\u756a\u76ee)\u306e\u5185\u5bb9\u306e\u5358\u4e00\u8981\u7d20(Name\u306e\u307f)\u3092\u30ad\u30fc\u540d\u300cAMI Name\u300d\u3092\u3064\u3051\u3066\u8868\u793a\u3059\u308b\u4f8b<\/h4>\n

Images\u306e\u914d\u5217\u8981\u7d20\u30921\u3064\u306e\u307f\u53d6\u308a\u51fa\u3057\u3066\u914d\u5217\u69cb\u9020\u3067\u306f\u306a\u3044\u8868\u8a18\u306b\u3057\u3001Name\u9805\u76ee\u306b\u30ad\u30fc\u540d\u3092\u3064\u3051\u3066\u51fa\u529b\u3057\u307e\u3059\u3002<\/p>\n

\r\n[magtranetwork@localhost ~]$ aws ec2 describe-images --image-id ami-383c1956 --output json --query '{"AMI Name": Images[0].Name}'\r\n{\r\n    "AMI Name": "amzn-ami-hvm-2015.09.1.x86_64-gp2"\r\n}\r\n<\/pre>\n

\u7d9a\u3044\u3066\u306fImages\u914d\u5217\u5185\u306eName\u9805\u76ee\u306b\u52a0\u3048\u3066ImageId\u3068\u3044\u3046\u9805\u76ee\u3092\u8868\u793a\u3059\u308b\u4f8b\u3092\u8a18\u8f09\u3057\u3066\u3044\u304d\u307e\u3059\u304c\u3001\u57fa\u672c\u7684\u306b\u306f\u4e0a\u8a18\u3067\u8aac\u660e\u3057\u305fName\u306e\u307f\u306e\u9805\u76ee\u306e\u8868\u793a\u3068\u540c\u69d8\u3067\u3059\u3002<\/p>\n

JSON\u914d\u5217\u300cImages\u300d\u306e\u5185\u5bb9\u306e\u8907\u6570\u8981\u7d20(ImageId\u3001Name)\u3092\u8868\u793a\u3059\u308b\u4f8b<\/h4>\n
\r\n[magtranetwork@localhost ~]$ aws ec2 describe-images --image-id ami-383c1956 --output json --query 'Images[].[ImageId,Name]'\r\n[\r\n    [\r\n        "ami-383c1956", \r\n        "amzn-ami-hvm-2015.09.1.x86_64-gp2"\r\n    ]\r\n]\r\n<\/pre>\n

JSON\u914d\u5217\u300cImages\u300d\u306e\u5185\u5bb9\u306e\u8907\u6570\u8981\u7d20(ImageId\u3001Name)\u306b\u305d\u308c\u305e\u308c\u30ad\u30fc\u540d\u300cAMI ID\u300d\u300cAMI Name\u300d\u3092\u3064\u3051\u3066\u8868\u793a\u3059\u308b\u4f8b<\/h4>\n
\r\n[magtranetwork@localhost ~]$ aws ec2 describe-images --image-id ami-383c1956 --output json --query 'Images[].{"AMI ID": ImageId,"AMI Name": Name}'\r\n[\r\n    {\r\n        "AMI Name": "amzn-ami-hvm-2015.09.1.x86_64-gp2", \r\n        "AMI ID": "ami-383c1956"\r\n    }\r\n]\r\n<\/pre>\n

JSON\u914d\u5217\u300cImages\u300d\u306b\u30ad\u30fc\u540d\u300cAMI\u300d\u3092\u3064\u3051\u3066\u5185\u5bb9\u306e\u8907\u6570\u8981\u7d20(ImageId\u3001Name)\u306b\u305d\u308c\u305e\u308c\u30ad\u30fc\u540d\u300cAMI ID\u300d\u300cAMI Name\u300d\u3092\u3064\u3051\u3066\u8868\u793a\u3059\u308b\u4f8b<\/h4>\n
\r\n[magtranetwork@localhost ~]$ aws ec2 describe-images --image-id ami-383c1956 --output json --query '{"AMI": Images[].{"AMI ID": ImageId,"AMI Name": Name}}'\r\n{\r\n    "AMI": [\r\n        {\r\n            "AMI Name": "amzn-ami-hvm-2015.09.1.x86_64-gp2", \r\n            "AMI ID": "ami-383c1956"\r\n        }\r\n    ]\r\n}\r\n<\/pre>\n

JSON\u914d\u5217\u300cImages\u300d\u306e\u5148\u982d\u8981\u7d20(0\u756a\u76ee)\u306b\u30ad\u30fc\u540d\u300cAMI\u300d\u3092\u3064\u3051\u3066\u5185\u5bb9\u306e\u8907\u6570\u8981\u7d20(ImageId\u3001Name)\u306b\u305d\u308c\u305e\u308c\u30ad\u30fc\u540d\u300cAMI ID\u300d\u300cAMI Name\u300d\u3092\u3064\u3051\u3066\u8868\u793a\u3059\u308b\u4f8b<\/h4>\n
\r\n[magtranetwork@localhost ~]$ aws ec2 describe-images --image-id ami-383c1956 --output json --query '{"AMI": Images[0].{"AMI ID": ImageId,"AMI Name": Name}}'\r\n{\r\n    "AMI": {\r\n        "AMI Name": "amzn-ami-hvm-2015.09.1.x86_64-gp2", \r\n        "AMI ID": "ami-383c1956"\r\n    }\r\n}\r\n<\/pre>\n

JSON\u914d\u5217\u300cImages\u300d\u306e\u5148\u982d\u8981\u7d20(0\u756a\u76ee)\u306e\u5185\u5bb9\u306e\u8907\u6570\u8981\u7d20(ImageId\u3001Name)\u306b\u305d\u308c\u305e\u308c\u30ad\u30fc\u540d\u300cAMI ID\u300d\u300cAMI Name\u300d\u3092\u3064\u3051\u3066\u8868\u793a\u3059\u308b\u4f8b<\/h4>\n
\r\n[magtranetwork@localhost ~]$ aws ec2 describe-images --image-id ami-383c1956 --output json --query '{"AMI ID": Images[0].ImageId,"AMI Name": Images[0].Name}'\r\n{\r\n    "AMI Name": "amzn-ami-hvm-2015.09.1.x86_64-gp2", \r\n    "AMI ID": "ami-383c1956"\r\n}\r\n<\/pre>\n

AWS CLI\u306e\u691c\u7d22\u7d50\u679c\u304c\u8907\u6570\u306e\u5834\u5408\u306e\u4f8b<\/h3>\n

\u7d9a\u3044\u3066\u306fJSON\u914d\u5217\u300cImages\u300d\u306b\u8907\u6570\u8981\u7d20\u304c\u5165\u3063\u3066\u3044\u308b\u4f8b\u306e–query\u306e\u8a18\u8ff0\u4f8b\u3092\u898b\u3066\u3044\u304d\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002
\n\u307e\u305fJSON\u914d\u5217\u300cImages\u300d\u5185\u306b\u5165\u308c\u5b50\u306b\u306a\u3063\u3066\u3044\u308bJSON\u914d\u5217\u300cBlockDeviceMappings\u300d\u306e\u8868\u793a\u306e\u4ed5\u65b9\u306b\u3064\u3044\u3066\u3082\u8a18\u8ff0\u4f8b\u3092\u8a18\u8f09\u3057\u307e\u3057\u305f\u3002<\/p>\n

\u8981\u7d20\u3092\u308f\u304b\u308a\u3084\u3059\u304f\u3059\u308b\u305f\u3081\u306b\u4eca\u56de\u306f–filters\u306e\u6a5f\u80fd\u3092\u4f7f\u7528\u3057\u3066\u691c\u7d22\u7d50\u679c\u30922\u4ef6\u306b\u7d5e\u308a\u8fbc\u3093\u3067\u3044\u307e\u3059\u3002–filters\u306e\u8a18\u8ff0\u65b9\u6cd5\u306b\u3064\u3044\u3066\u306f\u5225\u9014\u8a18\u8f09\u3059\u308b\u6a5f\u4f1a\u3092\u4f5c\u308a\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u304c\u3001\u57fa\u672c\u7684\u306b\u306fName\u306b\u691c\u7d22\u3059\u308b\u5bfe\u8c61\u306e\u9805\u76ee\u540d\u3001Values\u306b\u691c\u7d22\u6761\u4ef6\u3092\u8a18\u5165\u3057\u3066\u691c\u7d22\u3057\u307e\u3059\u3002
\n\u4f59\u8ac7\u3067\u3059\u304c\u3001–query\u3067\u3082–filters\u3068\u540c\u3058\u3088\u3046\u306b\u691c\u7d22\u6761\u4ef6\u3092\u6307\u5b9a\u3057\u3066\u691c\u7d22\u7d50\u679c\u3092\u7d5e\u308a\u8fbc\u3080\u6a5f\u80fd\u3082\u3042\u308b\u306e\u3067\u3059\u304c\u3001\u4eca\u56de\u306f\u691c\u7d22\u7d50\u679c\u306e\u8868\u793a\u5f62\u5f0f\u306e\u90e8\u5206\u306b\u7279\u5316\u3057\u3066\u8aac\u660e\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n

\u9805\u76ee\u540d\u306b\u3064\u3044\u3066\u306f–query\u3067\u4f7f\u7528\u3059\u308b\u8fd4\u5374\u7d50\u679c\u306e\u69cb\u9020\u3068\u540c\u69d8\u306bCLI\u306e\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9\u306e\u300c–filters\u300d\u306e\u90e8\u5206\u306b\u8a18\u8f09\u3055\u308c\u3066\u3044\u307e\u3059\u3002
\nhttps:\/\/docs.aws.amazon.com\/cli\/latest\/reference\/ec2\/describe-images.html<\/a><\/p>\n

\u4ee5\u4e0b\u306e\u8aac\u660e\u3067\u4f7f\u7528\u3059\u308b–filters\u306e\u6761\u4ef6: \u300cAmazon*Linux*2015*\u300d \u2192 ami-be728fbe(Amazon Linux AMI 2015.03 (PV) – by VisualOps)\u3001ami-d0728fd0(Amazon Linux AMI 2015.03 (HVM) – by VisualOps)<\/p>\n

–query\u3092\u4f7f\u7528\u305b\u305a\u7d50\u679c\u3092JSON\u5f62\u5f0f\u3067\u305d\u306e\u307e\u307e\u8868\u793a<\/h4>\n
\r\n[magtranetwork@localhost ~]$ aws ec2 describe-images --filters "Name=name,Values=Amazon*Linux*2015*" --output json\r\n{\r\n    "Images": [\r\n        {\r\n            "VirtualizationType": "paravirtual", \r\n            "Name": "Amazon Linux AMI 2015.03 (PV) - by VisualOps", \r\n            "Hypervisor": "xen", \r\n            "ImageId": "ami-be728fbe", \r\n            "RootDeviceType": "ebs", \r\n            "State": "available", \r\n            "BlockDeviceMappings": [\r\n                {\r\n                    "DeviceName": "\/dev\/sda1", \r\n                    "Ebs": {\r\n                        "DeleteOnTermination": true, \r\n                        "SnapshotId": "snap-399521a2", \r\n                        "VolumeSize": 8, \r\n                        "VolumeType": "gp2", \r\n                        "Encrypted": false\r\n                    }\r\n                }\r\n            ], \r\n            "Architecture": "x86_64", \r\n            "ImageLocation": "575264825971\/Amazon Linux AMI 2015.03 (PV) - by VisualOps", \r\n            "KernelId": "aki-176bf516", \r\n            "OwnerId": "575264825971", \r\n            "RootDeviceName": "\/dev\/sda1", \r\n            "CreationDate": "2015-04-01T03:10:07.000Z", \r\n            "Public": true, \r\n            "ImageType": "machine", \r\n            "Description": "The Amazon Linux AMI is an EBS-backed, AWS-supported image. The default image includes AWS command line tools, Python, Ruby, Perl, and Java. The repositories include Docker, PHP, MySQL, PostgreSQL, other packages and VisualOps OpsAgent."\r\n        }, \r\n        {\r\n            "VirtualizationType": "hvm", \r\n            "Name": "Amazon Linux AMI 2015.03 (HVM) - by VisualOps", \r\n            "Hypervisor": "xen", \r\n            "SriovNetSupport": "simple", \r\n            "ImageId": "ami-d0728fd0", \r\n            "State": "available", \r\n            "BlockDeviceMappings": [\r\n                {\r\n                    "DeviceName": "\/dev\/xvda", \r\n                    "Ebs": {\r\n                        "DeleteOnTermination": true, \r\n                        "SnapshotId": "snap-df962244", \r\n                        "VolumeSize": 8, \r\n                        "VolumeType": "gp2", \r\n                        "Encrypted": false\r\n                    }\r\n                }\r\n            ], \r\n            "Architecture": "x86_64", \r\n            "ImageLocation": "575264825971\/Amazon Linux AMI 2015.03 (HVM) - by VisualOps", \r\n            "RootDeviceType": "ebs", \r\n            "OwnerId": "575264825971", \r\n            "RootDeviceName": "\/dev\/xvda", \r\n            "CreationDate": "2015-04-01T03:14:18.000Z", \r\n            "Public": true, \r\n            "ImageType": "machine", \r\n            "Description": "The Amazon Linux AMI is an EBS-backed, AWS-supported image. The default image includes AWS command line tools, Python, Ruby, Perl, and Java. The repositories include Docker, PHP, MySQL, PostgreSQL, other packages and VisualOps OpsAgent."\r\n        }\r\n    ]\r\n}\r\n<\/pre>\n

JSON\u914d\u5217\u300cImages\u300d\u306b\u30ad\u30fc\u540d\u300cAMI\u300d\u3092\u3064\u3051\u3066\u5185\u5bb9\u306e\u8907\u6570\u8981\u7d20(ImageId\u3001Name)\u306b\u305d\u308c\u305e\u308c\u30ad\u30fc\u540d\u300cAMI ID\u300d\u300cAMI Name\u300d\u3092\u3064\u3051\u3066\u8868\u793a\u3059\u308b\u4f8b<\/h4>\n
\r\n[magtranetwork@localhost ~]$ aws ec2 describe-images --filters "Name=name,Values=Amazon*Linux*2015*" --output json --query '{"AMI": Images[].{"AMI ID": ImageId,"AMI Name": Name}}'\r\n{\r\n    "AMI": [\r\n        {\r\n            "AMI Name": "Amazon Linux AMI 2015.03 (PV) - by VisualOps", \r\n            "AMI ID": "ami-be728fbe"\r\n        }, \r\n        {\r\n            "AMI Name": "Amazon Linux AMI 2015.03 (HVM) - by VisualOps", \r\n            "AMI ID": "ami-d0728fd0"\r\n        }\r\n    ]\r\n}\r\n<\/pre>\n

JSON\u914d\u5217\u300cImages\u300d\u306b\u30ad\u30fc\u540d\u300cAMI\u300d\u3092\u3064\u3051\u3066\u5185\u5bb9\u306e\u8907\u6570\u8981\u7d20(ImageId\u3001Name\u3001BlockDeviceMappings)\u306b\u305d\u308c\u305e\u308c\u30ad\u30fc\u540d\u300cAMI ID\u300d\u300cAMI Name\u300d\u300cEBS\u300d\u3092\u3064\u3051\u3066\u8868\u793a\u3059\u308b\u4f8b<\/h4>\n

JSON\u914d\u5217\u300cImages\u300d\u306b\u5165\u308c\u5b50\u3067\u5165\u3063\u3066\u3044\u308bJSON\u914d\u5217\u300cBlockDeviceMappings\u300d\u306e\u5185\u5bb9\u306f\u305d\u306e\u307e\u307e\u8868\u793a\u3002<\/p>\n

\r\n[magtranetwork@localhost ~]$ aws ec2 describe-images --filters "Name=name,Values=Amazon*Linux*2015*" --output json --query '{"AMI": Images[].{"AMI ID": ImageId,"AMI Name": Name,"EBS": BlockDeviceMappings[]}}'\r\n{\r\n    "AMI": [\r\n        {\r\n            "AMI Name": "Amazon Linux AMI 2015.03 (PV) - by VisualOps", \r\n            "AMI ID": "ami-be728fbe", \r\n            "EBS": [\r\n                {\r\n                    "DeviceName": "\/dev\/sda1", \r\n                    "Ebs": {\r\n                        "DeleteOnTermination": true, \r\n                        "SnapshotId": "snap-399521a2", \r\n                        "VolumeSize": 8, \r\n                        "VolumeType": "gp2", \r\n                        "Encrypted": false\r\n                    }\r\n                }\r\n            ]\r\n        }, \r\n        {\r\n            "AMI Name": "Amazon Linux AMI 2015.03 (HVM) - by VisualOps", \r\n            "AMI ID": "ami-d0728fd0", \r\n            "EBS": [\r\n                {\r\n                    "DeviceName": "\/dev\/xvda", \r\n                    "Ebs": {\r\n                        "DeleteOnTermination": true, \r\n                        "SnapshotId": "snap-df962244", \r\n                        "VolumeSize": 8, \r\n                        "VolumeType": "gp2", \r\n                        "Encrypted": false\r\n                    }\r\n                }\r\n            ]\r\n        }\r\n    ]\r\n}\r\n<\/pre>\n

JSON\u914d\u5217\u300cImages\u300d\u306b\u30ad\u30fc\u540d\u300cAMI\u300d\u3092\u3064\u3051\u3066\u5185\u5bb9\u306e\u8907\u6570\u8981\u7d20(ImageId\u3001Name\u3001BlockDeviceMappings)\u306b\u305d\u308c\u305e\u308c\u30ad\u30fc\u540d\u300cAMI ID\u300d\u300cAMI Name\u300d\u300cEBS\u300d\u3092\u3064\u3051\u3066\u8868\u793a\u3059\u308b\u4f8b<\/h4>\n

JSON\u914d\u5217\u300cImages\u300d\u306b\u5165\u308c\u5b50\u3067\u5165\u3063\u3066\u3044\u308bJSON\u914d\u5217\u300cBlockDeviceMappings\u300d\u306e\u5185\u5bb9\u306f\u8907\u6570\u8981\u7d20(VolumeType\u3001VolumeSize)\u306b\u305d\u308c\u305e\u308c\u30ad\u30fc\u540d\u300cVolType\u300d\u300cVolSize\u300d\u3092\u3064\u3051\u3066\u8868\u793a\u3002<\/p>\n

\r\n[magtranetwork@localhost ~]$ aws ec2 describe-images --filters "Name=name,Values=Amazon*Linux*2015*" --output json --query '{"AMI": Images[].{"AMI ID": ImageId,"AMI Name": Name,"EBS": BlockDeviceMappings[].Ebs.{"VolType":VolumeType,"VolSize":VolumeSize}}}'\r\n{\r\n    "AMI": [\r\n        {\r\n            "AMI Name": "Amazon Linux AMI 2015.03 (PV) - by VisualOps", \r\n            "AMI ID": "ami-be728fbe", \r\n            "EBS": [\r\n                {\r\n                    "VolType": "gp2", \r\n                    "VolSize": 8\r\n                }\r\n            ]\r\n        }, \r\n        {\r\n            "AMI Name": "Amazon Linux AMI 2015.03 (HVM) - by VisualOps", \r\n            "AMI ID": "ami-d0728fd0", \r\n            "EBS": [\r\n                {\r\n                    "VolType": "gp2", \r\n                    "VolSize": 8\r\n                }\r\n            ]\r\n        }\r\n    ]\r\n}\r\n<\/pre>\n

JSON\u914d\u5217\u300cImages\u300d\u306b\u30ad\u30fc\u540d\u300cAMI\u300d\u3092\u3064\u3051\u3066\u5185\u5bb9\u306e\u8907\u6570\u8981\u7d20(ImageId\u3001Name\u3001BlockDeviceMappings[].Ebs.VolumeType\u3001BlockDeviceMappings[].Ebs.VolumeSize)\u306b\u305d\u308c\u305e\u308c\u30ad\u30fc\u540d\u300cAMI ID\u300d\u300cAMI Name\u300d\u300cVolType\u300d\u300cVolSize\u300d\u3092\u3064\u3051\u3066\u8868\u793a\u3059\u308b\u4f8b<\/h4>\n

JSON\u914d\u5217\u300cImages\u300d\u306b\u5165\u308c\u5b50\u3067\u5165\u3063\u3066\u3044\u308bJSON\u914d\u5217\u300cBlockDeviceMappings\u300d\u306f\u4e0a\u8a18\u306eBlockDeviceMappings[].Ebs.VolumeType\u3001BlockDeviceMappings[].Ebs.VolumeSize\u3088\u3046\u306b\u300cAMI ID\u300d\u300cAMI Name\u300d\u3068\u540c\u3058\u968e\u5c64\u306b\u76f4\u63a5\u547c\u3073\u51fa\u3059\u3002<\/p>\n

\r\n[magtranetwork@localhost ~]$ aws ec2 describe-images --filters "Name=name,Values=Amazon*Linux*2015*" --output json --query '{"AMI": Images[].{"AMI ID": ImageId,"AMI Name": Name,"VolType": BlockDeviceMappings[].Ebs.VolumeType,"VolSize": BlockDeviceMappings[].Ebs.VolumeSize}}'\r\n{\r\n    "AMI": [\r\n        {\r\n            "AMI Name": "Amazon Linux AMI 2015.03 (PV) - by VisualOps", \r\n            "VolType": [\r\n                "gp2"\r\n            ], \r\n            "AMI ID": "ami-be728fbe", \r\n            "VolSize": [\r\n                8\r\n            ]\r\n        }, \r\n        {\r\n            "AMI Name": "Amazon Linux AMI 2015.03 (HVM) - by VisualOps", \r\n            "VolType": [\r\n                "gp2"\r\n            ], \r\n            "AMI ID": "ami-d0728fd0", \r\n            "VolSize": [\r\n                8\r\n            ]\r\n        }\r\n    ]\r\n}\r\n<\/pre>\n

JSON\u914d\u5217\u300cImages\u300d\u306b\u30ad\u30fc\u540d\u300cAMI\u300d\u3092\u3064\u3051\u3066\u5185\u5bb9\u306e\u8907\u6570\u8981\u7d20(ImageId\u3001Name\u3001BlockDeviceMappings[].Ebs.VolumeType\u3001BlockDeviceMappings[].Ebs.VolumeSize)\u306b\u305d\u308c\u305e\u308c\u30ad\u30fc\u540d\u300cAMI ID\u300d\u300cAMI Name\u300d\u300cVolType\u300d\u300cVolSize\u300d\u3092\u3064\u3051\u3066\u8868\u793a\u3059\u308b\u4f8b<\/h4>\n

JSON\u914d\u5217\u300cImages\u300d\u306b\u5165\u308c\u5b50\u3067\u5165\u3063\u3066\u3044\u308bJSON\u914d\u5217\u300cBlockDeviceMappings\u300d\u306e\u5148\u982d\u8981\u7d20(0\u756a\u76ee)\u306e\u5185\u5bb9\u3092BlockDeviceMappings[].Ebs.VolumeType\u3001BlockDeviceMappings[].Ebs.VolumeSize\u3088\u3046\u306b\u300cAMI ID\u300d\u300cAMI Name\u300d\u3068\u540c\u3058\u968e\u5c64\u306b\u76f4\u63a5\u547c\u3073\u51fa\u3059\u3002<\/p>\n

\r\n[magtranetwork@localhost ~]$ aws ec2 describe-images --filters "Name=name,Values=Amazon*Linux*2015*" --output json --query '{"AMI": Images[].{"AMI ID": ImageId,"AMI Name": Name,"VolType": BlockDeviceMappings[0].Ebs.VolumeType,"VolSize": BlockDeviceMappings[0].Ebs.VolumeSize}}'\r\n{\r\n    "AMI": [\r\n        {\r\n            "AMI Name": "Amazon Linux AMI 2015.03 (PV) - by VisualOps", \r\n            "VolType": "gp2", \r\n            "AMI ID": "ami-be728fbe", \r\n            "VolSize": 8\r\n        }, \r\n        {\r\n            "AMI Name": "Amazon Linux AMI 2015.03 (HVM) - by VisualOps", \r\n            "VolType": "gp2", \r\n            "AMI ID": "ami-d0728fd0", \r\n            "VolSize": 8\r\n        }\r\n    ]\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"

AWS\u30b5\u30fc\u30d3\u30b9\u306e\u30ea\u30bd\u30fc\u30b9\u3092\u30b3\u30de\u30f3\u30c9\u3084\u30d7\u30ed\u30b0\u30e9\u30e0\u304b\u3089\u4f7f\u7528\u3059\u308b\u305f\u3081\u306b\u7528\u610f\u3055\u308c\u3066\u3044\u308b\u3082\u306e\u304cAWS CLI\u3084\u5404\u30d7\u30ed\u30b0\u30e9\u30e0\u8a00\u8a9e\u306eAWS SDK\u306b\u306a\u308a\u307e\u3059\u3002 \u7279\u306bAWS CLI\u306fMac OSX\u3084Linux\u306a\u3069\u306e\u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\u304b\u3089\u5b9f […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":""},"categories":[3,81],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.magtranetwork.com\/wp-json\/wp\/v2\/posts\/1767"}],"collection":[{"href":"https:\/\/www.magtranetwork.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.magtranetwork.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.magtranetwork.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.magtranetwork.com\/wp-json\/wp\/v2\/comments?post=1767"}],"version-history":[{"count":5,"href":"https:\/\/www.magtranetwork.com\/wp-json\/wp\/v2\/posts\/1767\/revisions"}],"predecessor-version":[{"id":5548,"href":"https:\/\/www.magtranetwork.com\/wp-json\/wp\/v2\/posts\/1767\/revisions\/5548"}],"wp:attachment":[{"href":"https:\/\/www.magtranetwork.com\/wp-json\/wp\/v2\/media?parent=1767"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.magtranetwork.com\/wp-json\/wp\/v2\/categories?post=1767"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.magtranetwork.com\/wp-json\/wp\/v2\/tags?post=1767"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}