Moving an existing AWS EC2 workload to E2E means exporting it from AWS as an image, passing it through an E2E Object Storage bucket, and importing it as a custom node image. The steps take you from the EC2 instance to a running E2E node.
Prepare the EC2 instance
Section titled “Prepare the EC2 instance”Install and enable the OpenNebula context package on the EC2 instance before you export it; an image exported without it boots on E2E but has no network. See Install the OpenNebula context package for the commands for your distribution.
Export the instance from AWS
Section titled “Export the instance from AWS”Do these steps from any machine where you can install the AWS CLI, with an AWS account that can create IAM roles and export images.
-
In the AWS Console, power off the instance, then open EC2 → Actions → Image → Create Image to create an AMI of it. Note the AMI ID, which starts with
ami-. -
Install the AWS CLI if you do not have it. On Linux:
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"unzip awscliv2.zipsudo ./aws/install -
Configure it with your AWS access key, secret key, and the region the instance is in:
aws configureThe command asks for four values in turn: AWS Access Key ID, AWS Secret Access Key, Default region name (for example
ap-south-1), and Default output format (press Enter to keep the default). -
Create an S3 bucket in the same AWS region to hold the exported image. Replace
<s3-bucket-name>with a name of your own in this step and in every later command on this page. -
AWS writes the export through a role named
vmimport, which you create. Save this trust policy astrust-policy.json:{"Version": "2012-10-17","Statement": [{"Effect": "Allow","Principal": { "Service": "vmie.amazonaws.com" },"Action": "sts:AssumeRole","Condition": { "StringEquals": { "sts:ExternalId": "vmimport" } }}]}Then create the role, giving the full path to the file after
file://:aws iam create-role --role-name vmimport \--assume-role-policy-document "file://trust-policy.json" -
Give the role access to your bucket. Save this policy as
role-policy.json, with your bucket name in bothResourcelines:{"Version": "2012-10-17","Statement": [{"Effect": "Allow","Action": ["s3:GetBucketLocation","s3:GetObject","s3:ListBucket","s3:PutObject","s3:GetBucketAcl"],"Resource": ["arn:aws:s3:::<s3-bucket-name>", "arn:aws:s3:::<s3-bucket-name>/*"]},{"Effect": "Allow","Action": ["ec2:ModifySnapshotAttribute","ec2:CopySnapshot","ec2:RegisterImage","ec2:Describe*"],"Resource": "*"}]}Attach it to the role:
aws iam put-role-policy --role-name vmimport --policy-name vmimport \--policy-document "file://role-policy.json" -
Export the AMI in RAW format:
aws ec2 export-image --image-id <ami-id> --disk-image-format RAW \--s3-export-location S3Bucket=<s3-bucket-name>,S3Prefix=exports/The command prints an export task ID that starts with
export-ami-. -
Watch the export until it finishes. Replace
<export-task-id>with the ID from the previous step:aws ec2 describe-export-image-tasks --export-image-task-ids <export-task-id>The
Statusfield readsactivewhile the export runs andcompletedwhen the RAW file is in your bucket underexports/. -
Download the RAW file from the S3 bucket to your machine:
aws s3 cp s3://<s3-bucket-name>/exports/<file-name>.raw .
Import the exported image into E2E
Section titled “Import the exported image into E2E”- Create a bucket in E2E Object Storage, and generate an access key with Bucket Admin permission on it.
- Upload the RAW file to that bucket; see Connect with the mc client for the command.
- On the Saved Images page, click Import Custom Images and import the uploaded file. In Delhi, the Private EOS Bucket tab reads it with your access key; with Public URL, turn on Download for the bucket first. See Import a custom image for each field and the format and size limits the import checks.
- Once the image reaches Ready, launch a node from it and confirm your application runs.
Once the node is running, connect to it and confirm your application works the same as it did on EC2, then decommission the original instance once you are satisfied it is a clean move.
If something goes wrong
Section titled “If something goes wrong”| Symptom | What to do |
|---|---|
| The imported image boots but has no network | The OpenNebula context package was not installed before the AMI was created. Install it on a running E2E node and save a new image, or redo the export with the context package installed first. |
aws ec2 export-image fails with a permission error |
The vmimport role is missing, or its inline policy does not cover the export bucket. Re-create the role and policy in AWS. |
The mc upload to E2E fails |
Confirm the access key has Bucket Admin permission, and that the bucket’s Public Access Config allows upload and download. |
| The image stays Creating and never reaches Ready | The object’s URL is not reachable: the bucket is not public, or the link expired. Make it public again and retry the import. |
For anything else that goes wrong with the import itself, see Troubleshooting image import and export. Keep the imported image after the move; you can build more nodes from it.