Obtenir des informations sur vos VM

Vous pouvez obtenir des informations sur vos machines virtuelles (VM), leurs états et leurs attributs.

Des informations sur vos VM sont également disponibles depuis les VM elles-mêmes. Pour en savoir plus, voir Accéder aux metadata et user data d’une VM.

Obtenir des informations sur vos VM avec Cockpit v2

Voir le dashboard VMs.

Obtenir des informations sur vos VM avec OSC CLI

Obtenir des informations sur vos VM

À ce jour, cette section est disponible en anglais uniquement.

The ReadVms command lists one or more of your virtual machines (VMs).
If you provide one or more VM IDs, this action returns a description for all of these VMs. If you do not provide any VM ID, this action returns a description for all of the VMs that belong to you. If you provide an invalid VM ID, an error is returned. If you provide the ID of a VM that does not belong to you, the description of this VM is not included in the response. The refresh interval for data returned by this action is one hour, meaning that a terminated VM may appear in the response.

Request sample
$ osc-cli api ReadVms --profile "default" \
    --Filters '{
        "VmIds": ["i-12345678"]
      }'
Request sample
$ osc-cli api ReadVms --profile "default" \
    --Filters '{
        "TagKeys": ["env"],
        "TagValues": ["prod", "test"]
      }'

This command contains the following attributes that you need to specify:

  • DryRun: (optional) If true, checks whether you have the required permissions to perform the action.

  • Filters: (optional) One or more filters.

    • Architectures: (optional) The architectures of the VMs (i386 | x86_64).

    • BlockDeviceMappingDeleteOnVmDeletion: (optional) Whether the BSU volumes are deleted when terminating the VMs.

    • BlockDeviceMappingDeviceNames: (optional) The device names for the BSU volumes (in the format /dev/sdX, /dev/sdXX, /dev/xvdX, or /dev/xvdXX).

    • BlockDeviceMappingLinkDates: (optional) The link dates for the BSU volumes mapped to the VMs (for example, 2016-01-23T18:45:30.000Z).

    • BlockDeviceMappingStates: (optional) The states for the BSU volumes (attaching | attached | detaching | detached).

    • BlockDeviceMappingVolumeIds: (optional) The volume IDs of the BSU volumes.

    • ClientTokens: (optional) The idempotency tokens provided when launching the VMs.

    • CreationDates: (optional) The dates when the VMs were launched.

    • ImageIds: (optional) The IDs of the OMIs used to launch the VMs.

    • IsSourceDestChecked: (optional) Whether the source/destination checking is enabled (true) or disabled (false).

    • KeypairNames: (optional) The names of the keypairs used when launching the VMs.

    • LaunchNumbers: (optional) The numbers for the VMs when launching a group of several VMs (for example, 0, 1, 2, and so on).

    • Lifecycles: (optional) Whether the VMs are Spot Instances (spot).

    • NetIds: (optional) The IDs of the Nets in which the VMs are running.

    • NicAccountIds: (optional) The IDs of the NICs.

    • NicDescriptions: (optional) The descriptions of the NICs.

    • NicIsSourceDestChecked: (optional) Whether the source/destination checking is enabled (true) or disabled (false).

    • NicLinkNicDeleteOnVmDeletion: (optional) Whether the NICs are deleted when the VMs they are attached to are deleted.

    • NicLinkNicDeviceNumbers: (optional) The device numbers the NICs are attached to.

    • NicLinkNicLinkNicDates: (optional) The dates and times (UTC) when the NICs were attached to the VMs.

    • NicLinkNicLinkNicIds: (optional) The IDs of the NIC attachments.

    • NicLinkNicStates: (optional) The states of the attachments.

    • NicLinkNicVmAccountIds: (optional) The account IDs of the owners of the VMs the NICs are attached to.

    • NicLinkNicVmIds: (optional) The IDs of the VMs the NICs are attached to.

    • NicLinkPublicIpAccountIds: (optional) The account IDs of the owners of the public IPs associated with the NICs.

    • NicLinkPublicIpLinkPublicIpIds: (optional) The association IDs returned when the public IPs were associated with the NICs.

    • NicLinkPublicIpPublicIpIds: (optional) The allocation IDs returned when the public IPs were allocated to their accounts.

    • NicLinkPublicIpPublicIps: (optional) The public IPs associated with the NICs.

    • NicMacAddresses: (optional) The Media Access Control (MAC) addresses of the NICs.

    • NicNetIds: (optional) The IDs of the Nets where the NICs are located.

    • NicNicIds: (optional) The IDs of the NICs.

    • NicPrivateIpsLinkPublicIpAccountIds: (optional) The account IDs of the owner of the public IPs associated with the private IPs.

    • NicPrivateIpsLinkPublicIpIds: (optional) The public IPs associated with the private IPs.

    • NicPrivateIpsPrimaryIp: (optional) Whether the private IPs are the primary IPs associated with the NICs.

    • NicPrivateIpsPrivateIps: (optional) The private IPs of the NICs.

    • NicSecurityGroupIds: (optional) The IDs of the security groups associated with the NICs.

    • NicSecurityGroupNames: (optional) The names of the security groups associated with the NICs.

    • NicStates: (optional) The states of the NICs (available | in-use).

    • NicSubnetIds: (optional) The IDs of the Subnets for the NICs.

    • NicSubregionNames: (optional) The Subregions where the NICs are located.

    • Platforms: (optional) The platforms. Use windows if you have Windows VMs. Otherwise, leave this filter blank.

    • PrivateIps: (optional) The private IPs of the VMs.

    • ProductCodes: (optional) The product codes associated with the OMI used to create the VMs.

    • PublicIps: (optional) The public IPs of the VMs.

    • ReservationIds: (optional) The IDs of the reservation of the VMs, created every time you launch VMs. These reservation IDs can be associated with several VMs when you launch a group of VMs using the same launch request.

    • RootDeviceNames: (optional) The names of the root devices for the VMs (for example, /dev/sda1)

    • RootDeviceTypes: (optional) The root devices types used by the VMs (always ebs)

    • SecurityGroupIds: (optional) The IDs of the security groups for the VMs (only in the public Cloud).

    • SecurityGroupNames: (optional) The names of the security groups for the VMs (only in the public Cloud).

    • StateReasonCodes: (optional) The reason codes for the state changes.

    • StateReasonMessages: (optional) The messages describing the state changes.

    • StateReasons: (optional) The reasons explaining the current states of the VMs. This filter is like the StateReasonCodes one.

    • SubnetIds: (optional) The IDs of the Subnets for the VMs.

    • SubregionNames: (optional) The names of the Subregions of the VMs.

    • TagKeys: (optional) The keys of the tags associated with the VMs.

    • TagValues: (optional) The values of the tags associated with the VMs.

    • Tags: (optional) The key/value combination of the tags associated with the VMs, in the following format: "Filters":{"Tags":["TAGKEY=TAGVALUE"]}.

    • Tenancies: (optional) The tenancies of the VMs (dedicated | default | host).

    • VmIds: (optional) One or more IDs of VMs.

    • VmSecurityGroupIds: (optional) The IDs of the security groups for the VMs.

    • VmSecurityGroupNames: (optional) The names of the security group for the VMs.

    • VmStateCodes: (optional) The state codes of the VMs: -1 (quarantine), 0 (pending), 16 (running), 32 (shutting-down), 48 (terminated), 64 (stopping), and 80 (stopped).

    • VmStateNames: (optional) The state names of the VMs (pending | running | stopping | stopped | shutting-down | terminated | quarantine).

    • VmTypes: (optional) The VM types (for example, t2.micro). For more information, see VM Types.

  • NextPageToken: (optional) The token to request the next page of results. Each token refers to a specific page.

  • ResultsPerPage: (optional) The maximum number of logs returned in a single response (between 1 and 1000, both included). By default, 100.

