AWS vmexport using AWS cli

From Notes_Wiki

Home > Amazon web services > AWS vmexport using AWS cli

The steps do not work

  1. Create IAM user with requried role as per https://docs.aws.amazon.com/vm-import/latest/userguide/vmie_prereqs.html#vmimport-role
    Since the JSON on the above link is malformed use AWS Management console GUI and go to
    Services
    IAM
    Roles
    Create role
    Use case
    EC2
    Polciy
    VMImportExportRoleForAWSConnector
    Role name
    vmimport #AS IT IS
  2. Again go to roles vmimport and attach following additional policies
    Policy
    AmazonS3FullAccess
    Policy
    AmazonEC2FullAccess
  3. Install aws cli using Installing AWS command-line tools
  4. Create a S3 bucket for storing converted image eg saurabh-s3-vm-export
  5. Create an ami for testing export. The ami can be created from EC2 instance or lightsail instance snapshot exported to EC2.
  6. Start export using:
    aws ec2 export-image --image-id <ami-id> --disk-image-format <VMDK|RAW|VHD> --s3-export-location S3Bucket=<bucket-name>,S3Prefix=exports/
    The above keeps giving error:
    An error occurred (InvalidParameter) when calling the ExportImage operation: The service role vmimport provided does not exist or does not have sufficient permissions
  7. Remember to delete snapshot at lightsail and ec2. Deleting snapshot at EC2 requires de-registering the created AMI.


Refer:


Home > Amazon web services > AWS vmexport using AWS cli