Cloud-init install packages

I am using Ubuntu cloud as indicated in the manual.

I mounted the LVM partition "cloudinit" and saw that the user-data file is responsible for the settings of the virtual machine. Just now, know how to include the package installation settings in this file and see if it will work.
Example:

Code:
# package version will be installed.
packages:
  - pwgen
  - pastebinit
 
Did it add the resolvers to the correct interface?

I've been trying a manual build as the guide mentioned is best to be used so we know what software is installed but they're added to lo.