https://vinception.fr/how-to-migrate-instances-from-aws-to-oracle-cloud/
1.Enable the serial console
2.create S3 bucket
3.Take snapshot of EC2 instance
4.Convert the EC2 instance into a .ova file
5.Download the vmdk file from AWS S3 buckets
6.create OCI S3 bucket
7.Upload the vmdk to OCI S3 buckets
8.Import VMDK as OCI instance image.
============
-
name: Migrate aws instance to oracle OCI
host: localhost
var:
aws_access_key: XXXXXX
aws_secret_key: XXXXXX
task:name: create S3 bucket in AWS amazon.aws.s3_bucket: name: mys3bucket state: present aws_access_key: "{ XXXXX } " aws_secret_key: "{ XXXXX } " permission: public-read region: ap-south-1
-
name: create snapshot EC2 instance
amazon.aws.ec2_snapshot:
volume_id: XXXXXXX
description: take snapshot before migration
aws_access_key: " { XXXXX } "
aws_secret_key: " { XXXXX } " -
name: Convert the EC2 instance into a .ova file
command:
aws ec2 create-instance-export-task –instance-id ****** –description “Export-To-OCI” –target-environment OCI –export-to-s3-task DiskImageFormat=vmdk,ContainerFormat=ova,S3Bucket=mys3bucket
aws_access_key: " { XXXXX } "
aws_secret_key: " { XXXXX } " -
name: Download the vmdk file from AWS S3 buckets
amazon.aws.aws_s3:
bucket: mys3bucket
object: s3://mys3bucket/*******
dest: c:*****
mode: get
-
#Authentication with OCI
With Ansible and oci cloud modules(roles) installed our lab still requires an IAM user with its API signing key .
You’ll need to configure OCI-CLI so Ansible could authenticate to your OCI account via the config file (~/.oci/config)
-
name: Create bucket
oci_object_storage_bucket:
namespace_name: namespace_name_example
name: namespace_name_example
compartment_id: "ocid.compartment.oc1..exampleuniquecompartmentID"
-
name: Upload the vmdk to OCI S3 buckets
oci_object:
namespace: namespace_name_example
bucket: namespace_name_example
object: *******
src: c:\*****
-
name: Import VMDK as OCI instance image.
oci_compute_image:
compartment_id: "*************"
image_source_details:
object_name: "image-to-import.oci"
bucket_name: "MyBucket"
namespace_name: "MyNamespace"
source_type: "objectStorageTuple"