Skip to content

Blog

Run EC2 VMDK image in Oracle VirtualBox on EC2 Metal Instance

All the scripts in this article are bash scripts

Create VMDK image

Clone the aws-ec2-ami-packer repository and follow the instructions in the README to create a Virtual Machine Disk (VMDK) from an EC2 Instance.

Then follow the steps bellow to run the VMDK in VirtualBox in an EC2 Metal instance.

Create working directory

mkdir -p ~/tmp/vmdk-on-ec2
cd ~/tmp/vmdk-on-ec2

Start an EC2 Metal Instance

Start an AWS c5.metal instance:

Create an Amazon Machine Image (AMI) using EC2 Image Builder and AWS CLI

All the scripts in this article are bash scripts

Setup for macOS

Make sure you do this setup first:

  1. Setup macOS for AWS Cloud DevOps
  2. AWS Authentication

Set variables

Set variables needed for next steps:

account_id=$(aws sts get-caller-identity --query Account --output text)

# change this to your desired region
region="us-west-2"  

# EC2 Image Builder Instance Role
ib_instance_role="ec2-ib-instance-role"

# EC2 Image Builder Instance Profile
ib_instance_profile="ec2-ib-instance-profile"

# EC2 Image Builder Security Group
ib_security_group="ec2-ib-instance-sg"