Title here
Summary here
Follow the steps below to easily set up a n1.2c virtual machine (VM) with the Ubuntu image using the exc
CLI.
Log In to exc
exc
CLI. If you haven’t logged in yet, please refer to the Login and Registration Guide to complete the login process.Verify Login Status
exc compute list
401 Unauthorized
error, please log in again.SSH key
exc compute key list
Create a Security Group
exc securitygroup create --name ubuntu-security-group --description "Ubuntu ingress and egress"
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}')
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}')
Use the following one-liner command to create a new n1.2c 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 1 --instance_type n1.2c --ssh_pubkey excloud --project_id 1 --security_group_id $(exc securitygroup list | awk '/ubuntu-security-group/{print $1}') --subnet_id $(exc compute subnet list | awk 'NR==2{print $1}')
awk
to extract the necessary IDs for subnet, SSH key, and security group.--allocate_public_ipv4
flag is used to allocate a public IP address to your VM.ssh ubuntu@PUBLIC_IP