The ReadVms command returns the following elements:

  • NextPageToken: The token to request the next page of results. Each token refers to a specific page.

  • ResponseContext: Information about the context of the response.

    • RequestId: The ID of the request.

  • Vms: Information about one or more VMs.

    • Architecture: The architecture of the VM (i386 | x86_64).

    • BlockDeviceMappings: The block device mapping of the VM.

      • Bsu: Information about the created BSU volume.

        • DeleteOnVmDeletion: If true, the volume is deleted when terminating the VM. If false, the volume is not deleted when terminating the VM.

        • LinkDate: The date and time (UTC) at which the volume was attached to the VM, in ISO 8601 date-time format.

        • State: The state of the volume.

        • VolumeId: The ID of the volume.

      • DeviceName: The name of the device.

    • BsuOptimized: This parameter is not available. It is present in our API for the sake of historical compatibility with AWS.

    • ClientToken: The idempotency token provided when launching the VM.

    • CreationDate: The date and time (UTC) at which the VM was created.

    • DeletionProtection: If true, you cannot delete the VM unless you change this parameter back to false.

    • Hypervisor: The hypervisor type of the VMs (ovm | xen).

    • ImageId: The ID of the OMI used to create the VM.

    • IsSourceDestChecked: (Net only) If true, the source/destination check is enabled. If false, it is disabled.

    • KeypairName: The name of the keypair used when launching the VM.

    • LaunchNumber: The number for the VM when launching a group of several VMs (for example, 0, 1, 2, and so on).

    • NestedVirtualization: If true, nested virtualization is enabled. If false, it is disabled.

    • NetId: The ID of the Net in which the VM is running.

    • Nics: (Net only) The network interface cards (NICs) the VMs are attached to.

      • AccountId: The account ID of the owner of the NIC.

      • Description: The description of the NIC.

      • IsSourceDestChecked: (Net only) If true, the source/destination check is enabled. If false, it is disabled.

      • LinkNic: Information about the network interface card (NIC).

        • DeleteOnVmDeletion: If true, the NIC is deleted when the VM is terminated.

        • DeviceNumber: The device index for the NIC attachment (between 1 and 7, both included).

        • LinkNicId: The ID of the NIC to attach.

        • State: The state of the attachment (attaching | attached | detaching | detached).

      • LinkPublicIp: Information about the public IP associated with the NIC.

        • PublicDnsName: The name of the public DNS.

        • PublicIp: The public IP associated with the NIC.

        • PublicIpAccountId: The account ID of the owner of the public IP.

      • MacAddress: The Media Access Control (MAC) address of the NIC.

      • NetId: The ID of the Net for the NIC.

      • NicId: The ID of the NIC.

      • PrivateDnsName: The name of the private DNS.

      • PrivateIps: The private IP or IPs of the NIC.

        • IsPrimary: If true, the IP is the primary private IP of the NIC.

        • LinkPublicIp: Information about the public IP associated with the NIC.

          • PublicDnsName: The name of the public DNS.

          • PublicIp: The public IP associated with the NIC.

          • PublicIpAccountId: The account ID of the owner of the public IP.

        • PrivateDnsName: The name of the private DNS.

        • PrivateIp: The private IP.

      • SecurityGroups: One or more IDs of security groups for the NIC.

        • SecurityGroupId: The ID of the security group.

        • SecurityGroupName: The name of the security group.

      • State: The state of the NIC (available | attaching | in-use | detaching).

      • SubnetId: The ID of the Subnet for the NIC.

    • OsFamily: Indicates the operating system (OS) of the VM.

    • Performance: The performance of the VM (medium | high | highest).

    • Placement: Information about the placement of the VM.

      • SubregionName: The name of the Subregion. If you specify this parameter, you must not specify the Nics parameter.

      • Tenancy: The tenancy of the VM (default, dedicated, or a dedicated group ID).

    • PrivateDnsName: The name of the private DNS.

    • PrivateIp: The primary private IP of the VM.

    • ProductCodes: The product codes associated with the OMI used to create the VM.

    • PublicDnsName: The name of the public DNS.

    • PublicIp: The public IP of the VM.

    • ReservationId: The reservation ID of the VM.

    • RootDeviceName: The name of the root device for the VM (for example, /dev/sda1).

    • RootDeviceType: The type of root device used by the VM (always bsu).

    • SecurityGroups: One or more security groups associated with the VM.

      • SecurityGroupId: The ID of the security group.

      • SecurityGroupName: The name of the security group.

    • State: The state of the VM (pending | running | stopping | stopped | shutting-down | terminated | quarantine).

    • StateReason: The reason explaining the current state of the VM.

    • SubnetId: The ID of the Subnet for the VM.

    • Tags: One or more tags associated with the VM.

      • Key: The key of the tag, with a minimum of 1 character.

      • Value: The value of the tag, between 0 and 255 characters.

    • UserData: The Base64-encoded MIME user data.

    • VmId: The ID of the VM.

    • VmInitiatedShutdownBehavior: The VM behavior when you stop it. If set to stop, the VM stops. If set to restart, the VM stops then automatically restarts. If set to terminate, the VM stops and is deleted.

    • VmType: The type of VM. For more information, see VM Types.

