我通过使用AWS -SDK.EC2.description information获取AWS实例信息,以下是数组中的一个元素:
stdout: {
stdout: AmiLaunchIndex: 0,
stdout: ImageId: 'ami-00d03ffa3b3757af2',
stdout: InstanceId: 'i-09167c582a8d016ae',
stdout: InstanceType: 'r5.4xlarge',
stdout: KeyName: 'interos-prod',
stdout: LaunchTime: 2019-08-20T18:01:14.000Z,
stdout: Monitoring: { State: 'disabled' },
stdout: Placement: {
stdout: AvailabilityZone: 'us-west-2c',
stdout: GroupName: '',
stdout: Tenancy: 'default'
stdout: },
stdout: PrivateDnsName: 'ip-xxx-31-9-xxx.us-west-2.compute.internal',
stdout: PrivateIpAddress: '172.31.9.226',
stdout: ProductCodes: [],
stdout: PublicDnsName: 'ec2-54-xxx-226-xxx.us-west-2.compute.amazonaws.com',
stdout: PublicIpAddress: '54.201.xxx.xxx',
stdout: State: { Code: 16, Name: 'running' },
stdout: StateTransitionReason: '',
stdout: SubnetId: 'subnet-f3ee49a9',
stdout: VpcId: 'vpc-7e338d07',
stdout: Architecture: 'x86_64',
stdout: BlockDeviceMappings: [ [Object] ],
stdout: ClientToken: '',
stdout: EbsOptimized: true,
stdout: EnaSupport: true,
stdout: Hypervisor: 'xen',
stdout: ElasticGpuAssociations: [],
stdout: ElasticInferenceAcceleratorAssociations: [],
stdout: NetworkInterfaces: [ [Object] ],
stdout: RootDeviceName: '/dev/sda1',
stdout: RootDeviceType: 'ebs',
stdout: SecurityGroups: [ [Object] ],
stdout: SourceDestCheck: true,
stdout: Tags: [ [Object], [Object] ],
stdout: VirtualizationType: 'hvm',
stdout: CpuOptions: { CoreCount: 8, ThreadsPerCore: 2 },
stdout: CapacityReservationSpecification: { CapacityReservationPreference: 'open' },
stdout: HibernationOptions: { Configured: false },
stdout: Licenses: []
stdout: },有人知道吗?我想弄清楚它是ubuntu还是amazon-linux,或者其他什么操作系统。
发布于 2019-09-24 05:48:12
参考:https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-images.html
您应该能够在第3行查询映像ID?"ImageId:'ami-00d03ffa3b3757af2'“--> aws ec2 describe-images --image-ids ami-00d03ffa3b3757af2和说明应能提供您需要的信息
发布于 2019-09-24 05:56:59
您可能需要查询AMI(Amazon机器映像) Id以获取更多信息。
尝尝这个
describe-images --image-ids yourImageId在响应中,您可以查找kernel-id
https://stackoverflow.com/questions/58070566
复制相似问题