105 - Compute
Where's my Virtual Machine?
Read the Docs
If you want to get a better idea about the object that we will be working with in this module, you can review the docs here:
For a more general discussion, take a look here.
Objectives
In this module we'll look at how to configure your VM. We'll describe the core VM settings as well as some of the OS features that are exposed, such as creating a username and password, and adding SSH keys.
Compute Terminology
Instance
A virtual environment that runs a specific AMI operating system. You can select various Instance types which determine cost and sizing.
NIC
Connects the VM to the network
Allows the user to pass scripts to perform automated tasks to configure the instance
Compute Concepts
VM Schema
I'm not sure that this needs much explanation, as it refers to well understood concepts. So set the basic hardware, the image and the credentials.
compute:
vm:
webserver-var:
cores: 1
memory: 1 GB
image: bionic
configure:
admin:
username: (( admin_username ))
public_key: (( admin_public_key ))
Here we define the VM network interface. We associate the NIC with a public and private network interface, associate a subnet and secure it with our defined firewall.
nics:
external:
ips:
- private:
type: dynamic
public:
type: static
firewall: fw-external-access
subnet: subnet-walkthrough
It gets a bit more interesting here; using cloud-init - Powershell, BASH or any other languages that you can leverage through console are also supported - we do a lot of heavy lifting. NGINX is installed, the user is configured and a series of commands are run to bootstrap the webserver. This is extremely powerful, as there is no real limit to what you can do. If you can do it via the CLI, you can do it here.
userdata:
type: cloud-init
content: |
#cloud-config
package_upgrade: false
packages:
- nginx
users:
- name: (( admin_username ))
groups:
- sudo
sudo: ALL=(ALL) NOPASSWD:ALL
ssh_authorized_keys:
- (( admin_public_key ))
runcmd:
- sudo su
- echo '(( your_caption ))' > /var/www/html/index.nginx-debian.html
Last updated
Was this helpful?