While maintaining deployments and networks, you might need the ability to relocate machines that you deployed with Cloud Assembly.

For example, you might deploy to a test network first, then move to a production network. The technique described here lets you design a cloud template in advance to prepare for such day 2 actions. Note that the machine is moved. It isn't deleted and redeployed.

This procedure only applies to Cloud.vSphere.Machine resources. It won't work for cloud agnostic machines deployed to vSphere.

Prerequisites

  • The Cloud Assembly network profile must include all subnets that the machine will connect to. In Cloud Assembly, you can check networks by going to Infrastructure > Configure > Network Profiles.

    The network profile must be in an account and region that are part of the appropriate Cloud Assembly project for your users.

  • Tag the two subnets with different tags. The example that follows assumes that test and prod are the tag names.
  • The deployed machine must keep the same IP assignment type. It can't change from static to DHCP, or vice versa, while moving to another network.

Procedure

  1. In Cloud Assembly, go to Design, and create a cloud template for the deployment.
  2. In the inputs section of the code, add an entry that lets the user select a network.
    inputs:
      net-tagging:
        type: string
        enum:
          - test
          - prod
        title: Select a network
  3. In the resources section of the code, add the Cloud.Network and connect the vSphere machine to it.
  4. Under the Cloud.Network, create a constraint that references the selection from the inputs.
    resources:
      ABCServer:    
        type: Cloud.vSphere.Machine
        properties:
          name: abc-server
          . . . 
          networks:
           - network: '${resource["ABCNet"].id}'
      ABCNet:
        type: Cloud.Network
        properties:
          name: abc-network
          . . .
          constraints:
           - tag: '${input.net-tagging}'
  5. Continue with your design, and deploy it as you normally would. At deployment, the interface prompts you to select the test or prod network.
  6. When you need to make a day 2 change, go to Resources > Deployments > Deployments, and locate the deployment associated with the cloud template.
  7. To the right of the deployment, click Actions > Update.
  8. In the Update panel, the interface prompts you the same way, to select the test or prod network.
  9. To change networks, make your selection, click Next, and click Submit.