:doc:`EC2 <../../ec2>` / Client / import_volume

*************
import_volume
*************



.. py:method:: EC2.Client.import_volume(**kwargs)

  

  .. note::

    

    This API action supports only single-volume VMs. To import multi-volume VMs, use  ImportImage instead. To import a disk to a snapshot, use  ImportSnapshot instead.

    

   

  Creates an import volume task using metadata from the specified disk image.

   

  For information about the import manifest referenced by this API action, see `VM Import Manifest <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/manifest.html>`__.

   

  This API action is not supported by the Command Line Interface (CLI).

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/ImportVolume>`_  


  **Request Syntax**
  ::

    response = client.import_volume(
        AvailabilityZoneId='string',
        DryRun=True|False,
        AvailabilityZone='string',
        Image={
            'Format': 'VMDK'|'RAW'|'VHD',
            'Bytes': 123,
            'ImportManifestUrl': 'string'
        },
        Description='string',
        Volume={
            'Size': 123
        }
    )
    
  :type AvailabilityZoneId: string
  :param AvailabilityZoneId: 

    The ID of the Availability Zone for the resulting EBS volume.

     

    Either ``AvailabilityZone`` or ``AvailabilityZoneId`` must be specified, but not both.

    

  
  :type DryRun: boolean
  :param DryRun: 

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is ``DryRunOperation``. Otherwise, it is ``UnauthorizedOperation``.

    

  
  :type AvailabilityZone: string
  :param AvailabilityZone: 

    The Availability Zone for the resulting EBS volume.

     

    Either ``AvailabilityZone`` or ``AvailabilityZoneId`` must be specified, but not both.

    

  
  :type Image: dict
  :param Image: **[REQUIRED]** 

    The disk image.

    

  
    - **Format** *(string) --* **[REQUIRED]** 

      The disk image format.

      

    
    - **Bytes** *(integer) --* **[REQUIRED]** 

      The size of the disk image, in GiB.

      

    
    - **ImportManifestUrl** *(string) --* **[REQUIRED]** 

      A presigned URL for the import manifest stored in Amazon S3 and presented here as an Amazon S3 presigned URL. For information about creating a presigned URL for an Amazon S3 object, read the "Query String Request Authentication Alternative" section of the `Authenticating REST Requests <https://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html>`__ topic in the *Amazon Simple Storage Service Developer Guide*.

       

      For information about the import manifest referenced by this API action, see `VM Import Manifest <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/manifest.html>`__.

      

    
  
  :type Description: string
  :param Description: 

    A description of the volume.

    

  
  :type Volume: dict
  :param Volume: **[REQUIRED]** 

    The volume size.

    

  
    - **Size** *(integer) --* **[REQUIRED]** 

      The size of the volume, in GiB.

      

    
  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'ConversionTask': {
              'ConversionTaskId': 'string',
              'ExpirationTime': 'string',
              'ImportInstance': {
                  'Description': 'string',
                  'InstanceId': 'string',
                  'Platform': 'Windows',
                  'Volumes': [
                      {
                          'AvailabilityZone': 'string',
                          'AvailabilityZoneId': 'string',
                          'BytesConverted': 123,
                          'Description': 'string',
                          'Image': {
                              'Checksum': 'string',
                              'Format': 'VMDK'|'RAW'|'VHD',
                              'ImportManifestUrl': 'string',
                              'Size': 123
                          },
                          'Status': 'string',
                          'StatusMessage': 'string',
                          'Volume': {
                              'Id': 'string',
                              'Size': 123
                          }
                      },
                  ]
              },
              'ImportVolume': {
                  'AvailabilityZone': 'string',
                  'AvailabilityZoneId': 'string',
                  'BytesConverted': 123,
                  'Description': 'string',
                  'Image': {
                      'Checksum': 'string',
                      'Format': 'VMDK'|'RAW'|'VHD',
                      'ImportManifestUrl': 'string',
                      'Size': 123
                  },
                  'Volume': {
                      'Id': 'string',
                      'Size': 123
                  }
              },
              'State': 'active'|'cancelling'|'cancelled'|'completed',
              'StatusMessage': 'string',
              'Tags': [
                  {
                      'Key': 'string',
                      'Value': 'string'
                  },
              ]
          }
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **ConversionTask** *(dict) --* 

        Information about the conversion task.

        
        

        - **ConversionTaskId** *(string) --* 

          The ID of the conversion task.

          
        

        - **ExpirationTime** *(string) --* 

          The time when the task expires. If the upload isn't complete before the expiration time, we automatically cancel the task.

          
        

        - **ImportInstance** *(dict) --* 

          If the task is for importing an instance, this contains information about the import instance task.

          
          

          - **Description** *(string) --* 

            A description of the task.

            
          

          - **InstanceId** *(string) --* 

            The ID of the instance.

            
          

          - **Platform** *(string) --* 

            The instance operating system.

            
          

          - **Volumes** *(list) --* 

            The volumes.

            
            

            - *(dict) --* 

              Describes an import volume task.

              
              

              - **AvailabilityZone** *(string) --* 

                The Availability Zone where the resulting instance will reside.

                
              

              - **AvailabilityZoneId** *(string) --* 

                The ID of the Availability Zone where the resulting instance will reside.

                
              

              - **BytesConverted** *(integer) --* 

                The number of bytes converted so far.

                
              

              - **Description** *(string) --* 

                A description of the task.

                
              

              - **Image** *(dict) --* 

                The image.

                
                

                - **Checksum** *(string) --* 

                  The checksum computed for the disk image.

                  
                

                - **Format** *(string) --* 

                  The disk image format.

                  
                

                - **ImportManifestUrl** *(string) --* 

                  A presigned URL for the import manifest stored in Amazon S3. For information about creating a presigned URL for an Amazon S3 object, read the "Query String Request Authentication Alternative" section of the `Authenticating REST Requests <https://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html>`__ topic in the *Amazon Simple Storage Service Developer Guide*.

                   

                  For information about the import manifest referenced by this API action, see `VM Import Manifest <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/manifest.html>`__.

                  
                

                - **Size** *(integer) --* 

                  The size of the disk image, in GiB.

                  
            
              

              - **Status** *(string) --* 

                The status of the import of this particular disk image.

                
              

              - **StatusMessage** *(string) --* 

                The status information or errors related to the disk image.

                
              

              - **Volume** *(dict) --* 

                The volume.

                
                

                - **Id** *(string) --* 

                  The volume identifier.

                  
                

                - **Size** *(integer) --* 

                  The size of the volume, in GiB.

                  
            
          
        
      
        

        - **ImportVolume** *(dict) --* 

          If the task is for importing a volume, this contains information about the import volume task.

          
          

          - **AvailabilityZone** *(string) --* 

            The Availability Zone where the resulting volume will reside.

            
          

          - **AvailabilityZoneId** *(string) --* 

            The ID of the Availability Zone where the resulting volume will reside.

            
          

          - **BytesConverted** *(integer) --* 

            The number of bytes converted so far.

            
          

          - **Description** *(string) --* 

            The description you provided when starting the import volume task.

            
          

          - **Image** *(dict) --* 

            The image.

            
            

            - **Checksum** *(string) --* 

              The checksum computed for the disk image.

              
            

            - **Format** *(string) --* 

              The disk image format.

              
            

            - **ImportManifestUrl** *(string) --* 

              A presigned URL for the import manifest stored in Amazon S3. For information about creating a presigned URL for an Amazon S3 object, read the "Query String Request Authentication Alternative" section of the `Authenticating REST Requests <https://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html>`__ topic in the *Amazon Simple Storage Service Developer Guide*.

               

              For information about the import manifest referenced by this API action, see `VM Import Manifest <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/manifest.html>`__.

              
            

            - **Size** *(integer) --* 

              The size of the disk image, in GiB.

              
        
          

          - **Volume** *(dict) --* 

            The volume.

            
            

            - **Id** *(string) --* 

              The volume identifier.

              
            

            - **Size** *(integer) --* 

              The size of the volume, in GiB.

              
        
      
        

        - **State** *(string) --* 

          The state of the conversion task.

          
        

        - **StatusMessage** *(string) --* 

          The status message related to the conversion task.

          
        

        - **Tags** *(list) --* 

          Any tags assigned to the task.

          
          

          - *(dict) --* 

            Describes a tag.

            
            

            - **Key** *(string) --* 

              The key of the tag.

               

              Constraints: Tag keys are case-sensitive and accept a maximum of 127 Unicode characters. May not begin with ``aws:``.

              
            

            - **Value** *(string) --* 

              The value of the tag.

               

              Constraints: Tag values are case-sensitive and accept a maximum of 256 Unicode characters.

              
        
      
    
  