Result sample
{
  "Vms": [
    {
      "VmType": "tinav5.c1r1p2",
      "VmInitiatedShutdownBehavior": "stop",
      "State": "running",
      "StateReason": "",
      "RootDeviceType": "ebs",
      "RootDeviceName": "/dev/sda1",
      "IsSourceDestChecked": true,
      "KeypairName": "keypair-example",
      "ImageId": "ami-12345678",
      "DeletionProtection": false,
      "Architecture": "x86_64",
      "NestedVirtualization": false,
      "BlockDeviceMappings": [
        {
          "DeviceName": "/dev/sda1",
          "Bsu": {
            "VolumeId": "vol-12345678",
            "State": "attached",
            "LinkDate": "2010-10-01T12:34:56.789Z",
            "DeleteOnVmDeletion": true
          }
        }
      ],
      "VmId": "i-12345678",
      "ReservationId": "r-12345678",
      "Hypervisor": "xen",
      "Placement": {
        "Tenancy": "default",
        "SubregionName": "eu-west-2a"
      },
      "ProductCodes": [
        "0001"
      ],
      "CreationDate": "2010-10-01T12:34:56.789Z",
      "UserData": "",
      "SubnetId": "subnet-12345678",
      "PrivateIp": "10.0.0.4",
      "SecurityGroups": [
        {
          "SecurityGroupName": "security-group-example",
          "SecurityGroupId": "sg-12345678"
        }
      ],
      "BsuOptimized": false,
      "LaunchNumber": 0,
      "NetId": "vpc-12345678",
      "Nics": [
        {
          "SubnetId": "subnet-12345678",
          "State": "in-use",
          "LinkNic": {
            "State": "attached",
            "DeviceNumber": 0,
            "LinkNicId": "eni-attach-12345678",
            "DeleteOnVmDeletion": true
          },
          "IsSourceDestChecked": true,
          "PrivateDnsName": "ip-10-0-0-4.eu-west-2.compute.internal",
          "Description": "Primary network interface",
          "AccountId": "123456789012",
          "SecurityGroups": [
            {
              "SecurityGroupName": "security-group-example",
              "SecurityGroupId": "sg-12345678"
            }
          ],
          "MacAddress": "A1:B2:C3:D4:E5:F6",
          "NetId": "vpc-12345678",
          "NicId": "eni-12345678",
          "PrivateIps": [
            {
              "PrivateDnsName": "ip-10-0-0-4.eu-west-2.compute.internal",
              "PrivateIp": "10.0.0.4",
              "IsPrimary": true
            }
          ]
        }
      ],
      "Performance": "high",
      "Tags": [
        {
          "Value": "prod",
          "Key": "env"
        }
      ],
      "PrivateDnsName": "ip-10-0-0-4.eu-west-2.compute.internal"
    }
  ],
  "ResponseContext": {
    "RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
  }
}

Obtenir des informations sur l’état de vos VM

À ce jour, cette section est disponible en anglais uniquement.

The ReadVmsState command lists the status of one or more virtual machines (VMs).

Request sample
$ osc-cli api ReadVmsState --profile "default" \
    --AllVms True
Request sample
$ osc-cli api ReadVmsState --profile "default" \
    --Filters '{
        "SubregionNames": ["eu-west-2a"]
      }'

This command contains the following attributes that you need to specify:

  • AllVms: (optional) If true, includes the status of all VMs. By default or if set to false, only includes the status of running VMs.

  • DryRun: (optional) If true, checks whether you have the required permissions to perform the action.

  • Filters: (optional) One or more filters.

    • MaintenanceEventCodes: (optional) The code for the scheduled event (system-reboot | system-maintenance).

    • MaintenanceEventDescriptions: (optional) The description of the scheduled event.

    • MaintenanceEventsNotAfter: (optional) The latest date and time (UTC) the event can end.

    • MaintenanceEventsNotBefore: (optional) The earliest date and time (UTC) the event can start.

    • SubregionNames: (optional) The names of the Subregions of the VMs.

    • VmIds: (optional) One or more IDs of VMs.

    • VmStates: (optional) The states of the VMs (pending | running | stopping | stopped | shutting-down | terminated | quarantine).

  • NextPageToken: (optional) The token to request the next page of results. Each token refers to a specific page.

  • ResultsPerPage: (optional) The maximum number of logs returned in a single response (between 1 and 1000, both included). By default, 100.

The ReadVmsState command returns the following elements:

  • NextPageToken: The token to request the next page of results. Each token refers to a specific page.

  • ResponseContext: Information about the context of the response.

    • RequestId: The ID of the request.

  • VmStates: Information about one or more VM states.

    • MaintenanceEvents: One or more scheduled events associated with the VM.

      • Code: The code of the event (system-reboot | system-maintenance).

      • Description: The description of the event.

      • NotAfter: The latest scheduled end date and time (UTC) for the event.

      • NotBefore: The earliest scheduled start date and time (UTC) for the event.

    • SubregionName: The name of the Subregion of the VM.

    • VmId: The ID of the VM.

    • VmState: The state of the VM (pending | running | stopping | stopped | shutting-down | terminated | quarantine).

Result sample
{
  "VmStates": [
    {
      "VmId": "i-12345678",
      "VmState": "running",
      "SubregionName": "eu-west-2a",
      "MaintenanceEvents": []
    },
    {
      "VmId": "i-87654321",
      "VmState": "stopped",
      "SubregionName": "eu-west-2a",
      "MaintenanceEvents": []
    }
  ],
  "ResponseContext": {
    "RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
  }
}
Result sample
{
  "VmStates": [
    {
      "VmId": "i-12345678",
      "VmState": "running",
      "SubregionName": "eu-west-2a",
      "MaintenanceEvents": []
    }
  ],
  "ResponseContext": {
    "RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
  }
}

Obtenir des informations sur vos VM avec oapi-cli

Obtenir des informations sur vos VM

À ce jour, cette section est disponible en anglais uniquement.

The ReadVms command lists one or more of your virtual machines (VMs).
If you provide one or more VM IDs, this action returns a description for all of these VMs. If you do not provide any VM ID, this action returns a description for all of the VMs that belong to you. If you provide an invalid VM ID, an error is returned. If you provide the ID of a VM that does not belong to you, the description of this VM is not included in the response. The refresh interval for data returned by this action is one hour, meaning that a terminated VM may appear in the response.

Request sample
$ oapi-cli --profile "default" ReadVms \
    --Filters '{
        "VmIds": ["i-12345678"]
      }'
Request sample
$ oapi-cli --profile "default" ReadVms \
    --Filters '{
        "TagKeys": ["env"],
        "TagValues": ["prod", "test"]
      }'

