Just do sudo bash. But you are best of setting the IP addresses in the Edit Config tab, such as
#cloud-config
password: cisco
chpasswd: { expire: False }
hostname: myhost
ssh_pwauth: True
ssh_authorized_keys:
- your-ssh-pubkey-line-goes-here
runcmd:
- ip addr add dev ens2 local 192.168.1.17/24
- ip route add to 0.0.0.0/0 dev ens2 via 192.168.1.1