-
- create filename=
trust-policy.json
- create rolename=
vmimport
aws iam create-role --role-name vmimport --assume-role-policy-document "file://trust-policy.json"
- create filename=
role-policy.json
- attach policyname:
vmimport
to IAM Role:vmimport
aws iam put-role-policy --role-name vmimport \ --policy-name vmimport \ --policy-document "file://role-policy.json"
- check role:
vmimport
in AWS:
- create filename=
-
- create filename=
containers.json
- migrate:
bucket_name="n-backup" # Add the appropriate S3 Prefix to the VM Image vm_image_name="VM-Import/xxx.vmdk" aws ec2 import-image --description "centosv7" --disk-containers "file://containers.json"
- will have result with
"ImportTaskId": "import-ami-0d6db3a35d431e4e3"
- check status of VM import jobs, will see result
"Status": "completed"
aws ec2 describe-import-image-tasks --import-task-ids "import-ami-0d6db3a35d431e4e3" -> { "ImportImageTasks": [ { "Architecture": "x86_64", "Description": "centosv7", "ImageId": "ami-0da97e2296167b5ca", "ImportTaskId": "import-ami-0d6db3a35d431e4e3", "LicenseType": "BYOL", "Platform": "Linux", "SnapshotDetails": [ { "Description": "centosv7", "DeviceName": "/dev/sda1", "DiskImageSize": 931182592.0, "Format": "VMDK", "SnapshotId": "snap-0dc6d32a5924b22c7", "Status": "completed", "UserBucket": { "S3Bucket": "n-backup", "S3Key": "VM-Import/xxx.vmdk" } } ], "Status": "completed" } ] }
- create filename=
tquangdo / aws-ec2-migrate-onpre-to-aws Goto Github PK
View Code? Open in Web Editor NEWchua lam thuc te!!!๐ฃ๐ฃ