例如,我想仅描述我的EC2实例的4个属性。就像SQL投影一样。
这就是我描述EC2实例的方式:
var settings = { apiVersion: '2017-01-01', region: process.env.AWS_REGION };
var ec2 = new AWS.EC2(settings);
var params = {
DryRun: false,
Filters: []
};
params.Filters.push({...});
ec2.describeInstances(params, function(err, data) {
....
});
data
对象返回预留对象列表。该预留对象有一个名为Instances
的属性,该数组中的每个对象如下所示:
{
AmiLaunchIndex: 0,
ImageId: 'ami-00000',
InstanceId: 'i-00000',
InstanceType: 't2.micro',
KeyName: 'KP',
LaunchTime: 2018-01-14T21:36:36.000Z,
Monitoring: [Object],
Placement: [Object],
PrivateDnsName: 'ip-0000000',
PrivateIpAddress: '172.0.0.0',
ProductCodes: [],
PublicDnsName: '',
State: [Object],
StateTransitionReason: 'User initiated (2018-01-14 21:49:51 GMT)',
SubnetId: 'subnet-000000',
VpcId: 'vpc-00000',
Architecture: 'x86_64',
BlockDeviceMappings: [Object],
ClientToken: 'vpyw000000',
EbsOptimized: false,
EnaSupport: true,
Hypervisor: 'xen',
IamInstanceProfile: [Object],
ElasticGpuAssociations: [],
NetworkInterfaces: [Object],
RootDeviceName: '/dev/sda1',
RootDeviceType: 'ebs',
SecurityGroups: [Object],
SourceDestCheck: true,
StateReason: [Object],
Tags: [Object],
VirtualizationType: 'hvm'
}
那么,我如何描述EC2实例的特定属性?这可能吗?