Launching Using Deployment Manager Template

  1. To launch instance using deployment manager, cut/paste and store the following deployment sample in a yaml file. Please be careful in cut-pasting SSH key as any extra whitespace/newline will not let you log into the instance using SSH key. For example, mydeployment.yaml and edit/add fields for your environment such as instance zone, instance type, instance name, networks, subnetworks and so on. You can also add any startup configurations to the config file. The following example adds a user called “testuser” with password “test123” to the launched instance config which is used to login into the instance in addition to the SSH based login.
    Note: Only SSH based GCP authentication is recommended, this is just an example and should not be used in production.
    
    -------Deployment Config ----
     resources: 
    - name: deploy-arista-three-nic-mgmt 
    type: compute.v1.instance 
    properties: 
    zone: us-east1-b
    machineType: zones/us-east1-b/machineTypes/n1-standard-4
    disks:
    - deviceName: boot
    type: PERSISTENT
    boot: true
    autoDelete: true
    initializeParams: 
    sourceImage: https://www.googleapis.com/compute/v1/projects/sw-veos-public/
     global/images/arista-cloudeos-4-23-0fx-10-24-2019
    networkInterfaces:
    - network: global/networks/default
    accessConfigs:
    - name: External NAT
    type: ONE_TO_ONE_NAT
     
    - network: global/networks/ts-test-vpc-1
    subnetwork: regions/us-east1/subnetworks/sub1 
    - network: global/networks/ts-test-vpv-3
    subnetwork: regions/us-east1/subnetworks/ts-test-vpc-3-sub1 
    canIpForward: true
    metadata: 
    items:
    - key: user-data
    value: |
     %EOS-STARTUP-CONFIG-START% 
     username testuser privilege 15 secret test123
     %EOS-STARTUP-CONFIG-END% 
    - key: ssh-keys 
    value: |
    testadmin:ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDYP3+wSjsNMwg9l
    /yWR/ioRmdMrzSoLTheRQsG3BxDRssdsdshQXcRcw6wAhujKEZaz
    T3dPNbABpWK44tJSWSIMWDBer6PIpxME+FCzB3ALaMKdZ9TDU9TiYMGngM5C8
    qBfrKixVoPIuRht7NLEosE3b4aNkgi5Fd5aRbCsdkIdZa3KAmPKE2IX
    dZqAscccsD5W2Lmhwg7qOXf2JFcGdTwffffMIXh2FMzqDb0vpxbsdubPEN
    +A9E6Npj0Q58XiY7roRLTtl1Z9aJtNnQforfD2/OcECBHcrvdj
    //rGCPFhT5fVQ6N9tgpGJq/ECxDMDaVG5gLGpmzUrlwgVi7jYu5E8koKOpmtlp testadmin@junk.com
  2. Deploy mydeployment.yaml:
    $gcloud --project <my_project> deployment-manager deployments create --config mydeployment.yaml
  3. Get the IP address and connect to created instance.
    
    $gcloud --project <my_project> computeinstancesdescribe --zone us-east1-b deploy-arista-three-nic-mgmt
    ...check the NAT IP address of first interface ...
    $ssh -i <my-ssh-priv-key> testadmin@<instance_nat_ip>