This command contains the following attributes that you need to specify:

  • DryRun: (optional) If true, checks whether you have the required permissions to perform the action.

  • Filters: (optional) One or more filters.

    • Architectures: (optional) The architectures of the VMs (i386 | x86_64).

    • BlockDeviceMappingDeleteOnVmDeletion: (optional) Whether the BSU volumes are deleted when terminating the VMs.

    • BlockDeviceMappingDeviceNames: (optional) The device names for the BSU volumes (in the format /dev/sdX, /dev/sdXX, /dev/xvdX, or /dev/xvdXX).

    • BlockDeviceMappingLinkDates: (optional) The link dates for the BSU volumes mapped to the VMs (for example, 2016-01-23T18:45:30.000Z).

    • BlockDeviceMappingStates: (optional) The states for the BSU volumes (attaching | attached | detaching | detached).

    • BlockDeviceMappingVolumeIds: (optional) The volume IDs of the BSU volumes.

    • ClientTokens: (optional) The idempotency tokens provided when launching the VMs.

    • CreationDates: (optional) The dates when the VMs were launched.

    • ImageIds: (optional) The IDs of the OMIs used to launch the VMs.

    • IsSourceDestChecked: (optional) Whether the source/destination checking is enabled (true) or disabled (false).

    • KeypairNames: (optional) The names of the keypairs used when launching the VMs.

    • LaunchNumbers: (optional) The numbers for the VMs when launching a group of several VMs (for example, 0, 1, 2, and so on).

    • Lifecycles: (optional) Whether the VMs are Spot Instances (spot).

    • NetIds: (optional) The IDs of the Nets in which the VMs are running.

    • NicAccountIds: (optional) The IDs of the NICs.

    • NicDescriptions: (optional) The descriptions of the NICs.

    • NicIsSourceDestChecked: (optional) Whether the source/destination checking is enabled (true) or disabled (false).

    • NicLinkNicDeleteOnVmDeletion: (optional) Whether the NICs are deleted when the VMs they are attached to are deleted.

    • NicLinkNicDeviceNumbers: (optional) The device numbers the NICs are attached to.

    • NicLinkNicLinkNicDates: (optional) The dates and times (UTC) when the NICs were attached to the VMs.

    • NicLinkNicLinkNicIds: (optional) The IDs of the NIC attachments.

    • NicLinkNicStates: (optional) The states of the attachments.

    • NicLinkNicVmAccountIds: (optional) The account IDs of the owners of the VMs the NICs are attached to.

    • NicLinkNicVmIds: (optional) The IDs of the VMs the NICs are attached to.

    • NicLinkPublicIpAccountIds: (optional) The account IDs of the owners of the public IPs associated with the NICs.

    • NicLinkPublicIpLinkPublicIpIds: (optional) The association IDs returned when the public IPs were associated with the NICs.

    • NicLinkPublicIpPublicIpIds: (optional) The allocation IDs returned when the public IPs were allocated to their accounts.

    • NicLinkPublicIpPublicIps: (optional) The public IPs associated with the NICs.

    • NicMacAddresses: (optional) The Media Access Control (MAC) addresses of the NICs.

    • NicNetIds: (optional) The IDs of the Nets where the NICs are located.

    • NicNicIds: (optional) The IDs of the NICs.

    • NicPrivateIpsLinkPublicIpAccountIds: (optional) The account IDs of the owner of the public IPs associated with the private IPs.

    • NicPrivateIpsLinkPublicIpIds: (optional) The public IPs associated with the private IPs.

    • NicPrivateIpsPrimaryIp: (optional) Whether the private IPs are the primary IPs associated with the NICs.

    • NicPrivateIpsPrivateIps: (optional) The private IPs of the NICs.

    • NicSecurityGroupIds: (optional) The IDs of the security groups associated with the NICs.

    • NicSecurityGroupNames: (optional) The names of the security groups associated with the NICs.

    • NicStates: (optional) The states of the NICs (available | in-use).

    • NicSubnetIds: (optional) The IDs of the Subnets for the NICs.

    • NicSubregionNames: (optional) The Subregions where the NICs are located.

    • Platforms: (optional) The platforms. Use windows if you have Windows VMs. Otherwise, leave this filter blank.

    • PrivateIps: (optional) The private IPs of the VMs.

    • ProductCodes: (optional) The product codes associated with the OMI used to create the VMs.

    • PublicIps: (optional) The public IPs of the VMs.

    • ReservationIds: (optional) The IDs of the reservation of the VMs, created every time you launch VMs. These reservation IDs can be associated with several VMs when you launch a group of VMs using the same launch request.

    • RootDeviceNames: (optional) The names of the root devices for the VMs (for example, /dev/sda1)

    • RootDeviceTypes: (optional) The root devices types used by the VMs (always ebs)

    • SecurityGroupIds: (optional) The IDs of the security groups for the VMs (only in the public Cloud).

    • SecurityGroupNames: (optional) The names of the security groups for the VMs (only in the public Cloud).

    • StateReasonCodes: (optional) The reason codes for the state changes.

    • StateReasonMessages: (optional) The messages describing the state changes.

    • StateReasons: (optional) The reasons explaining the current states of the VMs. This filter is like the StateReasonCodes one.

    • SubnetIds: (optional) The IDs of the Subnets for the VMs.

    • SubregionNames: (optional) The names of the Subregions of the VMs.

    • TagKeys: (optional) The keys of the tags associated with the VMs.

    • TagValues: (optional) The values of the tags associated with the VMs.

    • Tags: (optional) The key/value combination of the tags associated with the VMs, in the following format: "Filters":{"Tags":["TAGKEY=TAGVALUE"]}.

    • Tenancies: (optional) The tenancies of the VMs (dedicated | default | host).

    • VmIds: (optional) One or more IDs of VMs.

    • VmSecurityGroupIds: (optional) The IDs of the security groups for the VMs.

    • VmSecurityGroupNames: (optional) The names of the security group for the VMs.

    • VmStateCodes: (optional) The state codes of the VMs: -1 (quarantine), 0 (pending), 16 (running), 32 (shutting-down), 48 (terminated), 64 (stopping), and 80 (stopped).

    • VmStateNames: (optional) The state names of the VMs (pending | running | stopping | stopped | shutting-down | terminated | quarantine).

    • VmTypes: (optional) The VM types (for example, t2.micro). For more information, see VM Types.

  • NextPageToken: (optional) The token to request the next page of results. Each token refers to a specific page.

  • ResultsPerPage: (optional) The maximum number of logs returned in a single response (between 1 and 1000, both included). By default, 100.

