Startup scripts can be defined from the Startup Scripts sidebar item. These scripts can then be selecting when provisioning new virtual machines, and selected scripts will execute when the new instance boots for the first time.
Shell scripts (such as scripts for bash) start with "#!" on the first line, generally followed by a path to the shell binary. For example, this bash script will update packages on Debian-based operating systems:
#!/bin/bash apt-get update; apt-get upgrade -y
cloud-config scripts can be used on images that have cloud-init installed (this includes the default template images). These can more reliably configure operating system parameters than shell scripts, and are generally easier to write.