You can use extensibility actions along with subscriptions to automate and simplify tagging VMs.

As a cloud administrator, you can create deployments that are automatically tagged with specified inputs and outputs by using extensibility actions and extensibility subscriptions. When a new deployment is created against the project containing the tag VM subscription, the deployment event triggers the Tag VM script to run and the tags are automatically applied. This saves time and promotes efficiency while allowing for easier deployment management.

Prerequisites

  • Access to cloud administrator credentials.
  • Amazon Web Services role for Lambda functions.

Procedure

  1. Navigate to Extensibility > Library > Actions > New Action and create an action with the following parameters.
    Parameter Description
    Action Name Extensibility action name, preferably with TagVM as a prefix or suffix.
    Project Project to test the extensibility action against.
    Action Template Tag VM
    Runtime Python
    Script Source Write Script
  2. Enter Handler as the Main function.
  3. Add tagging inputs for testing the extensibility action.
    For example, resourceNames = ["DB_VM"] and target = world.
  4. To save your action, click Save.
  5. To test your action, click Test.
  6. To exit the action editor, click Close.
  7. Navigate to Extensibility > Subscriptions.
  8. Click New Subscription.
  9. Enter the following subscription details.
    Detail Setting
    Event Topic Select an event topic related to the tagging phase of the VM. For example, Compute Allocation.
    Note: Tags must be part of the event parameters of the selected event topic.
    Blocking Set the timeout for the subscription to 1 minute.
    Action/Workflow Select an extensibility action runnable type, and select your custom extensibility action.
  10. To save your custom extensibility action subscription, click Save.
  11. Navigate to Design > Cloud Templates, and create a cloud template from a blank canvas.
  12. Add two virtual machines to the cloud template: Application_VM and DB_VM.
  13. To deploy the VMs, click Deploy.
  14. During deployment, verify that the event is initiated and the extensibility action is run.
  15. To verify that the tags were applied correctly, navigate to Infrastructure > Resources > Machines.