The ReadVms command returns the following elements:

  • NextPageToken: The token to request the next page of results. Each token refers to a specific page.

  • ResponseContext: Information about the context of the response.

    • RequestId: The ID of the request.

  • Vms: Information about one or more VMs.

    • Architecture: The architecture of the VM (i386 | x86_64).

    • BlockDeviceMappings: The block device mapping of the VM.

      • Bsu: Information about the created BSU volume.

        • DeleteOnVmDeletion: If true, the volume is deleted when terminating the VM. If false, the volume is not deleted when terminating the VM.

        • LinkDate: The date and time (UTC) at which the volume was attached to the VM, in ISO 8601 date-time format.

        • State: The state of the volume.

        • VolumeId: The ID of the volume.

      • DeviceName: The name of the device.

    • BsuOptimized: This parameter is not available. It is present in our API for the sake of historical compatibility with AWS.

    • ClientToken: The idempotency token provided when launching the VM.

    • CreationDate: The date and time (UTC) at which the VM was created.

    • DeletionProtection: If true, you cannot delete the VM unless you change this parameter back to false.

    • Hypervisor: The hypervisor type of the VMs (ovm | xen).

    • ImageId: The ID of the OMI used to create the VM.

    • IsSourceDestChecked: (Net only) If true, the source/destination check is enabled. If false, it is disabled.

    • KeypairName: The name of the keypair used when launching the VM.

    • LaunchNumber: The number for the VM when launching a group of several VMs (for example, 0, 1, 2, and so on).

    • NestedVirtualization: If true, nested virtualization is enabled. If false, it is disabled.

    • NetId: The ID of the Net in which the VM is running.

    • Nics: (Net only) The network interface cards (NICs) the VMs are attached to.

      • AccountId: The account ID of the owner of the NIC.

      • Description: The description of the NIC.

      • IsSourceDestChecked: (Net only) If true, the source/destination check is enabled. If false, it is disabled.

      • LinkNic: Information about the network interface card (NIC).

        • DeleteOnVmDeletion: If true, the NIC is deleted when the VM is terminated.

        • DeviceNumber: The device index for the NIC attachment (between 1 and 7, both included).

        • LinkNicId: The ID of the NIC to attach.

        • State: The state of the attachment (attaching | attached | detaching | detached).

      • LinkPublicIp: Information about the public IP associated with the NIC.

        • PublicDnsName: The name of the public DNS.

        • PublicIp: The public IP associated with the NIC.

        • PublicIpAccountId: The account ID of the owner of the public IP.

      • MacAddress: The Media Access Control (MAC) address of the NIC.

      • NetId: The ID of the Net for the NIC.

      • NicId: The ID of the NIC.

      • PrivateDnsName: The name of the private DNS.

      • PrivateIps: The private IP or IPs of the NIC.

        • IsPrimary: If true, the IP is the primary private IP of the NIC.

        • LinkPublicIp: Information about the public IP associated with the NIC.

          • PublicDnsName: The name of the public DNS.

          • PublicIp: The public IP associated with the NIC.

          • PublicIpAccountId: The account ID of the owner of the public IP.

        • PrivateDnsName: The name of the private DNS.

        • PrivateIp: The private IP.

      • SecurityGroups: One or more IDs of security groups for the NIC.

        • SecurityGroupId: The ID of the security group.

        • SecurityGroupName: The name of the security group.

      • State: The state of the NIC (available | attaching | in-use | detaching).

      • SubnetId: The ID of the Subnet for the NIC.

    • OsFamily: Indicates the operating system (OS) of the VM.

    • Performance: The performance of the VM (medium | high | highest).

    • Placement: Information about the placement of the VM.

      • SubregionName: The name of the Subregion. If you specify this parameter, you must not specify the Nics parameter.

      • Tenancy: The tenancy of the VM (default, dedicated, or a dedicated group ID).

    • PrivateDnsName: The name of the private DNS.

    • PrivateIp: The primary private IP of the VM.

    • ProductCodes: The product codes associated with the OMI used to create the VM.

    • PublicDnsName: The name of the public DNS.

    • PublicIp: The public IP of the VM.

    • ReservationId: The reservation ID of the VM.

    • RootDeviceName: The name of the root device for the VM (for example, /dev/sda1).

    • RootDeviceType: The type of root device used by the VM (always bsu).

    • SecurityGroups: One or more security groups associated with the VM.

      • SecurityGroupId: The ID of the security group.

      • SecurityGroupName: The name of the security group.

    • State: The state of the VM (pending | running | stopping | stopped | shutting-down | terminated | quarantine).

    • StateReason: The reason explaining the current state of the VM.

    • SubnetId: The ID of the Subnet for the VM.

    • Tags: One or more tags associated with the VM.

      • Key: The key of the tag, with a minimum of 1 character.

      • Value: The value of the tag, between 0 and 255 characters.

    • UserData: The Base64-encoded MIME user data.

    • VmId: The ID of the VM.

    • VmInitiatedShutdownBehavior: The VM behavior when you stop it. If set to stop, the VM stops. If set to restart, the VM stops then automatically restarts. If set to terminate, the VM stops and is deleted.

    • VmType: The type of VM. For more information, see VM Types.

Result sample
{
  "Vms": [
    {
      "VmType": "tinav5.c1r1p2",
      "VmInitiatedShutdownBehavior": "stop",
      "State": "running",
      "StateReason": "",
      "RootDeviceType": "ebs",
      "RootDeviceName": "/dev/sda1",
      "IsSourceDestChecked": true,
      "KeypairName": "keypair-example",
      "ImageId": "ami-12345678",
      "DeletionProtection": false,
      "Architecture": "x86_64",
      "NestedVirtualization": false,
      "BlockDeviceMappings": [
        {
          "DeviceName": "/dev/sda1",
          "Bsu": {
            "VolumeId": "vol-12345678",
            "State": "attached",
            "LinkDate": "2010-10-01T12:34:56.789Z",
            "DeleteOnVmDeletion": true
          }
        }
      ],
      "VmId": "i-12345678",
      "ReservationId": "r-12345678",
      "Hypervisor": "xen",
      "Placement": {
        "Tenancy": "default",
        "SubregionName": "eu-west-2a"
      },
      "ProductCodes": [
        "0001"
      ],
      "CreationDate": "2010-10-01T12:34:56.789Z",
      "UserData": "",
      "SubnetId": "subnet-12345678",
      "PrivateIp": "10.0.0.4",
      "SecurityGroups": [
        {
          "SecurityGroupName": "security-group-example",
          "SecurityGroupId": "sg-12345678"
        }
      ],
      "BsuOptimized": false,
      "LaunchNumber": 0,
      "NetId": "vpc-12345678",
      "Nics": [
        {
          "SubnetId": "subnet-12345678",
          "State": "in-use",
          "LinkNic": {
            "State": "attached",
            "DeviceNumber": 0,
            "LinkNicId": "eni-attach-12345678",
            "DeleteOnVmDeletion": true
          },
          "IsSourceDestChecked": true,
          "PrivateDnsName": "ip-10-0-0-4.eu-west-2.compute.internal",
          "Description": "Primary network interface",
          "AccountId": "123456789012",
          "SecurityGroups": [
            {
              "SecurityGroupName": "security-group-example",
              "SecurityGroupId": "sg-12345678"
            }
          ],
          "MacAddress": "A1:B2:C3:D4:E5:F6",
          "NetId": "vpc-12345678",
          "NicId": "eni-12345678",
          "PrivateIps": [
            {
              "PrivateDnsName": "ip-10-0-0-4.eu-west-2.compute.internal",
              "PrivateIp": "10.0.0.4",
              "IsPrimary": true
            }
          ]
        }
      ],
      "Performance": "high",
      "Tags": [
        {
          "Value": "prod",
          "Key": "env"
        }
      ],
      "PrivateDnsName": "ip-10-0-0-4.eu-west-2.compute.internal"
    }
  ],
  "ResponseContext": {
    "RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
  }
}

Obtenir des informations sur l’état de vos VM

À ce jour, cette section est disponible en anglais uniquement.

The ReadVmsState command lists the status of one or more virtual machines (VMs).

Request sample
$ oapi-cli --profile "default" ReadVmsState \
    --AllVms True
Request sample
$ oapi-cli --profile "default" ReadVmsState \
    --Filters '{
        "SubregionNames": ["eu-west-2a"]
      }'

This command contains the following attributes that you need to specify:

  • AllVms: (optional) If true, includes the status of all VMs. By default or if set to false, only includes the status of running VMs.

  • DryRun: (optional) If true, checks whether you have the required permissions to perform the action.

  • Filters: (optional) One or more filters.

    • MaintenanceEventCodes: (optional) The code for the scheduled event (system-reboot | system-maintenance).

    • MaintenanceEventDescriptions: (optional) The description of the scheduled event.

    • MaintenanceEventsNotAfter: (optional) The latest date and time (UTC) the event can end.

    • MaintenanceEventsNotBefore: (optional) The earliest date and time (UTC) the event can start.

    • SubregionNames: (optional) The names of the Subregions of the VMs.

    • VmIds: (optional) One or more IDs of VMs.

    • VmStates: (optional) The states of the VMs (pending | running | stopping | stopped | shutting-down | terminated | quarantine).

  • NextPageToken: (optional) The token to request the next page of results. Each token refers to a specific page.

  • ResultsPerPage: (optional) The maximum number of logs returned in a single response (between 1 and 1000, both included). By default, 100.

