Skip to content

aws-cli

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"

Deploy Docker Swarm on AWS EC2 via cloud-formation templates - Step 1 - Network Setup

Setup network infrastructure including new VPC (Virtual Private Cloud), public and private subnets, internet gateway, security group, and ssh access.

This post is part of a thread that includes these steps:

  1. Network Setup (this post)
  2. Storage
  3. Roles
  4. Manager Instance
  5. Worker Launch Template
  6. Worker Instances
  7. Docker Swarm
  8. Cleanup