VMware Cloud Expert

Lab 04 - Advanced Cloud Templates

Updated

Introduction

You use the design page to create Cloud Assembly template specifications for the machines and applications that you want to provision.

The code editor allows you to type, cut, copy, and paste code directly. If you're uncomfortable editing code, you can click a resource that's already in the design canvas, click the code editor Properties tab, and enter values there. Property values that you enter appear in the code as if you had typed them directly.

Cloud Agnostic Templates

A cloud agnostic template is a blueprint that allows you to deploy exactly the same construct to different clouds. Cloud Assembly has the intelligence to take this cloud agnostic blueprint and know when to place it where using which specific cloud components. At the time of GA vSphere, AWS and Azure are supported.

This bring us directly to the limitations of cloud agnostic blueprints. Because Cloud Assembly ‘translates’ the used blueprint components to the cloud specific building blocks, you can only use components that are known to all cloud providers. I can use an Ubuntu template because I pointed to the cloud specific Ubuntu templates using image mappings. I can use t-shirt size deployments like small/medium/large because I defined what I mean with these t-shirts sizes in the different cloud providers using flavor mapping.

Requirements

In the previous lab we created all of these constructs, we will now use them all to illustrate the power of cloud agnostic blueprints.

TASKS

Task 1 - Create a Cloud Agnostic Template
  1. From your VDI Desktop, access your Cloud Assemble browser tab. If the tab is closed or the session has timed out, then Access cloud assemble from your browser bookmark and login using your student account (vmcexpert#-xx@vmware-hol.com | VMware1!) if necessary.

NOTE: You created this bookmark in a previous lab. If you missed the step you can use this link - https://www.mgmt.cloud.vmware.com/. Make sure to bookmark the page for future access

  1. Click the Design Tab
  2. Click New From --> Blank Canvas
  1. Name the Template {Your_Use_Name}_CA_Ubuntu_Template
  2. Select your Project
  3. Click Create

The blueprint canvas is split up into three main sections:

  1. The Components panel, where you select the components that you want to use for your application.
  2. The Canvas, where your application infrastructure topology is represented.
  3. The Code/Property Editor where your YAML will be presented and modified.

    There are two other useful items to be aware of on this page that will help you with managing screen real estate.
  4. The Components hide/show button
  5. The Editor hide/show button. You may have noticed that the red box expands all the way across the bar, and not just on the button. This has been done because you can click anywhere on the bar to minimize these panels. Hide or show these panels as you see fit throughout the lab to make viewing relevant content easier.
  1. From the Cloud Agnostic section drag the Machine object onto the canvas
  2. In the code (YAML) Editor pane rename Cloud_Machine_1 to {Your_User_Name} i.e. vmcexpert2-31
    make the following updates also:
image:'{Your_User_Name}_Ubuntu'
flavor: {Your_User_Name}_small
constraints:
 - tag: 'platform:aws'

Be aware that YAML is whitespace sensitive, and incorrect indenting may lead to issues with provisioning. If you do make a mistake, you should see a red exclamation appear beside the line where the mistake has been made. Try it out now if you like by adding an extra space before image. Resolve the error and move to the next page.

  1. Drag the Network object from the Cloud Agnostic section
  2. On the Canvas connect the Cloud Machine to the Cloud Network by dragging a line form the left
    corner of the cloud machine to the Cloud Network object
  3. In the Code Editor Pane add a Name & Constraint property to the Cloud Network
name: 'net-web'
networkType: existing
      constraints: 
        - tag: network:vmcexpert2-31
  1. Click Test to validate the template
  2. Click Version, set the following values
    • Version: 1
    • Change Log: Initial Config
    • Click Create
  3. Click Deploy
  4. Name the Deployment {Your-User_Name}_Ubuntu
  5. Click Deploy
  6. NOTE: The deployment takes a few minis to complete. You can click the History tab to monitor the steps

We will now log into AWS to observe what was created

  1. In the Topology tab Click go to aws console, a new browser tab will open to the AWS Console
  1. Login using the following:
    • Account ID: {Your Lab Environment} I.E. VMCEXPERT3
    • IAM User name: {Your User Name} I.E. vmcexpert3-31
    • Password: {Password assigned by the Instructor}
  1. Once logged in Click Instances. You'll notice a new t2.small instance running. Take note of this instance so you can identify it later.
  2. Select the instance to view its details (IP Address, Platform, Instance Type, etc...)
  1. Return to the Cloud Assembly browser tab
  2. Click Close on the deployment
  3. Select the 3 vertical dots next to the deployment and click delete
  1. Once the deployment deletion completes, return to the AWS Console browser tab
  2. In the AWS Console the VM Instance may still be visible but the state should  be "Terminated"

NOTE: IN AWS Terminated images remain visible in the console for a while. When an instance terminates, the data on any instance store volumes associated with that instance is deleted. AWS Instance Termination

Task 2 - Using CloudConfig to Customize a deployment

With CloudConfig, you can add machine initialization commands that run at deployment time. You use initialization commands to automate the application of data or settings at instance creation time, which can customize users, permissions, installations, or any other command-based operations. Examples include:

  • Setting a hostname
  • Generating and setting up SSH private keys
  • Installing packages

You can add a cloudConfig section to cloud template code, but you can also add one to a machine image in advance, when configuring infrastructure. Then, all cloud templates that reference the source image get the same initialization.

You might have an image map and a cloud template where both contain initialization commands. At deployment time, the commands merge, and Cloud Assembly runs the consolidated commands.

  1. In the Cloud Assembly browser tab Click Design
  2. Click on your Cloud Agnostic Ubuntu Cloud Template {Your_User_Name}_Ubuntu-CA_Template
  3. Add the following code in the YAML Edition, just above the "Cloud_Network_1" Section
cloudConfig:  |
  #cloudconfig
  packages:
    - apache2

Note: Each indent is two spaces (you can use the Tab key on the keyboard). The cloudConfig:  | aligns directly below networks:

  1. Click Test to validate the template
  2. Click Version and provide the following inputs
    • Version: 2
    • Change Log: Added CloudConfig to Install Apache
    • Click Create
  1. Click Deploy
  2. Name the deployment {Your_User_Name}_Simple Template
  3. Click Deploy
  4. Feel free to review the deployment in the AWS Console as you did in the previous task after the deployment tasks completes
  5. In Cloud Assembly Click Close to Close the deployment pane

We will now update the template to deploy multiple machine instances and a load-balancer.

Task 3 - Create and Deploy a Load-Balanced Web Application
  1. In the Cloud Assembly browser tab Click Design Tab
  2. Click on your Cloud Agnostic Ubuntu Cloud Template {Your_User_Name}_Ubuntu-CA_Template
  3. Drag a Cloud Agnostic Load Balancer object onto the canvas
  4. Drag a 2nd Cloud Agnostic Network onto the Canvas
  5. Connect the Load Balancer to the 2nd Network
  6. Select the 2nd Network and Set it's Name Property to net-lb
  7. In the Code Editor Pane add a Name & Constraint property to the 2nd Cloud Network
name: 'net-lb'
networkType: existing
      constraints: 
        - tag: network:vmcexpert2-31
  1. Select the Load Balancer and set the following vales in the Routes Property
routes:
  - port: '80'
    protocol: 'TCP'
    instancePort: '80'
    instanceProtocol: 'TCP'
  1. Change the internetFacing property value to true
  2. Connect the Cloud Machine to the Load Balancer 
  3. Select the Cloud Machine and add a count property on the YAML. Set it's value to 2
  1. Click Test to validate the Template

Finally, we will modify the template by adding a input field allowing the requestor the determine how many machine instances they want instead of having 2 machines deployed every time.

  1. In the YAML Editor add the following properties and values in the Input section
inputs:
  clusterSize:
    type:  integer
    title: Cluster Size
    default: 1
    minimum: 1
    maximum: 5
  1. In the Cloud_machine_1 section, change the count value from 2 to '${input.clusterSize}'
count:  '${input.clusterSize}'
  1. Click Test, to validate the template
  2. Click Version and provide the following inputs
    • Version: 3
    • Change Log: Added Inputs for number of instance
    • Click Create
  3. Click Deploy enter the following inputs
    • Deployment Name: {Your_User_Name}_Flexible_Template
    • Cloud Template Version: Current Draft
    • Click Next
    • Cluster Size: 3
    • Deploy
  4. Monitor and review the deployment steps
  5. In the AWS Console you should now see the 3 additional instances and a Load Balancer
  1. Back in the Browser tab for Cloud Assembly, Click Close to exit the Deployment page
  2. Click the Design.
  3. Click Close, to Exit the cloud Template. We will continue from here in the next task
Task 4 - Import an Advanced Cloud Template

Task 4.1 - Deploy VROps Cloud Proxy

  1. In another new browser tab access the Cloud Services Portal, and login if required
    https://console.cloud.vmware.com/csp/gateway/portal
  2. Bookmark this page for easier future access
  3. Click the vRealize Operation Cloud Tile
  4. In the Left pane Expand Data Sources
  5. Click Cloud Proxies
  6. Click New to add a new Cloud Proxy
  7. Copy the One Time Key (OTK). We will use it to deploy the vRealize Operations Cloud Proxy appliance
  1. Access your vCenter Browser tab and log in if required (Cloudadmin@vmc.local).
  2. If the browser tab is closed, open a new tab and launch it from the bookmark
  3. In the Host and Clusters Inventory View, right-click Compute-ResourcePool
  4. Click New Virtual Machine
  5. Choose Deploy from template, Click Next
  6. Select vRealize Operations, Click Next
  7. Name the virtual Machine {Your_Login_Name}_vrops-proxy (I.E. vmcexpert3-31_vrops-proxy)
  8. Expand SDDC-Datacenter, Select CloudProxies, and click Next
  9. Click Next, on the Select a Compute Resource page
  10. Click Next on the Review details  page
  11. Check I accept all license agreements on the license agreement page and click Next
  12. Select Small Cloud Proxy and Click Next
  13. Select WorkloadDatastore on the select storage page and click Next
  14. Confirm sddc-cgw-network-1 network is selected and click Next on the Select network page
  15. On the Customize template page input the following values:
    • VMware Cloud Service OTK: Paste in the OTK you copied in step 7 If you no longer have the key repeat steps 2 - 7, where appropriate
    • Friendly Name: vROPs-Proxy_{your student numberI.E. vROPs-Proxy_3-31
    • NTP Server List: 0.us.pool.ntp.org,1.us.pool.ntp.org
    • Leave all other fields blank
  16. Click Next
  17. Click Finish
  18. Monitor the appliance deployment. Once it completes Power-On the VM
  1. Wait for the VM to complete its power-on operation. Copy the VMs IP address, you'll use it later when deploying from the cloud template
  1. Return to the vRealize Operations Cloud browser tab, and refresh the Cloud Proxies page

    NOTE: the cloud proxy can take up to 15 mins to initialize, register and show up in the console

Task 4.2 - Import and deploy an Advanced Template

  1. In the Cloud Assembly browser tab Click Design
  2. Click From New --> Upload
  3. Define the Template as follows:
    • Name: {Your_User_Name}_Cat_&_Dog
    • Project: {Select_Your_Project}
    • Upload File: {C:\Lab_Files\Day-2\Lab 04\Cats & Dogs.yaml}
  4. Click Upload
  1. Click the template to open it.
  2. Review the layout of the template and the YAML
  3. selecteach of the machine instances (frontend, api_server, mongo_server, nats_server & queue_service) and change the following:
    • image: {Your_User_Name}_Ubuntu
    • flavor: {Your_User_Name}_Small
  1. Click Test to validate the template
  2. enter the following inputs:
    • Select your landing zone: platform:vmc
    • vRops Cloud Proxy IP Address: {Your_vROps_Proxy_IP}  i.e. 192.168.X.Y
    • vRA Cloud Proxy IP Address: {Your_vRA_Proxy_IP}  i.e. 192.168.X.Y
    • CSP Refresh Token: {Your_API_Token}
  1. Click Test
  2. Once the test succeeds, Click Deploy to deploy the template
  3. Name the Deployment {Your_User_Name}_Cats_&_Dogs_VMC
  4. Click Next
  5. Enter the same inputs form step 9
  6. Click Deploy
  7. Monitor the deployment and once it completes successfully, return to the vCenter browser tab and review the machines that were deployed.
  8. Click the frontend VM and record its IP address
  1. Select the Ubuntu-DT VM and click Open Console
  2. Enter the Password of VMware1! if Prompted
  3. Launch the Firefox browser in the Ubunt-DT VM and type in {the address of your Frontend VM} for the Cats & Dogs Application
  4. Click the Gato & Cachorro buttons multiple times until the images that appears is a hedgehog.
  5. When this image (hedgehog) appears an error is generated and logged with log-insight and captured by vRealize Opreations

Conclusion

0 Comments

Add your comment

E-Mail me when someone replies to this comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.