The ReadVmsState command returns the following elements:

  • NextPageToken: The token to request the next page of results. Each token refers to a specific page.

  • ResponseContext: Information about the context of the response.

    • RequestId: The ID of the request.

  • VmStates: Information about one or more VM states.

    • MaintenanceEvents: One or more scheduled events associated with the VM.

      • Code: The code of the event (system-reboot | system-maintenance).

      • Description: The description of the event.

      • NotAfter: The latest scheduled end date and time (UTC) for the event.

      • NotBefore: The earliest scheduled start date and time (UTC) for the event.

    • SubregionName: The name of the Subregion of the VM.

    • VmId: The ID of the VM.

    • VmState: The state of the VM (pending | running | stopping | stopped | shutting-down | terminated | quarantine).

Result sample
{
  "VmStates": [
    {
      "VmId": "i-12345678",
      "VmState": "running",
      "SubregionName": "eu-west-2a",
      "MaintenanceEvents": []
    },
    {
      "VmId": "i-87654321",
      "VmState": "stopped",
      "SubregionName": "eu-west-2a",
      "MaintenanceEvents": []
    }
  ],
  "ResponseContext": {
    "RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
  }
}
Result sample
{
  "VmStates": [
    {
      "VmId": "i-12345678",
      "VmState": "running",
      "SubregionName": "eu-west-2a",
      "MaintenanceEvents": []
    }
  ],
  "ResponseContext": {
    "RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
  }
}

Obtenir des informations sur vos instances avec AWS CLI

Avant de commencer : Installez et configurez AWS CLI. Pour en savoir plus, voir Installer et configurer AWS CLI.

Obtenir des informations générales sur vos instances

Pour obtenir des informations générales sur une ou plusieurs instances, utilisez la commande describe-instances en suivant cette syntaxe :

Exemple de requête
$ aws ec2 describe-instances \
    --profile YOUR_PROFILE \
    --instance-ids i-12345678 i-87654321 i-12348765 i-56784321 \
    --filters Name=instance-state-name,Values=stopped \
    --endpoint https://fcu.eu-west-2.outscale.com

Cette commande contient les attributs suivants que vous devez spécifier :

  • (optionnel) profile : Le profil nommé que vous voulez utiliser, créé pendant la configuration d’AWS CLI. Pour en savoir plus, voir Installer et configurer AWS CLI.

  • (optionnel) instance-ids : Un ou plusieurs ID d’instances.

    Si vous ne spécifiez aucun ID d’instance, toutes vos instances ou toutes les instances qui correspondent aux filtres spécifiés sont décrites.

  • (optionnel) filters : Un ou plusieurs filtres, au format "Name=X,Values=Y".

    Vous pouvez spécifier plusieurs valeurs pour un même filtre en utilisant le format "Name=X,Values=Y, Z".

    Les filtres suivants sont disponibles :

    • architecture : L’architecture de l’instance (i386 | x86_64).

    • availability-zone : L’Availability Zone de l’instance. Pour en savoir plus, voir À propos des Régions et Sous-régions.

    • block-device-mapping.attach-time : Le moment auquel un volume BSU a été attaché à l’instance (par exemple, 2016-01-23T18:45:30.000Z).

    • block-device-mapping.delete-on-termination : Indique si le volume BSU est supprimé quand l’instance est terminée.

    • block-device-mapping.device-name : Le nom du périphérique pour le volume BSU (par exemple, /dev/sdh or xvdh).

    • block-device-mapping.status : L’état du volume BSU (attaching | attached | detaching | detached).

    • block-device-mapping.volume-id : L’ID du volume BSU.

    • client-token : Le jeton d’idempotence fourni lors du lancement de l’instance.

    • group-id : L’ID du security group pour l’instance (uniquement dans le Cloud public).

    • group-name : Le nom du security group pour l’instance (uniquement dans le Cloud public).

    • hypervisor : Le type d’hyperviseur de l’instance (toujours xen).

    • image-id : L’ID de l’OMI utilisée pour lancer l’instance.

    • instance-id : L’ID de l’instance.

    • instance-state-code : Le code de l’état de l’instance : -1 (quarantine), 0 (pending), 16 (running), 32 (shutting-down), 48 (terminated), 64 (stopping), ou 80 (stopped).

    • instance-state-name : L’état de l’instance (pending | running | stopping | stopped | shutting-down | terminated | quarantine).

    • instance-type : Le type d’instance (par exemple, t2.micro). Pour en savoir plus, voir Types de VM.

    • ip-address : Dans le Cloud public, l’IP publique associée à l’instance (remplacée par l’IP externe (EIP), s’il y en a une). Dans un VPC, l’EIP associée à l’instance, s’il y en a une.

    • kernel-id : L’ID du kernel.

    • key-name : Le nom de la keypair utilisée pour l’instance. Pour en savoir plus, voir À propos des keypairs.

    • launch-index : L’index de lancement de l’instance. Pour en savoir plus, voir À propos des VM > Informations générales sur les VM.

    • launch-time : Le moment auquel l’instance a été lancée (par exemple, 2016-04-20T08:26:26.540Z) .

    • monitoring-state : Indique si le monitoring est activé pour l’instance (toujours disabled).

    • owner-id : L’ID de compte du propriétaire de l’instance.

    • placement-group-name : Le nom du groupe de placement pour l’instance.

    • platform : La plateforme (windows si vous avez des instances Windows, sinon laissez vide).

    • private-ip-address : L’IP privée de l’instance.

    • product-code : Le code produit associé à l’OMI utilisée pour lancer l’instance.

    • ramdisk-id : L’ID du disque RAM.

    • reason : La raison pour l’état actuel de l’instance (similaire à state-reason-code).

    • requester-id : L’ID de l’entité ayant lancé l’instance (par exemple, Cockpit ou Auto Scaling).

    • reservation-id : L’ID de la réservation de l’instance. Pour en savoir plus, voir À propos des VM > Informations générales sur les VM.

    • root-device-name : Le nom du périphérique associé au volume système (par exemple, /dev/sda1).

    • root-device-type : Le type de volume système (always ebs).

    • state-reason-code : Le code de la raison du changement d’état.

    • state-reason-message : Un message décrivant le changement d’état.subnet-id : L’ID du subnet dans lequel l’instance est.

    • tag-key : La clé d’un tag associé à la ressource.

    • tag-value : La valeur d’un tag associé à la ressource.

    • tag:XXXX : La valeur d’un tag associé à la ressource, où XXXX est la clé du tag.

      Pour filtrer un tag dont la clé est XXXX et la valeur est YYYY, vous pouvez donc utiliser un des deux formats suivants :

      • --filters Name=tag-key,Values=XXXX Name=tag-value,Values=YYYY

      • --filters Name=tag:XXXX,Values=YYYY

    • tenancy : L’allocation de l’instance (dedicated | default). Pour en savoir plus, voir À propos des VM > Allocation des VM et VM dédiées.

    • virtualization-type : Le type de virtualisation de l’instance (toujours hvm).

    • vpc-id : L’ID du VPC dans lequel l’instance est (dans le Cloud public, vpc-00000000).

    • network-interface.description : La description de l’interface réseau.

    • network-interface.subnet-id : L’ID du subnet dans lequel l’instance est.

    • network-interface.vpc-id : L’ID du VPC dans lequel l’instance est (dans le Cloud public, vpc-00000000).

    • network-interface.network-interface-id : L’ID de l’interface réseau de l’instance (eni-XXXXXXXX).

    • network-interface.owner-id : L’ID de compte du propriétaire de l’interface réseau.

    • network-interface.availability-zone : L’Availability Zone pour l’interface réseau.

    • network-interface.requester-id : L’ID du requêteur pour l’interface réseau.

    • network-interface.requester-managed : Indique si l’interface réseau est gérée par 3DS OUTSCALE.

    • network-interface.status : L’état de l’interface réseau (available | in-use).

    • network-interface.mac-address : L’addresse MAC de l’interface réseau.

    • network-interface.source-dest-check : Si true, la vérification source/destination du trafic réseau de l’interface réseau est activé. Si false, elle ne l’est pas.

    • network-interface.group-id : L’ID du security group pour l’interface réseau.

    • network-interface.group-name : Le nom du security group pour l’interface réseau.

    • network-interface.attachment.attachment-id : L’ID de l’attachement de l’interface.

    • network-interface.attachment.instance-id : L’ID de l’instance à laquelle l’interface réseau est attachée.

    • network-interface.attachment.instance-owner-id : L’ID de compte du propriétaire de l’instance à laquelle l’interface réseau est attachée.

    • network-interface.attachment.device-index : L’index du périphérique auquel l’interface réseau est attachée.

    • network-interface.attachment.status : L’état de l’attachement (attaching | attached | detaching | detached ).

    • network-interface.attachment.attach-time : Le moment auquel l’interface réseau a été attachée à l’instance.

    • network-interface.attachment.delete-on-termination : Indique si l’attachement est supprimé quand l’instance est terminée.

    • network-interface.addresses.private-ip-address : L’IP privée associée à l’interface réseau.

    • network-interface.addresses.primary : Indique si l’IP de l’interface réseau est l’IP privée principale.

    • network-interface.addresses.association.public-ip : L’External IP associée à l’interface réseau de l’instance (s’il y en a une).

    • network-interface.addresses.association.ip-owner-id : L’ID de compte du propriétaire de l’External IP associée à l’interface réseau de l’instance.

    • network-interface.association.public-ip : L’IP externe (EIP) associée à l’interface réseau.

    • network-interface.association.ip-owner-id : L’ID du compte du propriétaire de l’IP externe (EIP) associée à l’interface réseau.

    • network-interface.association.allocation-id : L’ID d’allocation. Cet ID est renvoyé quand vous allouez une IP externe (EIP) à votre interface réseau.

    • network-interface.association.association-id : L’ID d’association. Cet ID est renvoyé quand l’interface réseau est associée à une IP externe (EIP).

  • endpoint : Le endpoint correspondant à la Région à laquelle vous voulez envoyer la requête. Pour en savoir plus, voir Installer et configurer AWS CLI.

