AWS vmexport using AWS cli
From Notes_Wiki
Home > Amazon web services > AWS vmexport using AWS cli
The steps do not work
- 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
- Since the JSON on the above link is malformed use AWS Management console GUI and go to
- Again go to roles vmimport and attach following additional policies
- Policy
- AmazonS3FullAccess
- Policy
- AmazonEC2FullAccess
- Install aws cli using Installing AWS command-line tools
- Create a S3 bucket for storing converted image eg saurabh-s3-vm-export
- Create an ami for testing export. The ami can be created from EC2 instance or lightsail instance snapshot exported to EC2.
- 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
- Remember to delete snapshot at lightsail and ec2. Deleting snapshot at EC2 requires de-registering the created AMI.
Refer: