guides

Deploying Ubuntu

Step-by-step instructions for creating a Ubuntu VM using a single command.

Last updated ยท 22 November 2024


Follow the steps below to easily set up a m1a.large virtual machine (VM) with the Ubuntu image using the exc CLI.

Prerequisites

  1. Log In to exc

    • Ensure that you are logged in to the exc CLI. If you havenโ€™t logged in yet, please refer to the Login and Registration Guide to complete the login process.
  2. Verify Login Status

    • To verify if you are logged in, run the following command:

      exc compute list
    • If you receive a 401 Unauthorized error, please log in again.

  3. SSH key

    • To verify if you have a key associated:
    exc compute key list
    • If there are no keys create a new key using this guide and come back.

Create a Security Group with Rules

  1. Create a Security Group

    exc securitygroup create --name ubuntu-security-group --description "Ubuntu ingress and egress"
  2. Create Ingress Rules to Allow SSH Traffic

    exc securitygroup rule ingress create --cidr 0.0.0.0/0 --protocol TCPv4 --port_range 22 --security_group_id $(exc securitygroup list | awk '/ubuntu-security-group/{print $1}')
    exc securitygroup rule ingress create --cidr ::/0 --protocol TCPv6 --port_range 22 --security_group_id $(exc securitygroup list | awk '/ubuntu-security-group/{print $1}')
  3. Create Egress Rules to Allow All Traffic

    exc securitygroup rule egress create --cidr 0.0.0.0/0 --protocol IPv4 --port_range ANY --security_group_id $(exc securitygroup list | awk '/ubuntu-security-group/{print $1}')
    exc securitygroup rule egress create --cidr ::/0 --protocol IPv6 --port_range ANY --security_group_id $(exc securitygroup list | awk '/ubuntu-security-group/{print $1}')

Creating a New VM

Use the following one-liner command to create a new m1a.large VM with the Ubuntu image. This command will automatically pass all the required parameters for a hassle-free experience.

exc compute create \
  --allocate_public_ipv4 \
  --name my-ubuntu-vm \
  --image_id 10 \
  --instance_type m1a.large \
  --ssh_pubkey excloud \
  --security_group_ids $(exc securitygroup list | awk '/ubuntu-security-group/{print $1}') \
  --subnet_id 1 \
  --wait
  • Command Explanation:
    • --allocate_public_ipv4 hands the VM an ephemeral public IPv4.
    • --security_group_ids accepts one or more IDs; the awk extracts the ID from exc securitygroup list.
    • --subnet_id 1 is the DEFAULT subnet in mum-1a โ€” see Subnets.
    • --wait blocks until the VM reaches the running state.

Access via SSH

  • Once the VM is up and running, use the public IP address to SSH into the VM.
ssh ubuntu@PUBLIC_IP