La commande describe-instances renvoie les éléments suivants :

  • Reservations : Informations à propos d’une ou plusieurs réservations. Cet élément contient les informations suivantes :

    • OwnerId : L’ID de compte du propriétaire de l’instance.

    • ReservationId : L’ID de la réservation.

    • Groups : Les security groups pour les instances de la réservation (nom et ID des security groups).

    • Instances : Informations à propos d’une ou plusieurs instances. Cet élément contient les informations suivantes :

      • Monitoring : Informations à propos de l’état du monitoring de l’instance (toujours disabled).

      • PublicDnsName : Le nom DNS public de l’instance.

      • Platform : Pas d’information renvoyée.

      • State : Informations à propos de l’état de l’instance (le code et le nom de l’état).

      • EbsOptimized : Indique si l’instance est optimisée pour BSU ou non. Pour en savoir plus, voir Types de VM.

      • LaunchTime : Le moment auquel l’instance a été lancée.

      • PublicIpAddress : Dans le Cloud public, l’IP publique associée à l’instance (remplacée par l’IP externe (EIP), s’il y en a une). Dans un VPC, l’EIP associée à l’instance, s’il y en a une.

      • PrivateIpAddress : L’IP privée de l’instance.

      • ProductCodes : Pas d’information renvoyée si vous utilisez une OMI officielle.

      • Tags : Un ou plusieurs tags associés à l’instance, avec leur valeur (Value) et leur clé (Key).

      • InstanceId : L’ID de l’instance.

      • ImageId : L’ID de l’OMI utilisée pour lancer l’instance.

      • VpcId : L’ID du VPC dans lequel l’instance est (dans le Cloud public, vpc-00000000).

      • PrivateDnsNAme : Le nom DNS privé de l’instance.

      • KeyName : Le nom de la keypair utilisée pour l’instance. Pour en savoir plus, voir À propos des keypairs.

      • SecurityGroups : Les security groups pour l’instance (leur nom et ID).

      • ClientToken : Un identifiant unique pour gérer l’idempotence.

      • InstanceType : Le type d’instance. Pour en savoir plus, voir Types de VM.

      • NetworkInterfaces : Dans un VPC, une ou plusieurs interfaces réseau pour l’instance.

      • Placement : Informations à propos du placement de l’instance.

      • Hypervisor : Le type d’hyperviseur de l’instance (toujours xen).

      • BlockDeviceMappings : Un ou plusieurs block device mappings pour l’instance. Pour en savoir plus, voir Définir des block device mappings.

      • Architecture : L’architecture de l’instance.

      • KernelId : Pas d’information renvoyée.

      • RootDeviceName : Le nom du périphérique pour le volume système de l’instance.

      • VirtualizationType : Le type de virtualisation de l’instance (toujours hvm).

      • RootDeviceType : Le type de volume système pour l’instance (toujours ebs).

      • AmiLaunchIndex : L’index de lancement de l’instance. Pour en savoir plus, voir À propos des VM > Informations générales sur les VM.

        Exemple de résultat
            "Reservations": [
                {
                    "OwnerId": "1234567890000",
                    "ReservationId": "r-12345678",
                    "Groups": [
                        {
                            "GroupName": "Dev_BL",
                            "GroupId": "sg-87654321"
                        }
                    ],
                    "Instances": [
                        {
                            "Monitoring": {
                                "State": "disabled"
                            },
                            "PublicDnsName": "ows-111-1-1-1.eu-west-2.compute.outscale.com",
                            "Platform": "",
                            "State": {
                                "Code": 16,
                                "Name": "running"
                            },
                            "EbsOptimized": false,
                            "LaunchTime": "2016-04-25T13:57:26.393Z",
                            "PublicIpAddress": "111.1.1.1",
                            "PrivateIpAddress": "10.0.1.100",
                            "ProductCodes": [],
                            "Tags": [
                                {
                                    "Value": "Jenkins",
                                    "Key": "Name"
                                }
                            ],
                            "InstanceId": "i-87654321",
                            "ImageId": "ami-12345678",
                            "PrivateDnsName": "ip-10-0-1-100.eu-west-2.compute.internal",
                            "KeyName": "key_name",
                            "SecurityGroups": [
                                {
                                    "GroupName": "group_name",
                                    "GroupId": "sg-87654321"
                                }
                            ],
                            "ClientToken": "",
                            "InstanceType": "m1.large",
                            "NetworkInterfaces": [],
                            "Placement": {
                                "Tenancy": "default",
                                "GroupName": "",
                                "AvailabilityZone": "eu-west-2a"
                            },
                            "Hypervisor": "xen",
                            "BlockDeviceMappings": [
                                {
                                    "DeviceName": "/dev/sda1",
                                    "Ebs": {
                                        "Status": "attached",
                                        "DeleteOnTermination": true,
                                        "VolumeId": "vol-12345678",
                                        "AttachTime": "2016-04-25T13:57:26.393Z"
                                    }
                                }
                            ],
                            "Architecture": "x86_64",
                            "KernelId": "",
                            "RootDeviceName": "/dev/sda1",
                            "VirtualizationType": "hvm",
                            "RootDeviceType": "ebs",
                            "AmiLaunchIndex": 0
                        }
                    ]
                }
            ]
        }

