All technological notes.
Download link:
Verify
aws --version
aws configure
# AWS Access Key ID [None]: access_key_id
# AWS Secret Access Key [None]: secret_access_key
# Default region name [None]: us-east-1
# Default output format [None]: json
trust-policy.json on computer.{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": { "Service": "vmie.amazonaws.com" },
"Action": "sts:AssumeRole",
"Condition": {
"StringEquals": {
"sts:Externalid": "vmimport"
}
}
}
]
}
vmimport and grant VM Import/Export access to it.aws iam create-role --role-name vmimport --assume-role-policy-document "file://path\to\trust-policy.json"
Create a specific bucket for imported disk images.
Create a file named role-policy.json with policy.
amzn-s3-demo-import-bucket and amzn-s3-demo-export-bucket with bucket.{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": ["s3:GetBucketLocation", "s3:GetObject", "s3:ListBucket"],
"Resource": [
"arn:aws:s3:::amzn-s3-demo-import-bucket",
"arn:aws:s3:::amzn-s3-demo-import-bucket/*"
]
},
{
"Effect": "Allow",
"Action": [
"s3:GetBucketLocation",
"s3:GetObject",
"s3:ListBucket",
"s3:PutObject",
"s3:GetBucketAcl"
],
"Resource": [
"arn:aws:s3:::amzn-s3-demo-export-bucket",
"arn:aws:s3:::amzn-s3-demo-export-bucket/*"
]
},
{
"Effect": "Allow",
"Action": [
"ec2:ModifySnapshotAttribute",
"ec2:CopySnapshot",
"ec2:RegisterImage",
"ec2:Describe*"
],
"Resource": "*"
}
]
}
aws iam put-role-policy --role-name vmimport --policy-name vmimport --policy-document "file://path\to\role-policy.json"
.ova file.

.ova file to S3 bucket
containers.json file that specifies the image using an S3 bucket.[
{
"Description": "image_description",
"Format": "ova",
"UserBucket": {
"S3Bucket": "bucket_name",
"S3Key": "ova_object_name"
}
}
]
aws ec2 import-image --description "My server VM" --disk-containers "file://path\to\containers.json"
# copy the import-ami-id for the next step.
aws ec2 describe-import-image-tasks --import-task-ids import-ami-id
# Status values include the following:
# active — The import task is in progress.
# deleting — The import task is being canceled.
# deleted — The import task is canceled.
# updating — Import status is updating.
# validating — The imported image is being validated.
# validated — The imported image was validated.
# converting — The imported image is being converted into an AMI.
# completed — The import task is completed and the AMI is ready to use.
ssh user_name@public_ip.