Obtenir des informations sur l’état de vos instances

Pour obtenir des informations sur l’état d’une ou plusieurs instances, utilisez la commande describe-instance-status en suivant cette syntaxe :

Exemple de requête
$ aws ec2 describe-instance-status \
    --profile YOUR_PROFILE \
    --instance-ids i-12345678 i-87654321 i-12348765 i-56784321 \
    --filters Name=X,Values=Y \
    --endpoint https://fcu.eu-west-2.outscale.com

Cette commande contient les attributs suivants que vous devez spécifier :

  • (optionnel) profile : Le profil nommé que vous voulez utiliser, créé pendant la configuration d’AWS CLI. Pour en savoir plus, voir Installer et configurer AWS CLI.

  • (optionnel) instance-ids : Un ou plusieurs ID d’instances.

    Si vous ne spécifiez aucun ID d’instance, toutes vos instances ou toutes les instances qui correspondent aux filtres spécifiés sont décrites. #

  • (optionnel) max-items : Le nombre maximum de résultats renvoyés dans une seule page, entre 5 et 1000.

    Vous ne pouvez pas spécifier les attributs instance-ids et max-items dans la même requête.

  • (optionnel) include-all-instances : Si paramétré sur true, inclus les états de toutes les instances. Par défaut ou si paramétré sur false, inclut uniquement les états des instances à l’état running.

  • (optionnel) filters : Un ou plusieurs filtres, au format "Name=X,Values=Y".

    Vous pouvez spécifier plusieurs valeurs pour un même filtre en utilisant le format "Name=X,Values=Y, Z".

    Les filtres suivants sont disponibles :

    • availability-zone : L’Availability Zone de l’instance. Pour en savoir plus, voir À propos des Régions et Sous-régions.

    • event.code : Le code de l’événement planifié (system-reboot | system-maintenance). Pour en savoir plus, voir Maintenance de notre infrastructure.

    • event.description : La description de l’évènement planifié.

    • instance-state-code : Le code de l’état de l’instance : -1 (quarantine), 0 (pending), 16 (running), 32 (shutting-down), 48 (terminated), 64 (stopping), ou 80 (stopped).

    • instance-state-name : L’état de l’instance (pending | running | stopping | stopped | shutting-down | terminated | quarantine).

  • endpoint : Le endpoint correspondant à la Région à laquelle vous voulez envoyer la requête. Pour en savoir plus, voir Installer et configurer AWS CLI.

La commande describe-instance-status renvoie les éléments suivants :

  • InstanceStatuses : Informations à propos de l’état d’une ou plusieurs instances. Cet élément contient les informations suivantes :

    • AvailabilityZone : L’Availability Zone de l’instance.

    • InstanceId : L’ID de l’instance.

    • InstanceState : Informations à propos de l’état de l’instance. Cet élément contient les informations suivantes :

      • Code : Le code de l’état de l’instance (un nombre entier non signé 16 bits).

      • Name : L’état de l’instance.

    • SystemStatus : L’état du système de l’instance.

    • Events : Informations à propos d’un ou plusieurs événements planifiés associés à l’instance. Cet élément contient les informations suivantes :

      • Code : Le code de l’événement planifié (system-reboot | system-maintenance).

      • Description : Informations à propos de l’événement planifié.

      • NotBefore : L’heure de début de l’événement planifié la plus tôt.

      • NotAfter : L’heure de fin d’un événement planifié la plus tardive.

  • NextToken : Le token pour afficher la prochaine page de résultats. Si null, il n’y a plus de résultats à afficher.

    Exemple de résultat
    {
        "InstanceStatuses": [
            {
                "InstanceStatus": {
                    "Status": "insufficient-data",
                    "Details": []
                },
                "AvailabilityZone": "eu-west-2a",
                "InstanceId": "i-12345678",
                "InstanceState": {
                    "Code": 16,
                    "Name": "running"
                },
                "SystemStatus": {
                    "Status": "insufficient-data",
                    "Details": []
                },
                "Events": []
            }
        ]
    }

Obtenir des informations sur un attribut d’une instance

Pour obtenir des informations sur un attribut d’une instance, utilisez la commande describe-instance-attribute en suivant cette syntaxe :

Exemple de requête
$ aws ec2 describe-instance-attribute \
    --profile YOUR_PROFILE \
    --instance-id i-12345678 \
    --attribute disableApiTermination \
    --endpoint https://fcu.eu-west-2.outscale.com

Cette commande contient les attributs suivants que vous devez spécifier :

  • (optionnel) profile : Le profil nommé que vous voulez utiliser, créé pendant la configuration d’AWS CLI. Pour en savoir plus, voir Installer et configurer AWS CLI.

  • attribute : L’attribut de l’instance (userData | instanceInitiatedShutdownBehavior | rootDeviceName | instanceType | blockDeviceMapping | groupSet | ebsOptimized | sourceDestCheck | disableApiTermination).

    • Vous pouvez spécifier uniquement un attribut à la fois.

    • Vous pouvez décrire l’attribut sourceDestCheck uniquement si l’instance est dans un VPC.

  • instance-id : L’ID de l’instance.

  • endpoint : Le endpoint correspondant à la Région à laquelle vous voulez envoyer la requête. Pour en savoir plus, voir Installer et configurer AWS CLI.

La commande describe-instance-attribute renvoie les éléments suivants :

  • InstanceId : L’ID de l’instance.

  • La valeur de l’attribut (ici, DisableApiTermination est paramétré sur false).

    Exemple de résultat
    {
        "InstanceId": "i-12345678",
        "DisableApiTermination": {
            "Value": false
        }
    }

Pages connexes

Méthodes API correspondantes

AWS™ et Amazon Web Services™ sont des marques de commerce d'Amazon Technologies, Inc. ou de ses affiliées aux États-Unis et/ou dans les autres pays.